You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fx-dev@ws.apache.org by Paul Jamason <pj...@gpsmail.ucsd.edu> on 2005/11/05 04:57:14 UTC
NPE with WSSecurityEngineResult
Hi,
I'm attempting to read the username from the soap header ws-security
block in my web service, using the following code
(modified from the snippet shown at
http://ws.apache.org/wss4j/apidocs/org/apache/ws/axis/security/package-summary.html):
String user = null;
try {
MessageContext context =
MessageContext.getCurrentContext();
Vector recvResults = (Vector)
context.getProperty(WSHandlerConstants.RECV_RESULTS);
WSHandlerResult result = (WSHandlerResult)
recvResults.get(0);
Vector results = result.getResults();
WSSecurityEngineResult wsseResult =
(WSSecurityEngineResult) results.get(0);
String DN = wsseResult.getPrincipal().getName();
user = DN.substring(13, DN.indexOf(','));
} catch (Exception e) {
e.printStackTrace(System.err);
}
However, I get an NPE here:
String DN = wsseResult.getPrincipal().getName();
Here's the stack trace:
java.lang.NullPointerException
at
edu.ucsd.sopac.reason.asa.ws.ASA_Receive.authRequest(ASA_Receive.java:65)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:85)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:58)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java(Compiled
Code))
at java.lang.reflect.Method.invoke(Method.java(Compiled
Code))
at
org.apache.axis.providers.java.RPCProvider.invokeMethod(RPCProvider.java:388)
at
org.apache.axis.providers.java.RPCProvider.processMessage(RPCProvider.java:283)
at
org.apache.axis.providers.java.JavaProvider.invoke(JavaProvider.java:323)
at
org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)
at
org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)
at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)
at
org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:453)
at
org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)
at
org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
at
org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)
at
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:568)
I am able to get debug output for WSSecurityEngine (handler output):
- enter processSecurityHeader()
- Processing WS-Security header for '' actor.
- Found UsernameToken list element
- UsernameToken user test
- UsernameToken password CcgmjRKPSS/vVrETPlpGWgwsSQg=
- UsernameToken callback password <removed>
- Found Timestamp list element
- Preparing to verify the timestamp
- Current time: 2005-11-05T03:06:47Z
- Timestamp created: 2005-11-05T03:06:47Z
- Timestamp expires: 2005-11-05T03:11:47Z
- Validation of Timestamp: Everything is ok
but not for WSS4JHandler, for the code snippet above. Both are set
to DEBUG in log4j.properties.
If I use the code snippet at the url above, the NPE occurs at:
WSSecurityEngineResult eResult = (WSSecurityEngineResult) hResults.get(j);
Finally, I am seeing the "java.lang.NoSuchFieldException:
m_functions" error in the log, which still persists despite
creating the $JAVA_HOME/jre/lib/endorsed directory and placing
xalan-2.6.0.jar there.
Thanks in advance for any help.
Paul
---------------------------------------------------------------------
To unsubscribe, e-mail: wss4j-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: wss4j-dev-help@ws.apache.org