-
Mar 15th, 2012, 02:26 PM
#1
Cannot instantiate class: weblogic.jndi.WLInitialContextFactory - Spring
Hi,
I'm facing some problems with SimpleRemoteStatelessSessionProxyFactoryBean.
I have the following configuration in my xml:
<bean id="traducaoEjb" class="org.springframework.ejb.access.SimpleRemote StatelessSessionProxyFactoryBean">
<property name="jndiName" value="XXXXXXEjb" />
<property name="businessInterface" value="......XXXXXEjb" />
<property name="cacheHome" value="true" />
<property name="lookupHomeOnStartup" value="false" />
<property name="resourceRef" value="false" />
<property name="refreshHomeOnConnectFailure" value="true" />
<property name="jndiEnvironment">
<props>
<prop key="java.naming.factory.initial">weblogic.jndi.WL InitialContextFactory</prop>
<prop key="java.naming.provider.url">t3://0.0.0.0.0:17010</prop>
</props>
</property>
</bean>
When I'm in the weblogic the following error occurs:
javax.naming.NoInitialContextException: Cannot instantiate class: weblogic.jndi.WLInitialContextFactory [Root exception is java.lang.ClassNotFoundException: weblogic.jndi.WLInitialContextFactory]
at javax.naming.spi.NamingManager.getInitialContext(N amingManager.java:657)
at javax.naming.InitialContext.getDefaultInitCtx(Init ialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.ja va:223)
at javax.naming.InitialContext.<init>(InitialContext. java:197)
Probably because it can't fined wlclient.jar
If I instead of use spring (SimpleRemoteStatelessSessionProxyFactoryBean) I connect to the ejb directly in a Java class, the error does not occurs:
Context context = null;
Properties prop = new Properties();
prop.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
prop.put(Context.PROVIDER_URL, "t3://0.0.0.0:7010");
EJBHome home = null;
if(context == null){
try {
context = new InitialContext(prop);
} catch (NamingException e) {
e.printStackTrace();
}
}
Object obj = null;
try {
obj = context.lookup("XXXXEjb");
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
home = (EJBHome) PortableRemoteObject.narrow(obj, XXXXEjb.class);
try {
XXXXEjbHOme homex = (XXXXEjbHOme) home;
traducaoEjb = homex.create();
} catch (RemoteException ex) {
} catch (CreateException ex) {
}
When I test in my computer and I add the wlclient.jar in the application classpath both solution works.
Why when I use SimpleRemoteStatelessSessionProxyFactoryBean it can't find wlclient.jar???
-
Mar 16th, 2012, 09:11 AM
#2
Solved
The problem was not spring.
I configured the properties with double quotes.
<prop key="java.naming.factory.initial">${property.inita l.factory}</prop>
property.inital.factory="weblogic.jndi.WL InitialContextFactory"
After I removed that it worked properly.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules