[jboss-user] [EJB 3.0] - Problem in lookup EJB3.0 using JBOSS4.0.4

aggarwalanil2004@gmail.com do-not-reply at jboss.com
Sat Oct 7 02:50:49 EDT 2006


Hi
I am finding the problem in lookup EJB
I am unable to solve this problem
so,Help me guys.

package com.hqs.ppsadvantage.ejb;

import java.util.Properties;

import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NameNotFoundException;
import javax.naming.NamingException;

import com.sample.CounterBean;


public class HQSClient {

	public static void main(String [] args) {

        try {
        	Context context = getInitialContext();
        	
        	FileDetailsRemote fileDetailsRemote =
        		(FileDetailsRemote)context.lookup("FileDetailsSessionBean/remote");
        	
        	fileDetailsRemote.addFileDetails(10);
        	System.out.println("class name is : " + fileDetailsRemote.getClass().getName());
        	
        }catch(NameNotFoundException ex){
        	ex.printStackTrace();
        }catch (NamingException ex) {
            ex.printStackTrace();
        }
    }

    private static Context getInitialContext() throws NamingException {
        // Get InitialContext for Embedded OC4J
        // The embedded server must be running for lookups to succeed.

    	Properties env = new Properties();
    	env.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
    	env.put(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
    	env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces" );
    	Context ctx = new InitialContext(env);

    	return ctx;
    }
}



I am finding the following exception:
javax.naming.NameNotFoundException: FileDetailsSessionBean not bound
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
	at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
	at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
	at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:585)
	at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:294)
	at sun.rmi.transport.Transport$1.run(Transport.java:153)
	at java.security.AccessController.doPrivileged(Native Method)
	at sun.rmi.transport.Transport.serviceCall(Transport.java:149)
	at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
	at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
	at java.lang.Thread.run(Thread.java:595)
	at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:247)
	at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:223)
	at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:126)
	at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
	at javax.naming.InitialContext.lookup(InitialContext.java:351)
	at com.hqs.ppsadvantage.ejb.HQSClient.main(HQSClient.java:21)





View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3976729#3976729

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3976729



More information about the jboss-user mailing list