Skip to main content

factorycom.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl cannot be cast to javax.xml.soap.SAAJMetaFactory

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
1 reply [Last post]
HeikoHueter
Offline
Joined: 2014-03-14

I'm trying to deploy a simple jax-ws Client as a Bundle to glassfish 4 (i tested 4.0 release and 4.0.1-b04). As osgi runtime i am using Equinox 3.9.1. The Client code Looks like:

final URL wsdlURL = Activator.class
.getResource("/wsdl/Scheduler.wsdl");
if (wsdlURL == null) {
System.err.println("WSDL nicht gefunden - /wsdl/Scheduler.wsdl");
}

final QName qName = new QName("http://xml.novasib.de/tt-sib5",
"Scheduler");
Service service = Service.create(wsdlURL, qName);

Running this code with plain equinox works without Problems. Putting this bundle to domain1\autodeploy\bundles (glassfish running with equinox too) gives the following error:

Caused by: java.lang.Error: javax.xml.soap.SOAPException: Unable to create SAAJ meta-factorycom.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryIm
pl cannot be cast to javax.xml.soap.SAAJMetaFactory
at com.sun.xml.ws.api.SOAPVersion.(SOAPVersion.java:193)
at com.sun.xml.ws.api.SOAPVersion.(SOAPVersion.java:91)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parseBinding(RuntimeWSDLParser.java:593)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parseWSDL(RuntimeWSDLParser.java:475)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:249)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:209)
at com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.parse(RuntimeWSDLParser.java:178)
at com.sun.xml.ws.client.WSServiceDelegate.parseWSDL(WSServiceDelegate.java:363)
at com.sun.xml.ws.client.WSServiceDelegate.(WSServiceDelegate.java:321)
at com.sun.xml.ws.client.WSServiceDelegate.(WSServiceDelegate.java:230)
at com.sun.xml.ws.client.WSServiceDelegate.(WSServiceDelegate.java:211)
at com.sun.xml.ws.client.WSServiceDelegate.(WSServiceDelegate.java:207)
at com.sun.xml.ws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:114)
at javax.xml.ws.Service.(Service.java:92)
at de.novasib.xml.tt_sib5.Scheduler_Service.(Scheduler_Service.java:42)
at hello.osgi.Activator.start(Activator.java:34)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl$1.run(BundleContextImpl.java:711)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.framework.internal.core.BundleContextImpl.startActivator(BundleContextImpl.java:702)
... 76 more
Caused by: javax.xml.soap.SOAPException: Unable to create SAAJ meta-factorycom.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl cannot be cast
to javax.xml.soap.SAAJMetaFactory
at javax.xml.soap.SAAJMetaFactory.getInstance(SAAJMetaFactory.java:94)
at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:142)
at com.sun.xml.ws.api.SOAPVersion.(SOAPVersion.java:190)
... 94 more
java.lang.Error: javax.xml.soap.SOAPException: Unable to create SAAJ meta-factorycom.sun.xml.internal.messaging.saaj.soap.SAAJMetaFactoryImpl cannot be cast to javax.xml.soap.SAAJMetaFactory

Doing a inspect p c | grep Java.xml.soap gives two bundles which Export this package. The System bundle (org.eclipse.osgi_3.9.1.v20140110-1610) and org.glassfish.metro.webservices-api-osgi_2.3.1.b259.

Running with felix seems to work, although the package is exported twice too (org.apache.felix.framework, org.glassfish.metro.webservices-api-osgi_2.3.1.b259).

The same code works with glassfish 3.x and equinox. The Problem raised when trying to port an existing application to the new glassfish Version.

I will attach the sample project.

AttachmentSize
hello.osgi_.source_1.0.0.201403140944.jar1.32 KB
hello.osgi_1.0.0.201403140944.jar6.36 KB

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Bitula
Offline
Joined: 2014-04-23

Same issue and same exception! Did you find any solution? I start to think this is a glassfish 4 or java bug. Deployed OSGI bundle with web service client into Glassfish 4 felix container on a clear domain (No ws related custom jars in domain lib or the bundle). As soon as the service create is called I get this exception. All this with Java(TM) SE Runtime Environment (build 1.7.0_51-b13).