I am trying to load my rampart policy.xml file. Here is the code I use
to load the file:
private Policy loadPolicy(String name) {
try {
InputStream resource =
SymmetryProxy.class.getResourceAsStream(name);
StAXOMBuilder builder = new StAXOMBuilder(resource);
return PolicyEngine.getPolicy(builder.getDocumentElement());
} catch (IllegalArgumentException e) {
log.warn("Error loading policy: " + e); e.printStackTrace();
return null;
} catch (Exception e) {
log.warn("Error loading policy: " + e);
return null;
}
}
And here is my policy.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<wsp:Policy wsu:Id="UTOverTransport"
xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy">
<wsp:ExactlyOne>
<wsp:All>
<sp:TransportBinding
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:TransportToken>
<wsp:Policy>
<sp:HttpsToken RequireClientCertificate="false"/>
</wsp:Policy>
</sp:TransportToken>
<sp:AlgorithmSuite>
<wsp:Policy>
<sp:Basic128/>
</wsp:Policy>
</sp:AlgorithmSuite>
<sp:Layout>
<wsp:Policy>
<sp:Lax/>
</wsp:Policy>
</sp:Layout>
<sp:IncludeTimestamp/>
</wsp:Policy>
</sp:TransportBinding>
<sp:SignedSupportingTokens
xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
<wsp:Policy>
<sp:UsernameToken
sp:IncludeToken="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy/IncludeToken/AlwaysToRecipient"
/>
</wsp:Policy>
</sp:SignedSupportingTokens>
</wsp:All>
</wsp:ExactlyOne>
</wsp:Policy>
Here is the error I'm getting:
Caused by: java.lang.ExceptionInInitializerError
at org.apache.neethi.PolicyEngine.<clinit>(PolicyEngine.java:52)
at com.orci.SymmetryWS.SymmetryProxy.loadPolicy(SymmetryProxy.java:157)
at
com.orci.SymmetryWS.SymmetryProxy.configureServiceClient(SymmetryProxy.java:141)
at com.orci.SymmetryWS.SymmetryProxy.getProxy(SymmetryProxy.java:92)
at com.orci.SymmetryWS.SymmetryProxy.login(SymmetryProxy.java:174)
at
com.orci.vicads.VicadsManager.server.dao.special.SymmetryServerDao.getDevices(SymmetryServerDao.java:40)
at
com.orci.vicads.VicadsManager.server.handlers.ImportSymmetryDevicesHandler.execute(ImportSymmetryDevicesHandler.java:35)
at
com.orci.vicads.VicadsManager.server.handlers.ImportSymmetryDevicesHandler.execute(ImportSymmetryDevicesHandler.java:17)
at
net.customware.gwt.dispatch.server.AbstractDispatch.doExecute(AbstractDispatch.java:81)
at
net.customware.gwt.dispatch.server.AbstractDispatch.execute(AbstractDispatch.java:68)
at
net.customware.gwt.dispatch.server.standard.AbstractStandardDispatchServlet.execute(AbstractStandardDispatchServlet.java:22)
at
com.orci.vicads.VicadsManager.server.auth.SecureDispatchServlet.execute(SecureDispatchServlet.java:68)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at
com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse(RPC.java:561)
... 32 more
Caused by: java.lang.ClassCastException:
org.apache.ws.secpolicy11.builders.AlgorithmSuiteBuilder cannot be cast
to org.apache.neethi.builders.AssertionBuilder
at
org.apache.neethi.AssertionBuilderFactory.<clinit>(AssertionBuilderFactory.java:59)
... 49 more
Any idea what I am doing wrong? Thanks, David
--
David R Robison
Open Roads Consulting, Inc.
103 Watson Road, Chesapeake, VA 23320
phone: (757) 546-3401
e-mail: [email protected]
web: http://openroadsconsulting.com
blog: http://therobe.blogspot.com
book: http://www.xulonpress.com/bookstore/bookdetail.php?PB_ISBN=9781597816526
This email communication (including any attachments) may contain confidential
and/or privileged material intended solely for the individual or entity to
which it is addressed.
If you are not the intended recipient, please delete this email immediately.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]