-
1. Re: Problem testing Hello BPEL sample
koen.aers Dec 16, 2006 10:03 AM (in response to meghanai_99)Hi Meghana,
I have not tried using BPEL for some time now, but I had this very issue before and it is because of an incompatibility in the xml parsing libraries of the jdk 1.5.0_05. I know that there is a workaround by moving around some of these xml parsing libraries, but I am not exactly sure what has to be done.
I know Alex is on holiday, but once he gets back he will certainly be able to give some more detail.
Regards,
Koen -
2. Re: Problem testing Hello BPEL sample
zauberlehrling Dec 17, 2006 9:32 AM (in response to meghanai_99)I have similar problems with the following environment:
1. jBoss BPEL 1.1 Beta2
2. jBoss AS 4.0.5GA
3. jwsdp-2.0
4. jdk 1.5.0_08
5. ANT 1.6.5
I've tried to call the hello-bpel-process with the following code:public void test() { try { Properties properties = new Properties(); properties.setProperty("java.naming.provider.url", "jnp://localhost:1099"); properties.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"); properties.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming.client"); properties.setProperty("j2ee.clientName", "jbpmbpel-client"); Service service = null; if (service == null) { InitialContext iniCtx = new InitialContext(properties); Object object = iniCtx.lookup("java:comp/env/service/Hello"); service = (Service)object; String portTypeNS = "http://jbpm.org/examples/hello"; Call call = service.createCall(new QName(portTypeNS, "GreeterPort"),"sayHello"); String greeting = (String) call.invoke(new Object[] { "Olive" }); System.out.println("Greeting: "+greeting); } } catch (Exception e) { e.printStackTrace(); }
and I get the following exception:javax.naming.NamingException: Cannot unmarshall service ref meta data, cause: java.io.InvalidClassException: javax.xml.namespace.QName; local class incompatible: stream classdesc serialVersionUID = 4418622981026545151, local class serialVersionUID = -9120448754896609940 at org.jboss.ws.jaxrpc.ServiceObjectFactory.getObjectInstance(ServiceObjectFactory.java:127) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125) at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705) at org.jboss.naming.client.java.javaURLContextFactory$EncContextProxy.invoke(javaURLContextFactory.java:135) at $Proxy0.lookup(Unknown Source) at javax.naming.InitialContext.lookup(InitialContext.java:351) at frank.DII.test(DII.java:51)
The exception is thrown by the command in line 51:Object object = iniCtx.lookup("java:comp/env/service/Hello");
If I try to contact the webservice with the following code:public void dii() { try { String endpoint = "http://localhost:8080/hello/greeter?wsdl&resource=hello.wsdl"; QName qName = new QName(endpoint); ServiceFactory serviceFactory = ServiceFactory.newInstance(); Service service = serviceFactory.createService(qName); Call call = service.createCall(); call.setOperationName(new QName(endpoint,"sayHello")); call.setTargetEndpointAddress(endpoint); call.setProperty(Call.ENCODINGSTYLE_URI_PROPERTY,"http://schemas.xmlsoap.org/soap/encoding/"); call.setProperty(Call.OPERATION_STYLE_PROPERTY, "rpc"); Object[] arguments = new Object[] {"wo"}; Object result = call.invoke(arguments); System.out.println(""+result); } catch (Exception e) { e.printStackTrace(); } }
I get the following exception in the server console:15:02:26,791 INFO [Server] JBoss (MX MicroKernel) [4.0.5.GA (build: CVSTag=Branch_4_0 date=200610162339)] Started in 1m:48s:151ms 15:02:59,288 WARN [HandlerWrapper] RuntimeException in handler method, transition to DOES_NOT_EXIST 15:02:59,288 ERROR [HandlerChainBaseImpl] RuntimeException in request handler java.lang.NullPointerException at org.jbpm.bpel.integration.server.SoapHandler.getRequestParts(SoapHandler.java:355) at org.jbpm.bpel.integration.server.SoapHandler.sendRequest(SoapHandler.java:299) at org.jbpm.bpel.integration.server.SoapHandler.handleRequest(SoapHandler.java:186) at org.jboss.ws.handler.HandlerWrapper.handleRequest(HandlerWrapper.java:121) ... at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112) at java.lang.Thread.run(Thread.java:595) 15:02:59,294 ERROR [SOAPFaultExceptionHelper] SOAP request exception java.lang.NullPointerException at org.jbpm.bpel.integration.server.SoapHandler.getRequestParts(SoapHandler.java:355) at org.jbpm.bpel.integration.server.SoapHandler.sendRequest(SoapHandler.java:299) .... 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) 15:02:59,305 WARN [HandlerWrapper] Handler is in state DOES_NOT_EXIST, skipping Handler.handleFault for: org.jbpm.bpel.integration.server.SoapHandler@1c60f74
At least this code contacted the bpel engine.
Best regards,
Frank -
3. Re: Problem testing Hello BPEL sample
zauberlehrling Dec 17, 2006 2:07 PM (in response to meghanai_99)I 've found the following entry in the jndi:
Global JNDI Namespace
+- jbpmbpel-client (class: org.jnp.interfaces.NamingContext)
| +- service (class: org.jnp.interfaces.NamingContext)
| | +- Hello (class: org.jboss.ws.jaxrpc.ServiceReferenceable)
And if I read the jndi with the following code:Properties properties = new Properties(); properties.setProperty("java.naming.provider.url", "jnp://localhost:1099"); properties.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"); properties.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming.client"); properties.setProperty("j2ee.clientName", "jbpmbpel-client"); InitialContext iniCtx = new InitialContext(properties); NamingEnumeration iter = (NamingEnumeration)iniCtx.list("jbpmbpel-client/service"); while (iter.hasMore()) { System.out.println(" "+iter.next()); }
then I get the following answer:Hello: org.jboss.ws.jaxrpc.ServiceReferenceable
This looks fine. But when I run the following commands:Properties properties = new Properties(); properties.setProperty("java.naming.provider.url", "jnp://localhost:1099"); properties.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"); properties.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming.client"); properties.setProperty("j2ee.clientName", "jbpmbpel-client"); InitialContext iniCtx = new InitialContext(properties); Object object = iniCtx.lookup("jbpmbpel-client/service/Hello");
then the answer is:19:56:02,788 ERROR ServiceObjectFactory : Cannot create service javax.naming.NamingException: Cannot unmarshall service ref meta data, cause: java.io.InvalidClassException: javax.xml.namespace.QName; local class incompatible: stream classdesc serialVersionUID = 4418622981026545151, local class serialVersionUID = -9120448754896609940 at org.jboss.ws.jaxrpc.ServiceObjectFactory.getObjectInstance(ServiceObjectFactory.java:127) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304) at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125) at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705) at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587) at javax.naming.InitialContext.lookup(InitialContext.java:351)
So as I understand there is a problem accessing the Hello-Object in the jndi. -
4. Re: Problem testing Hello BPEL sample
zauberlehrling Dec 26, 2006 3:37 PM (in response to meghanai_99)As mentioned above I get a NullPointer Exception on line 355 in the method getRequestParts in the class SoapHandler:
private static Map getRequestParts(SOAPElement operationWrapper, javax.wsdl.Message requestMessage) throws JMSException, SOAPException { HashMap inputParts = new HashMap(); Name nilName = SOAPFactory.newInstance().createName(BpelConstants.ATTR_NIL, null, BpelConstants.NS_XML_SCHEMA_INSTANCE); // iterate through input message parts Iterator partIt = requestMessage.getParts().values().iterator(); while (partIt.hasNext()) { Part requestPart = (Part) partIt.next(); // get part accessor from operation wrapper String partName = requestPart.getName(); SOAPElement partAccessor = XmlUtil.getElement(operationWrapper, partName); // BPEL-68 check for xsi:nil String nilValue = partAccessor.getAttributeValue(nilName); // line 355 if (nilValue == null || DatatypeUtil.parseBoolean(nilValue) != Boolean.TRUE) { SOAPElement partValue = getPartValue(partAccessor, requestPart); // create a dom element with the same name as the operation part Element inputPart = XmlUtil.createElement(partValue.getNamespaceURI(), partValue.getLocalName()); // add part to input message inputParts.put(partName, inputPart); // copy operation part to input part XmlUtil.copy(inputPart, partValue); } // else: do not copy the operation part } return inputParts; }
The exception is raised because the result of the statementXmlUtil.getElement(operationWrapper, partName);
is null. That means that the variable partAccessor is null:SOAPElement partAccessor = XmlUtil.getElement(operationWrapper, partName);
and the statement
String nilValue = partAccessor.getAttributeValue(nilName);
raises the NullPointerException. -
5. Re: Problem testing Hello BPEL sample
aguizar Dec 27, 2006 1:42 AM (in response to meghanai_99)jBPM BPEL 1.1.Beta2 predates JBoss AS 4.0.5.GA, hence it is untested with that version. However, the InvalidClassException is not caused by a problem with jBPM BPEL but by a mismatch between the server and client classes.
As mentioned in section 4.4 of the user guide, the lib/endorsed subdirectory of JBoss AS contains replacements for the default implementations of the XML APIs in the JDK. Overriding the default implementations should resolve the class mismatch.
The NullPointerException in the DII code is caused because a malformed SOAP envelope is being sent to the engine. I see several parameters that are not quite right - please compare your code with the DII code provided with the Hello example.
On the other hand, the server code should probably be more robust and inform that the SOAP envelope is malformed. Please create a JIRA issue for this. -
6. Re: Problem testing Hello BPEL sample
zauberlehrling Dec 27, 2006 5:35 AM (in response to meghanai_99)Hi Alex,
thank you very much for your advice! I've found in one implementation of QName the following explanation:* <p>Due to a historical defect, QName was released with multiple * serialVersionUID values even though its serialization was the * same.</p> * * <p>To workaround this issue, serialVersionUID is set with either * a default value or a compatibility value. To use the * compatiblity value, set the system property:</p> * * <code>com.sun.xml.namespace.QName.useCompatibleSerialVersionUID=1.0</code> * * <p>This workaround was inspired by classes in the javax.management * package, e.g. ObjectName, etc. * See CR6267224 for original defect report.</p> */ private static final long serialVersionUID; /** * <p>Default <code>serialVersionUID</code> value.</p> */ private static final long defaultSerialVersionUID = -9120448754896609940L; /** * <p>Compatibility <code>serialVersionUID</code> value.</p> */ private static final long compatibleSerialVersionUID = 4418622981026545151L; /** * <p>Flag to use default or campatible serialVersionUID.</p> */ private static boolean useDefaultSerialVersionUID = true;
In my test code I inserted the value 1.0 for the system property com.sun.xml.namespace.QName.useCompatibleSerialVersionUID:public void test() { try { Properties system = System.getProperties(); system.put("com.sun.xml.namespace.QName.useCompatibleSerialVersionUID", "1.0"); System.setProperties(system); Properties properties = new Properties(); properties.setProperty("java.naming.provider.url","jnp://localhost:1099"); properties.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory"); properties.setProperty("java.naming.factory.url.pkgs","org.jboss.naming.client"); properties.setProperty("j2ee.clientName", "jbpmbpel-client"); Service service = null; if (service == null) { InitialContext iniCtx = new InitialContext(properties); Object object = iniCtx.lookup("java:comp/env/service/Hello"); service = (Service)object; String portTypeNS = "http://jbpm.org/examples/hello"; Call call = service.createCall(new QName(portTypeNS, "GreeterPort"),"sayHello"); String greeting = (String) call.invoke(new Object[] { "Olive" }); System.out.println("Greeting: "+greeting); } } catch (Exception e) { e.printStackTrace(); } }
With this code code I got an answer:.... <env:Envelope xmlns:env='http://schemas.xmlsoap.org/soap/envelope/'> <env:Header/> <env:Body> <ns1:sayHelloResponse xmlns:ns1='http://jbpm.org/examples/hello'> <greeting>Hello, Olive!</greeting> </ns1:sayHelloResponse> </env:Body> </env:Envelope> 11:21:44,647 DEBUG SOAPBindingProvider : unbindResponseMessage: {http://jbpm.org/examples/hello}sayHello 11:21:44,653 DEBUG EndpointInvocation : setReturnValue: org.jboss.ws.soap.SOAPContentElement 11:21:44,653 DEBUG EndpointInvocation : getReturnValue 11:21:44,657 DEBUG SOAPContentElement : getObjectValue [xmlType={http://www.w3.org/2001/XMLSchema}string,javaType=class java.lang.String] 11:21:44,658 DEBUG SOAPContentElement : getXMLFragment from DOM 11:21:44,658 DEBUG SOAPContentElement : xmlFragment: <greeting>Hello, Olive!</greeting> 11:21:44,659 DEBUG SimpleDeserializer : deserialize: [xmlName=greeting,xmlType={http://www.w3.org/2001/XMLSchema}string] 11:21:44,662 DEBUG SOAPContentElement : objectValue: java.lang.String 11:21:44,662 DEBUG EndpointInvocation : transformPayloadValue: org.jboss.ws.soap.SOAPContentElement -> java.lang.String 11:21:44,663 DEBUG MessageContextAssociation : popMessageContext: org.jboss.ws.soap.SOAPMessageContextImpl@53ab04 Greeting: Hello, Olive!
-
7. Re: Problem testing Hello BPEL sample
zauberlehrling Dec 27, 2006 6:46 AM (in response to meghanai_99)With the following code I can access the hello-bpel-process:
public void dii() { try { URL wsdlURL = new URL("http://localhost:8080/hello/greeter?wsdl"); String targetNamespace = "http://jbpm.org/examples/hello"; QName portName = new QName(targetNamespace,"GreeterPort"); QName serviceName = new QName(targetNamespace, "HelloWorldService"); QName operationName = new QName(targetNamespace, "sayHello"); ServiceFactory serviceFactory = ServiceFactory.newInstance(); Service service = serviceFactory.createService(wsdlURL, serviceName); Call call = (Call)service.createCall(portName); call.setOperationName(operationName); Object[] arguments = new Object[] {"Olive"}; Object result = call.invoke(arguments); System.out.println(""+result); } catch (Exception e) { e.printStackTrace(); } }
Best regards -
8. Re: Problem testing Hello BPEL sample
aguizar Dec 27, 2006 9:52 PM (in response to meghanai_99)Yep, you can avoid using the endorsed standards override mechanism by setting that property. This had actually been discussed in an earlier forum topic and published in our knowledge base.
However, this silly incompatibility introduced in JDK 1.5.0_07 would never have been an issue had we chosen overriding the default XML implementations as the preferred method to avoid this and similar issues. This is why I no longer suggest alternate methods.
Cheers,
Alejandro