Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object

10.1k views Asked by At

i am trying to connect db2 from my java code in web sphere application server. i am getting following exception.please suggest any one on this.

Caused by: com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is javax.xml.stream.FactoryConfigurationError: Provider javax.xml.stream.XMLInputFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.stream.XMLInputFactory: Provider com.sun.xml.internal.stream.XMLInputFactoryImpl not a subtype] at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:1232) at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookup(Helpers.java:925) at com.ibm.ws.naming.jndicos.CNContextImpl.processBoundObjectForLookup(CNContextImpl.java:2877) at com.ibm.ws.naming.jndicos.CNContextImpl.processResolveResults(CNContextImpl.java:3974) at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1876) at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1777) at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1434) at com.ibm.ws.naming.jndicos.CNContextImpl.lookup(CNContextImpl.java:616) at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:165) at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179) at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161) at javax.naming.InitialContext.lookup(InitialContext.java:428) at com.deere.u90.iaf.jdbc.connection.ConnectionManager.initializeEnvironment(ConnectionManager.java:276) ... 38 more Caused by: javax.xml.stream.FactoryConfigurationError: Provider javax.xml.stream.XMLInputFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.stream.XMLInputFactory: Provider com.sun.xml.internal.stream.XMLInputFactoryImpl not a subtype at javax.xml.stream.XMLInputFactory.newFactory(Unknown Source) at javax.xml.stream.XMLInputFactory.newInstance(Unknown Source) at com.ibm.websphere.product.metadata.im.IMMetadata.setHistoryEventsFromHistoryXml(IMMetadata.java:745) at com.ibm.websphere.product.metadata.im.IMMetadata.parseHistoryXmlFile(IMMetadata.java:587) at com.ibm.websphere.product.metadata.im.IMMetadata.parseInstallRegistryFiles(IMMetadata.java:399) at com.ibm.websphere.product.metadata.im.IMMetadata.(IMMetadata.java:269) at com.ibm.websphere.product.metadata.im.IMMetadata.getIMMetadataInstance(IMMetadata.java:133) at com.ibm.websphere.product.metadata.WASMetadata.parseMetadataFiles(WASMetadata.java:939) at com.ibm.websphere.product.metadata.WASMetadata.(WASMetadata.java:784) at com.ibm.websphere.product.metadata.WASMetadata.getWASMetadataInstance(WASMetadata.java:215) at com.ibm.websphere.product.WASDirectory.initMetadataInstance(WASDirectory.java:1415) at com.ibm.websphere.product.WASDirectory.getIMLogLocation(WASDirectory.java:435) at com.ibm.websphere.product.VersionInfo.printSource(VersionInfo.java:1534) at com.ibm.websphere.product.VersionInfo.printReport(VersionInfo.java:1322) at com.ibm.websphere.product.VersionInfo.runReport(VersionInfo.java:1064) at com.ibm.websphere.product.VersionInfo.runReport(VersionInfo.java:1025) at com.ibm.ws.rsadapter.spi.ServerFunction$7.run(ServerFunction.java:596) at com.ibm.ws.rsadapter.spi.ServerFunction$7.run(ServerFunction.java:590) at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:118) at com.ibm.ws.rsadapter.spi.ServerFunction.getServerVersion(ServerFunction.java:588) at com.ibm.ws.rsadapter.spi.WSManagedConnectionFactoryImpl.(WSManagedConnectionFactoryImpl.java:748) at java.lang.J9VMInternals.newInstanceImpl(Native Method) at java.lang.Class.newInstance(Class.java:1899) at com.ibm.ejs.j2c.J2CUtilityClass.createMCFEntry(J2CUtilityClass.java:468) at com.ibm.ejs.j2c.ConnectionFactoryBuilderServerImpl.createMCFandPM(ConnectionFactoryBuilderServerImpl.java:592) at com.ibm.ejs.j2c.ConnectionFactoryBuilderServerImpl.processObjectInstance(ConnectionFactoryBuilderServerImpl.java:1185) at com.ibm.ejs.j2c.ServerFunction.processObjectInstance(ServerFunction.java:2009) at com.ibm.ejs.j2c.ConnectionFactoryBuilderImpl.getObjectInstance(ConnectionFactoryBuilderImpl.java:662) at org.apache.aries.jndi.ObjectFactoryHelper.getObjectInstanceUsingObjectFactoryBuilders(ObjectFactoryHelper.java:349) at org.apache.aries.jndi.ObjectFactoryHelper.getObjectInstance(ObjectFactoryHelper.java:89) at org.apache.aries.jndi.OSGiObjectFactoryBuilder.getObjectInstance(OSGiObjectFactoryBuilder.java:62) at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:311) at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:1122) ... 50 more

1

There are 1 answers

0
DAVE Das On

I was facing the same issue and here was my resolution I had wrongly spelled my jta data source in IBM Admin Console and was using a different name in my persistence xml so Websphere couldn't connect. Please check the Resources Tab in the Admin Console and validate your jta data source name as declared in persistence xml