I am using IBM WebSphere Liberty 25.0.0.10. I have migrated my application from Java EE 8 (previously deployed on WebSphere Application Server 9.0.5.x) to Jakarta EE 10, and the application is now deployed on Liberty 25.x.
In WAS 9.x, there was a JAR named com.ibm.ws.ejb.thinclient_9.0.jar, which provided the initial context factory com.ibm.websphere.naming.WsnInitialContextFactory. However, this JAR and the corresponding initial context factory do not seem to be available in Liberty 25.x.
The following code was working correctly on WAS 9.x:
public void initialContext() {
Properties props = new Properties();
props.put(InitialContext.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
props.put(InitialContext.PROVIDER_URL,
"iiop://localhost:2809");
try {
initialContext = new InitialContext(props);
} catch (Exception e) {
throw e;
}
}
However, the same code does not work on Liberty 25.x. I am getting the following exception:
2025-12-29 01:54:16.409 [Thread-69] ERROR -
com.dsc.uniarch.batch.exception.CROperationFailedException:
Unable to access the Content Repository. Verify that the application has been started on the application server.
Unable to initialize EJB CRJobDefinitionSL.
---> nested com.dsc.uniarch.cr.error.CREJBHelperException:
Unable to initialize EJB CRJobDefinitionSL.
---> nested com.dsc.proj.ejb.EJBServiceLocatorException:
Cannot get EJB service com.dsc.uniarch.cr.ejb.CRJobDefinitionSL
If I do not set any properties and instead create the context using:
new InitialContext();
then I get the following exception:
javax.naming.NoInitialContextException:
Need to specify class name in environment or system property, or in an application resource file:
java.naming.factory.initial
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:704)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:305)
Below are the features configured in my server.xml:
<featureManager>
<feature>jakartaee-10.0</feature>
<feature>jakartaeeClient-10.0</feature>
<feature>iiopEndpoint-1.0</feature>
<feature>iiopClient-1.0</feature>
<feature>enterpriseBeans-4.0</feature>
<feature>enterpriseBeansRemote-4.0</feature>
</featureManager>
I run batch jobs in two different ways:
-
From the web UI, which uses property files.
-
From a .bat or .sh file by passing the job name as a parameter.
How can I resolve this issue in Liberty 25.x? I have been stuck on this for quite some time. Any help or guidance would be highly appreciated.
Thank you.