Announcement Announcement Module
Collapse
No announcement yet.
Cannot instantiate class: weblogic.jndi.WLInitialContextFactory - Spring Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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???

  • #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.

    Comment

    Working...
    X