JBoss Community

Re: lookup for remote bean - failure (only from eclipse)

created by JN JNC in EJB3 - View the full discussion

Hi,

 

I got exactly same issue when running same kind of remote EJB lookup from a unit test or from a simple java client with classpath corretcly setup to include JBOSS_HOME/client/jbossall-client.jar.

 

 

 

 

 

 

##

  

10:24:11,528 INFO [ServerImpl] Starting JBoss (Microcontainer)...

10:24:11,528 INFO [ServerImpl] Release ID: JBoss [The Oracle] 5.1.0.GA (build: SVNTag=JBoss_5_1_0_GA date=200905221634)

 

public static void main(String[] args) throws NamingException {

Properties properties = new Properties();
properties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
properties.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
properties.put(Context.PROVIDER_URL, "localhost:1099");
context = new InitialContext(properties);
Object bean = context.lookup("my-app-ear-name/myBean/remote");



}

 

Exception in thread "main" javax.naming.NamingException: Could not dereference object [Root exception is java.lang.RuntimeException: ...

        at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1504)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:822)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:686)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)

....

Caused by: java.lang.RuntimeException: Exception while trying to locate proxy factory in JNDI, at key ProxyFactory/....
        at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getProxyFactoryFromJNDI(ProxyObjectFactory.java:
        at org.jboss.ejb3.proxy.impl.objectfactory.ProxyObjectFactory.getObjectInstance(ProxyObjectFactory.java:157)
        at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1479)
        at org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1496)
        ... 4 more

Caused by: javax.naming.NameNotFoundException: ProxyFactory not bound
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:771)
        at org.jnp.server.NamingServer.getBinding(NamingServer.java:779)
        at org.jnp.server.NamingServer.getObject(NamingServer.java:785)
        at org.jnp.server.NamingServer.lookup(NamingServer.java:396)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)



A wrong classpath setup would give

 

Exception in thread "main" javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [
aces.NamingContextFactory]
        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
        at javax.naming.InitialContext.init(InitialContext.java:223)
        at javax.naming.InitialContext.<init>(InitialContext.java:197)
        at com.temenos.tafj.tools.jmsinjector.EJBRemoteInvoker.main(EJBRemoteInvoker.java:23)
Caused by: java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory



Do you have any suggestion ?



Thanks and regards.

Reply to this message by going to Community

Start a new discussion in EJB3 at Community