[JBossWS] - Server-side NullpointerException when using ws-security
by openyourmind
Hello,
I have some problems using ws-security.
My WS runs correctly without wssecurity, but when I activate it I get an strange server-side NullPointerException.
My config is :
- jboss 4.0.5.GA EJB3 config
- jbossws-1.2.0.GA
- jdk 1.5_08
This is what we get in the server log from the server start up until the exception.
|
| 2007-03-19 22:21:38,895 INFO [org.jboss.system.server.Server] JBoss (MX MicroKernel) [4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)] Started in 48s:327ms
| 2007-03-19 22:29:00,239 DEBUG [org.jboss.resource.connectionmanager.IdleRemover] run: IdleRemover notifying pools, interval: 450000
| 2007-03-19 22:29:01,749 DEBUG [org.jboss.ws.core.server.ServiceEndpoint] WSDL request, using host: chaponniere-linux
| 2007-03-19 22:29:01,791 DEBUG [org.jboss.ws.core.server.ServiceEndpoint] WSDL request, using host: chaponniere-linux
| 2007-03-19 22:29:05,181 DEBUG [org.jboss.ws.core.server.AbstractServiceEndpointServlet] doPost: /procedures-beans/PstProcedureManager
| 2007-03-19 22:29:05,189 DEBUG [org.jboss.ws.core.soap.MessageContextAssociation] pushMessageContext: org.jboss.ws.core.jaxws.handler.SOAPMessageContextJAXWS@1757322 (Thread http-0.0.0.0-8080-1)
| 2007-03-19 22:29:05,190 DEBUG [org.jboss.ws.core.server.ServiceEndpoint] BEGIN handleRequest: jboss.ws:context=procedures-beans,endpoint=PstProcedureManager
| 2007-03-19 22:29:05,220 DEBUG [org.jboss.ws.core.soap.MessageFactoryImpl] createMessage: [contentType=text/xml; charset=UTF-8]
| 2007-03-19 22:29:05,245 DEBUG [javax.xml.soap.FactoryLoader] Load from Service API META-INF/services/javax.xml.soap.SOAPFactory: org.jboss.ws.core.soap.SOAPFactoryImpl
| 2007-03-19 22:29:05,245 DEBUG [org.jboss.mx.loading.RepositoryClassLoader] setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3@12c4d8f, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader@c6948c{ url=null ,addedOrder=0}
| 2007-03-19 22:29:05,265 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS] callRequestHandlerChain: PRE
| 2007-03-19 22:29:05,266 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerResolverImpl] initHandlerChain: PRE
| 2007-03-19 22:29:05,266 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerResolverImpl] Clear handler map: {}
| 2007-03-19 22:29:05,268 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerResolverImpl] addHandler: [service=null,port=null,binding=http://schemas.xmlsoap.org/wsdl/soap/http]... Handler
| 2007-03-19 22:29:05,268 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerResolverImpl] initHandlerChain: ENDPOINT
| 2007-03-19 22:29:05,268 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerResolverImpl] Clear handler map: {}
| 2007-03-19 22:29:05,268 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerResolverImpl] initHandlerChain: POST
| 2007-03-19 22:29:05,268 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerResolverImpl] Clear handler map: {}
| 2007-03-19 22:29:05,268 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerResolverImpl] getHandlerChain: [type=PRE,info=[service={http://procedure.procedures/}PstProcedureManagerS...]
| 2007-03-19 22:29:05,268 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerResolverImpl] add protocol handlers: [WSSecurity Handler]
| 2007-03-19 22:29:05,274 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerChainExecutor] Create a handler executor: [WSSecurity Handler]
| 2007-03-19 22:29:05,274 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerChainExecutor] Enter: handleRequest
| 2007-03-19 22:29:05,279 DEBUG [org.jboss.ws.core.soap.SOAPMessageDispatcher] getDispatchDestination: null
| 2007-03-19 22:29:05,279 ERROR [org.jboss.ws.core.jaxws.handler.HandlerChainExecutor] Exception during handler processing
| java.lang.NullPointerException
| at org.jboss.ws.extensions.security.WSSecurityDispatcher.handleInbound(WSSecurityDispatcher.java:130)
| at org.jboss.ws.extensions.security.jaxws.WSSecurityHandler.handleInboundSecurity(WSSecurityHandler.java:59)
| at org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerServer.handleInbound(WSSecurityHandlerServer.java:41)
| at org.jboss.ws.core.jaxws.handler.GenericHandler.handleMessage(GenericHandler.java:55)
| at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleMessage(HandlerChainExecutor.java:276)
| at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleRequest(HandlerChainExecutor.java:112)
| at org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS.callRequestHandlerChain(HandlerDelegateJAXWS.java:65)
| at org.jboss.ws.core.server.AbstractServiceEndpointInvoker.callRequestHandlerChain(AbstractServiceEndpointInvoker.java:106)
| at org.jboss.ws.core.server.AbstractServiceEndpointInvoker.invoke(AbstractServiceEndpointInvoker.java:140)
| at org.jboss.ws.core.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:204)
| at org.jboss.ws.core.server.ServiceEndpointManager.processSOAPRequest(ServiceEndpointManager.java:440)
| at org.jboss.ws.core.server.AbstractServiceEndpointServlet.doPost(AbstractServiceEndpointServlet.java:114)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
| at org.jboss.ws.core.server.AbstractServiceEndpointServlet.service(AbstractServiceEndpointServlet.java:75)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| 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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| 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:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
| 2007-03-19 22:29:05,280 DEBUG [org.jboss.ws.core.jaxws.handler.HandlerChainExecutor] Exit: handleRequest with status: false
| 2007-03-19 22:29:05,282 ERROR [org.jboss.ws.core.jaxws.SOAPFaultHelperJAXWS] SOAP request exception
| javax.xml.ws.WebServiceException: java.lang.NullPointerException
| at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.processHandlerFailure(HandlerChainExecutor.java:262)
| at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleRequest(HandlerChainExecutor.java:124)
| at org.jboss.ws.core.jaxws.handler.HandlerDelegateJAXWS.callRequestHandlerChain(HandlerDelegateJAXWS.java:65)
| at org.jboss.ws.core.server.AbstractServiceEndpointInvoker.callRequestHandlerChain(AbstractServiceEndpointInvoker.java:106)
| at org.jboss.ws.core.server.AbstractServiceEndpointInvoker.invoke(AbstractServiceEndpointInvoker.java:140)
| at org.jboss.ws.core.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:204)
| at org.jboss.ws.core.server.ServiceEndpointManager.processSOAPRequest(ServiceEndpointManager.java:440)
| at org.jboss.ws.core.server.AbstractServiceEndpointServlet.doPost(AbstractServiceEndpointServlet.java:114)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
| at org.jboss.ws.core.server.AbstractServiceEndpointServlet.service(AbstractServiceEndpointServlet.java:75)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| 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.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| 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:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: java.lang.NullPointerException
| at org.jboss.ws.extensions.security.WSSecurityDispatcher.handleInbound(WSSecurityDispatcher.java:130)
| at org.jboss.ws.extensions.security.jaxws.WSSecurityHandler.handleInboundSecurity(WSSecurityHandler.java:59)
| at org.jboss.ws.extensions.security.jaxws.WSSecurityHandlerServer.handleInbound(WSSecurityHandlerServer.java:41)
| at org.jboss.ws.core.jaxws.handler.GenericHandler.handleMessage(GenericHandler.java:55)
| at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleMessage(HandlerChainExecutor.java:276)
| at org.jboss.ws.core.jaxws.handler.HandlerChainExecutor.handleRequest(HandlerChainExecutor.java:112)
| ... 28 more
|
|
My client-side code
|
| wsdlURL = new URL("http://chaponniere-linux:8080/procedures-beans/PstProcedureManager?wsdl");
| URL securityURL = new File("jboss-wsse-client.xml").toURL();
| QName serviceName = new QName("http://procedure.procedures/", "PstProcedureManagerService");
|
| Service service = Service.create(wsdlURL, serviceName);
| ((ServiceExt)service).setSecurityConfig(securityURL.toExternalForm());
|
| PstProcedureManager port = (PstProcedureManager)service.getPort(PstProcedureManager.class);
| //Hello port = (Hello)service.getPort(Hello.class);
| ((StubExt)port).setConfigName("Standard WSSecurity Client");
|
|
| Map<String, Object> reqContext = ((BindingProvider)port).getRequestContext();
| //reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://localhost:8080/jaxws-samples-wssecurity-encrypt");
| reqContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, "http://chaponniere-linux:8080/procedures-beans/PstProcedureManager?wsdl");
|
| String procedureNumber = port.getProcedure(1).getNumber();
| System.out.println(procedureNumber);
|
|
And finally my WS.
|
| @WebService
| @EndpointConfig(configName = "Standard WSSecurity Endpoint")
| public class PstProcedureManager implements PstProcedureInterface {
|
| @PersistenceContext
| protected EntityManager em;
|
| @WebMethod
| public PstProcedureBean getProcedure(int pId) {
| Collection procedureCol =
| em.createQuery("from PstProcedureBean procedureBean where procedureBean.id = :id")
| .setParameter ("id", pId)
| .getResultList();
|
|
| return (PstProcedureBean)procedureCol.iterator().next();
| }
| }
|
|
I cannot see where the problem might come from and I would greatly appreciate your help with this issue.
Thanks in advance
M.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029524#4029524
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029524
17 years, 9 months
[JBossWS] - beginner needs help
by vitor_b
Hello
Jboss: 4.0.5 GA
You can skip following info and look directly on description and code.
I'm rather new to WS. I decided to create my WebService using Stateless Session Bean, but i was getting errors. Thats why i decided to deply an example, and then modify it. Example is attached to book: JBoss 4.0 the Official Guide.
The example service is quite simple. The operation accepts one argument: String, and returns String. I decided to change operation in order to make it accept Object. But I have failed, look at that:
description and code
Exception stack trace:
anonymous wrote : 12:46:56,093 ERROR [MainDeployer] Could not create deployment: file:/C:/Tutorial/jboss-4.0.5.GA/serer/default/deploy/hello-ejb.jar
| org.jboss.ws.WSException: Cannot obtain method parameter mapping for message part 'inputttttt' in wdl operation: hello at org.jboss.ws.deployment.JSR109MetaDataBuilder.buildParameterMetaDataRpc(JSR109MetaDataBulder.java:229)
| at org.jboss.ws.deployment.JSR109MetaDataBuilder.setupOperationsFromWSDL(JSR109MetaDataBuil
| er.java:196)
| at ...
My session bean operation:
public String hello(Input input)
| {
| return "Witaj " + input.getName() + "!";
| }
Input object looks like that:
package org.jboss.chap12.hello;
|
| public class Input {
|
| String name;
|
| public String getName() {
| return name;
| }
|
| public void setName(String name) {
| this.name = name;
| }
|
| }
Wsdl file:
<?xml version="1.0" encoding="UTF-8"?>
| <definitions name="HelloService"
| targetNamespace="http://hello.chap12.jboss.org/"
| xmlns:tns="http://hello.chap12.jboss.org/"
| xmlns="http://schemas.xmlsoap.org/wsdl/"
| xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
| <types>
| <xsd:schema targetNamespace="http://hello.chap12.jboss.org/">
|
| <xsd:element name="input" type="tns:Input"/>
|
| <xsd:complexType name="Input">
| <xsd:sequence>
| <xsd:element name="name" type="xsd:string"/>
| </xsd:sequence>
| </xsd:complexType> </xsd:schema>
| </types>
| <message name="Hello_hello">
| <part name="inputttttt" type="tns:Input"/>
| </message> <message name="Hello_helloResponse">
| <part name="result" type="xsd:string"/>
| </message>
| <portType name="Hello">
| <operation name="hello" parameterOrder="inputttttt" >
| <input message="tns:Hello_hello"/>
| <output message="tns:Hello_helloResponse"/>
| </operation>
| </portType> <binding name="HelloBinding" type="tns:Hello">
| <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="rpc"/>
| <operation name="hello">
| <soap:operation soapAction=""/>
| <input>
| <soap:body use="literal" namespace="http://hello.chap12.jboss.org/"/>
| </input>
| <output>
| <soap:body use="literal" namespace="http://hello.chap12.jboss.org/"/>
| </output>
| </operation>
| </binding>
| <service name="HelloService">
| <port name="HelloPort" binding="tns:HelloBinding" >
| <soap:address location="REPLACE_WITH_ACTUAL_URL"/>
| </port>
| </service>
| </definitions>
|
Mapping file:
<?xml version="1.0" encoding="UTF-8"?>
| <java-wsdl-mapping version="1.1" xmlns="http://java.sun.com/xml/ns/j2ee"
| xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://www.ibm.com/webservices/xsd/j2ee_jaxrpc_mapping_1_1.xsd">
|
|
| <java-xml-type-mapping>
| <java-type>org.jboss.chap12.hello.Input</java-type>
| <root-type-qname xmlns:typeNS='http://hello.chap12.jboss.org/'>typeNS:Input</root-type-qname>
| <qname-scope>complexType</qname-scope>
| <variable-mapping>
| <java-variable-name>name</java-variable-name>
| <xml-element-name>name</xml-element-name>
| </variable-mapping>
| </java-xml-type-mapping>
| <package-mapping>
| <package-type>org.jboss.chap12.hello</package-type>
| <namespaceURI>http://hello.chap12.jboss.org/types</namespaceURI>
| </package-mapping>
| <package-mapping>
| <package-type>org.jboss.chap12.hello</package-type>
| <namespaceURI>http://hello.chap12.jboss.org/</namespaceURI>
| </package-mapping>
| <service-interface-mapping>
| <service-interface>org.jboss.chap12.hello.HelloService</service-interface>
| <wsdl-service-name xmlns:serviceNS="http://hello.chap12.jboss.org/">serviceNS:HelloService</wsdl-service-name>
| <port-mapping>
| <port-name>HelloPort</port-name>
| <java-port-name>HelloPort</java-port-name>
| </port-mapping>
| </service-interface-mapping>
| <service-endpoint-interface-mapping>
| <service-endpoint-interface>org.jboss.chap12.hello.Hello</service-endpoint-interface>
| <wsdl-port-type xmlns:portTypeNS="http://hello.chap12.jboss.org/">portTypeNS:Hello</wsdl-port-type>
| <wsdl-binding xmlns:bindingNS="http://hello.chap12.jboss.org/">bindingNS:HelloBinding</wsdl-binding>
| <service-endpoint-method-mapping>
| <java-method-name>hello</java-method-name>
| <wsdl-operation>hello</wsdl-operation>
| <method-param-parts-mapping>
| <param-position>0</param-position>
| <param-type>org.jboss.chap12.hello.Input</param-type>
| <wsdl-message-mapping>
| <wsdl-message xmlns:wsdlMsgNS="http://hello.chap12.jboss.org/">wsdlMsgNS:Hello_hello</wsdl-message>
| <wsdl-message-part-name>inputttttt</wsdl-message-part-name>
| <parameter-mode>IN</parameter-mode>
| </wsdl-message-mapping>
| </method-param-parts-mapping>
| <wsdl-return-value-mapping>
| <method-return-value>java.lang.String</method-return-value>
| <wsdl-message xmlns:wsdlMsgNS="http://hello.chap12.jboss.org/">wsdlMsgNS:Hello_helloResponse</wsdl-message>
| <wsdl-message-part-name>result</wsdl-message-part-name>
| </wsdl-return-value-mapping>
| </service-endpoint-method-mapping>
| </service-endpoint-interface-mapping>
| </java-wsdl-mapping>
|
For me looks like everything is fine, but it is not. The question is: why?
Could you help me?
Thank you in advance.
vitor_b
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029280#4029280
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029280
17 years, 9 months
[JBossWS] - StackOverflowError with WS-Security
by fujikura
hi all,
i'm having a problem when i use ws-security with jbossws.
when a service implementation returns messages(my own class object or string object) including null value, a StackOverflowError occurs in a client side.
Exception: java.lang.StackOverflowError
java.lang.StackOverflowError
at java.security.AccessController.doPrivileged(Native Method)
at java.io.PrintWriter.(PrintWriter.java:77)
at java.io.PrintWriter.(PrintWriter.java:61)
at org.jboss.ws.utils.DOMWriter.(DOMWriter.java:104)
at org.jboss.ws.utils.DOMWriter.printNode(DOMWriter.java:141)
at org.jboss.ws.soap.NodeImpl.assertSOAPParent(NodeImpl.java:592)
at org.jboss.ws.soap.NodeImpl.getParentNode(NodeImpl.java:296)
at org.jboss.ws.utils.DOMWriter.getNamespaceURI(DOMWriter.java:435)
at org.jboss.ws.utils.DOMWriter.getNamespaceURI(DOMWriter.java:438)
at org.jboss.ws.utils.DOMWriter.getNamespaceURI(DOMWriter.java:438)
at org.jboss.ws.utils.DOMWriter.printInternal(DOMWriter.java:269)
at org.jboss.ws.utils.DOMWriter.printInternal(DOMWriter.java:307)
at org.jboss.ws.utils.DOMWriter.printInternal(DOMWriter.java:307)
at org.jboss.ws.utils.DOMWriter.print(DOMWriter.java:193)
at org.jboss.ws.utils.DOMWriter.printNode(DOMWriter.java:141)
at org.jboss.ws.soap.NodeImpl.assertSOAPParent(NodeImpl.java:592)
at org.jboss.ws.soap.NodeImpl.getParentNode(NodeImpl.java:296)
environments:
jboss 4.0.5
jbossws 1.0.3 sp1
service provider(server implementation) and service consumer(client) are running on different machines.
i tried some different type of object as a return value(return soap message). i found this error occurs if the return string value is null or return object have at least one null value as an attribute.
in other words, no null values are included in the return value, service invocations are done successfully and i confirmed that the soap messages are correctly encripted.
does anyone know the reason or workaround?
best regards,
shigemoto.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4029230#4029230
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4029230
17 years, 9 months