Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
May 20, 2012, 11:10:11 am
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Search:
Advanced search
Welcome to the HERAS-AF Forum...
373
Posts in
89
Topics by
272
Members
Latest Member:
Jasmine
HERAS-AF Forum
HERAS-AF XACML (0.x, "old")
HERAS-AF XACML
(Moderator:
Florian Huonder
)
Warn in log when loading ContextAndPolicyConfiguration.xml
« previous
next »
Pages:
[
1
]
Author
Topic: Warn in log when loading ContextAndPolicyConfiguration.xml (Read 1431 times)
Sylvain LF
Newbie
Posts: 9
Warn in log when loading ContextAndPolicyConfiguration.xml
«
on:
July 06, 2009, 09:01:46 am »
Hello,
I'm starting with your pdp implementation. With your example, everything works well (policy and context load).
However when i try to load "ContextAndPolicyConfiguration.xml" (
http://svn.herasaf.org/herasaf-xacml/tags/0.12.0/herasaf-xacml-integrationtests/src/test/resources/config/
),i get 2 warns :
Code:
09:51:15.338 [main] INFO o.s.b.f.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [config/ContextAndPolicyConfiguration.xml]
09:51:15.369 [main] DEBUG o.s.b.f.xml.DefaultDocumentLoader - Using JAXP provider [com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl]
09:51:15.369 [main] DEBUG o.s.b.f.xml.PluggableSchemaResolver - Found XML schema [http://www.springframework.org/schema/beans/spring-beans-2.5.xsd] in classpath: org/springframework/beans/factory/xml/spring-beans-2.5.xsd
09:51:15.416 [main] DEBUG o.s.b.f.xml.PluggableSchemaResolver - Found XML schema [http://schemas.herasaf.org/herasaf-xacml/0.12.0/contextAndPolicyConfiguration/contextAndPolicyConfiguration-0.12.0.xsd] in classpath: contextAndPolicyConfiguration-0.12.0.xsd
09:51:15.447 [main] DEBUG o.s.b.f.x.DefaultBeanDefinitionDocumentReader - Loading bean definitions
09:51:36.550 [main] WARN o.h.x.c.u.ContextAndPolicyConfiguration - Validating turned off because schema could not be initialized.
09:51:59.588 [main] WARN o.h.x.c.u.ContextAndPolicyConfiguration - Validating turned off because schema could not be initialized.
I changed this :
Code:
<schemaByPath>
file:src/test/resources/xacmlSchema/access_control-xacml-2.0-policy-schema-os.xml
</schemaByPath>
by my own pathfile, but i always 2 warns.
Is this normal ?
Regards,
SLF
Logged
Florian Huonder
Administrator
Full Member
Posts: 129
Re: Warn in log when loading ContextAndPolicyConfiguration.xml
«
Reply #1 on:
July 06, 2009, 09:38:48 am »
Hi Sylvain,
That should not be.
May I ask you how you use our library?
Did you download the sourcecode via SVN and let it run, or did you download one of these JARs from here
http://maven.herasaf.org/artifactory/repo/org/herasaf/xacml/herasaf-xacml-assembly/0.12.0/
?
I am asking that because the path points to the
src/test/resources...
.
Please ensure that the
src/test/resources/xacmlSchema/access_control-xacml-2.0-policy-schema-os.xml
file is available in your classpath at this location.
Let me know if I could help you.
Regards,
Florian
Logged
Sylvain LF
Newbie
Posts: 9
Re: Warn in log when loading ContextAndPolicyConfiguration.xml
«
Reply #2 on:
July 06, 2009, 09:50:38 am »
Hi Florian,
Thanks for you quick answer.
I've downloaded your pdp implementation via SVN as Maven Project, then i've installed in my Maven Repository.
So my project is new Maven Project, and i write all dependencies in my "pom.xml" like that :
Code:
<dependency>
<groupId>org.herasaf.xacml</groupId>
<artifactId>herasaf-xacml-referenceloader</artifactId>
<version>0.12.0</version>
</dependency>
<dependency>
<groupId>org.herasaf.xacml</groupId>
<artifactId>herasaf-xacml-locator</artifactId>
<version>0.12.0</version>
</dependency>
<dependency>
<groupId>org.herasaf.xacml</groupId>
<artifactId>herasaf-xacml-persistence</artifactId>
<version>0.12.0</version>
</dependency>
<dependency>
<groupId>org.herasaf.xacml</groupId>
<artifactId>herasaf-xacml-evaluatablepreprocess</artifactId>
<version>0.12.0</version>
</dependency>
<dependency>
<groupId>org.herasaf.xacml</groupId>
<artifactId>herasaf-xacml-core</artifactId>
<version>0.12.0</version>
</dependency>
<dependency>
<groupId>org.herasaf.xacml</groupId>
<artifactId>herasaf-xacml-pdp</artifactId>
<version>0.12.0</version>
</dependency>
I changed the path
src/test/resources/xacmlSchema/access_control-xacml-2.0-policy-schema-os.xml
by this
C:/Dvp/Projects/SANDBOX/Core/src/main/java/xacmlSchema/access_control-xacml-2.0-policy-schema-os.xsd
and the file exists.
These are the only changes I have done.
Regards,
SLF
Logged
Florian Huonder
Administrator
Full Member
Posts: 129
Re: Warn in log when loading ContextAndPolicyConfiguration.xml
«
Reply #3 on:
July 06, 2009, 10:08:11 am »
Hi Sylvain,
I just tested it and here it works.
I tried with the following path:
file:D:/Documents/Projects/HERASAF/workspace_xacml/herasaf-xacml-integrationtests/src/test/resources/XacmlSchema/access_control-xacml-2.0-policy-schema-os.xml
and I have no warning.
What I saw in you post is that your path points to:
C:/Dvp/Projects/SANDBOX/Core/src/main/java/xacmlSchema/access_control-xacml-2.0-policy-schema-os
.xsd
, that shouldn't be an XSD.
Maybe that's the reason for the warning?
By the way: The warning means that the file was not found.
Regards,
Florian
Logged
Sylvain LF
Newbie
Posts: 9
Re: Warn in log when loading ContextAndPolicyConfiguration.xml
«
Reply #4 on:
July 06, 2009, 11:14:00 am »
Hi Florian,
This is my "ContextAndPolicyConfiguration.xml" :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!-- Example configuration for the Locator. -->
<sb:beans
xmlns="http://schemas.herasaf.org/herasaf-xacml/0.12.0/contextAndPolicyConfiguration"
xmlns:sb="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://schemas.herasaf.org/herasaf-xacml/0.12.0/contextAndPolicyConfiguration http://schemas.herasaf.org/herasaf-xacml/0.12.0/contextAndPolicyConfiguration/contextAndPolicyConfiguration-0.12.0.xsd">
<contextAndPolicyConfiguration id="jaxbUtils">
<requestCtx>
<formatted_output>true</formatted_output>
<writeSchemaLocation>false</writeSchemaLocation>
<schemaLocation />
<validateWriting>false</validateWriting>
<validateParsing>false</validateParsing>
<schemaByPath>
classpath:/xacmlSchema/access_control-xacml-2.0-context-schema-os.xml
</schemaByPath>
<fragment>true</fragment>
<package>org.herasaf.xacml.core.context.impl</package>
</requestCtx>
<responseCtx>
<formatted_output>true</formatted_output>
<writeSchemaLocation>true</writeSchemaLocation>
<schemaLocation>
<location>urn:oasis:names:tc:xacml:2.0:context:schema:os access_control-xacml-2.0-context-schema-os.xsd</location>
</schemaLocation>
<validateWriting>false</validateWriting>
<validateParsing>false</validateParsing>
<schemaByPath>
url:http://docs.oasis-open.org/xacml/2.0/access_control-xacml-2.0-context-schema-os.xsd
</schemaByPath>
<fragment>true</fragment>
<package>org.herasaf.xacml.core.context.impl</package>
</responseCtx>
<policy>
<formatted_output>true</formatted_output>
<writeSchemaLocation>false</writeSchemaLocation>
<schemaLocation />
<validateWriting>false</validateWriting>
<validateParsing>false</validateParsing>
<!-- <schemaByPath>
file:D:/Documents/Projects/HERASAF/workspace_xacml_branch_Q_and_BugFixing/herasaf-xacml-integrationtests/src/test/resources/xacmlSchema/access_control-xacml-2.0-policy-schema-os.xml
</schemaByPath> -->
<schemaByPath>
file:src/main/resources/xacmlSchema/access_control-xacml-2.0-policy-schema-os.xml
</schemaByPath>
<fragment>true</fragment>
<package>org.herasaf.xacml.core.policy.impl</package>
</policy>
</contextAndPolicyConfiguration>
</sb:beans>
So i moved my config files from "src/main/java" to "src/main/ressources".
Now i get 3 warns, and when the line : "[main] DEBUG o.s.b.f.x.DefaultBeanDefinitionDocumentReader - Loading bean definitions" show in console, application wait during about 20 secondes.
This is my whole log with your PolicyStressTest001.xml :
http://rapidshare.com/files/252552867/Log_001.txt.html
MD5: E1E4E9CC1D0694EF84543F523B82FB22
Regards,
SLF
Logged
Florian Huonder
Administrator
Full Member
Posts: 129
Re: Warn in log when loading ContextAndPolicyConfiguration.xml
«
Reply #5 on:
July 06, 2009, 12:16:13 pm »
Hi Sylvain,
It's a little bit strange because I cannot reproduce the error.
Could you please try to change all 3 schemaByPath elements (request, response and policy) to classpath (like request), would that be possible?
Classpath is probably the easiest way.
If it is not possible, or does not work, would it be possible to provide me with your test-class where the error occurs?
Regards,
Florian
Logged
René Eggenschwiler
Administrator
Jr. Member
Posts: 63
Re: Warn in log when loading ContextAndPolicyConfiguration.xml
«
Reply #6 on:
July 06, 2009, 12:32:15 pm »
Hi Sylvain
You probably already know what I'm going to explain, but maybe I can give a little bit more transparancy to the resource handling.
It was correct from you to move your config files to
src/main/resources
.
Maven processes only
*.java
files in
src/main/java
. All other files type will not be processed/exported when they are in
src/main/java
.
So, config and other resources must be placed in
src/main/resources
. They will then also be exported to the classpath.
That means that content from
src/main/java
and
src/main/resources
will be exported to the root of the runtime classpath.
In addition do the classloaders and classloader hirarchies influence the resource loading. That's because
getResourceAsStream
is depending on the classloader.
So it can be that you expirience differences depending on the way you start your application. E.g. launching by a simple java main or by a JUnit test or by a maven build can resolve relative paths differently.
To get around those differences it is the best method to use the resource abstraction by spring. You can do that with the classpath keyword in resource addressing like:
classpath:/config/filename.xml
.
Spring will (in the example above) look for a file in a config folder inside the root of the classpath. In your project structure that could be
src/main/resources/config/filename.xml
I hope that helps a little bit.
Regards,
René
PS:
Please attach files (e.g. logfiles) directly to your posts. We have file attachment enabled in this forum.
«
Last Edit: July 06, 2009, 12:34:23 pm by René Eggenschwiler
»
Logged
Sylvain LF
Newbie
Posts: 9
Re: Warn in log when loading ContextAndPolicyConfiguration.xml
«
Reply #7 on:
July 06, 2009, 01:27:37 pm »
Hi René,
Thank you for your clarification.
I've changed 3 "schemaByPath" elements to "classpath" elements, despite this, i've again 2 warns.
If the pathfile of "classpath" elements doesn't exists, an error occurs :
Code:
org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Failed to import bean definitions from URL location [classpath:/config/ContextAndPolicyConfiguration.xml]
Offending resource: class path resource [config/ApplicationContext.ctx.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [config/ContextAndPolicyConfiguration.xml]; nested exception is java.lang.IllegalArgumentException: classpath:/xacmlSchemae/access_control-xacml-2.0-context-schema-os.xsd
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:76)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:182)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:147)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:80)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)
at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:422)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:83)
at XACMLPrototype.Core.Core.main(Core.java:18)
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [config/ContextAndPolicyConfiguration.xml]; nested exception is java.lang.IllegalArgumentException: classpath:/xacmlSchemae/access_control-xacml-2.0-context-schema-os.xsd
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:174)
... 19 more
Caused by: java.lang.IllegalArgumentException: classpath:/xacmlSchemae/access_control-xacml-2.0-context-schema-os.xsd
at org.herasaf.xacml.core.utils.ContextAndPolicyConfiguration.setSchemaByPath(ContextAndPolicyConfiguration.java:149)
at org.herasaf.xacml.pdp.utils.spring.beanDefinitionParser.ContextAndPolicyConfigurationBeanDefinitionParser.createContextAndPolicyConfiguration(ContextAndPolicyConfigurationBeanDefinitionParser.java:131)
at org.herasaf.xacml.pdp.utils.spring.beanDefinitionParser.ContextAndPolicyConfigurationBeanDefinitionParser.doParse(ContextAndPolicyConfigurationBeanDefinitionParser.java:88)
at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.doParse(AbstractSingleBeanDefinitionParser.java:139)
at org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser.parseInternal(AbstractSingleBeanDefinitionParser.java:84)
at org.springframework.beans.factory.xml.AbstractBeanDefinitionParser.parse(AbstractBeanDefinitionParser.java:56)
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.parse(NamespaceHandlerSupport.java:69)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1297)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:135)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
... 24 more
I've post my project with this post.
Thank you for your help and your patience.
Regards,
SLF.
Example.zip
(65.41 KB - downloaded 37 times.)
Logged
Florian Huonder
Administrator
Full Member
Posts: 129
Re: Warn in log when loading ContextAndPolicyConfiguration.xml
«
Reply #8 on:
July 06, 2009, 09:41:59 pm »
Hi,
It's a little bit strange. I'll try to have a look at your project tomorrow.
Regards,
Florian
Logged
Florian Huonder
Administrator
Full Member
Posts: 129
Re: Warn in log when loading ContextAndPolicyConfiguration.xml
«
Reply #9 on:
July 07, 2009, 09:31:59 am »
Good morning,
I got your code running.
There were two minor errors.
The Maven folder for the resources is called
src/main/resources
, you named it
src/main/ressources
by mistake. Don't forget to also adapt the path in the Core-Class where you load the policy from.
In the ContextAndPolicyConfiguration.xml in the response part you wrote
xacmlSchema
e
instead of
xacmlSchema
in the path.
I hope I could help you.
Regards,
Florian
PS. You should run HERAS
AF
with Java 1.5.
Logged
Sylvain LF
Newbie
Posts: 9
Re: Warn in log when loading ContextAndPolicyConfiguration.xml
«
Reply #10 on:
July 07, 2009, 11:02:40 am »
Good morning,
Thank you for yours corrections.
We finally found the source of warnings.
We have 2 <schemaByPath> like this in the
ContextAndPolicyConfiguration.xml
:
Code:
<schemaByPath>
classpath:/xacmlSchema/access_control-xacml-2.0-context-schema-os.xml
</schemaByPath>
However, in the header of the file
access_control-xacml-2.0-context-schema-os.xml
, there are :
Code:
<xs:import namespace="urn:oasis:names:tc:xacml:2.0:policy:schema:os" schemaLocation="http://docs.oasis-open.org/xacml/access_control-xacml-2.0-policy-schema-os.xsd"/>
If we changed
schemaLocation
by a local file (E.G. schemaLocation="C:/access_control-xacml-2.0-policy-schema-os.xsd"), warns disappear.
We believe that the problem comes from our proxy.
Thank you for your help and especially your patience.
Best regards,
SLF
Logged
Pages:
[
1
]
« previous
next »
Jump to:
Please select a destination:
-----------------------------
HERAS-AF XACML
-----------------------------
=> HERAS-AF XACML Core
=> HERAS-AF XACML PEP Core
=> HERAS-AF XACML PEP Spring Security
-----------------------------
HERAS-AF
-----------------------------
=> Open Discussion
=> HERAS-AF
=> XACML
-----------------------------
HERAS-AF Engineering
-----------------------------
=> Eclipse Magazin Publications
=> Maven Plugins
=> Tutorials
-----------------------------
HERAS-AF XACML (0.x, "old")
-----------------------------
=> HERAS-AF XACML
=> HERAS-AF PDP
=> HERAS-AF PAP
=> HERAS-AF PEPs
=> HERAS-AF PIP
Loading...