Reputation: 31
I am migrating a legacy java/websphere application to JRE1.8
JNDI lookup code (below) works fine in websphere8.5.5(JRE1.7) but throws Exception in websphere8.5.5(JRE1.8)
[Root exception is com.ibm.websphere.naming.CannotInstantiateObjectException: Exception occurred while the JNDI NamingManager was processing a javax.naming.Reference object. [Root exception is javax.xml.parsers.FactoryConfigurationError: Provider javax.xml.parsers.DocumentBuilderFactory could not be instantiated: java.util.ServiceConfigurationError: javax.xml.parsers.DocumentBuilderFactory: Provider org.apache.xerces.jaxp.DocumentBuilderFactoryImpl not a subtype]]
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
ds = (javax.sql.DataSource) ctx.lookup("java:comp/env/" + dsJNDIname);
I am sure, JNDI exists and valid. I tried looking up "java:comp/env/" with below code, still fails with Exception "Name not found in context "java:"."
javax.naming.InitialContext ctx = new javax.naming.InitialContext();
javax.naming.Context cxt = (javax.naming.Context) ctx.lookup("java:/comp/env/");
For the upgrade all I did was just rebuilding the source code in new workspace with JRE1.8. No code or config changes. Not sure, if I would require changes to web.xml or ejb-jar.xml etc
Any suggestions appreciated.
Upvotes: 2
Views: 1149
Reputation: 31
As suggested by F Rowe, the issue is because of some of the jars within source code which also came with websphere. I was able to overcome the issue by changing the application classpath.
Upvotes: 1
Reputation: 2064
See IBM support doc https://www.ibm.com/support/pages/apar/PI79037. You've likely got one or more jar files on the classpath that have versions of xerces that are conflicting with the IBM xml parser.
Upvotes: 0