JBoss Community

calling ejb bean in a jar from another ejb bean in another jar in Jboss 7.1.1

created by Bijoy James in JBoss AS 7 Development - View the full discussion

Am using JBoss 7.1.1 Final. i have a Client application and 2 ejb bean jar files names as Jar A and Jar B.

 

I want to call bean method in the Jar B from Jar A. I am getting the object of the looking bean but not able to access the create () method.

Below code am using to get the second bean object

 

     Properties env = new Properties ();

     env.put("java.naming.factory.initial", "org.jboss.as.naming.InitialContextFactory");

 

// other than this is not working for me in inside jar

// In the Client main application am using  below property
// objProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");

 

     env.put(Context.PROVIDER_URL, "remote://localhost:4447");

     env.put("jboss.naming.client.ejb.context", true);

     env.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");

     initContext = new InitialContext(env);

     Object obj_Visualization = initContext.lookup("java:jboss/exported/FMS_Entity/VisualHome!HomeInterfaces.VisualHome");

// If am using lookup("FMS_Entity/VisualHome!HomeInterfaces.VisualHome"); am getting exception

    

     System.out.println("obj_Visualization: "+obj_Visualization);

     obj_Visualization_Home = (VisualHome) PortableRemoteObject.narrow(obj_Visualization, VisualHome.class);

     obj_Visualization_Home.create();


 

The Sysop is printing as

 

obj_Visualization: Proxy for remote EJB EJBHomeLocator{appName='', moduleName='FMS_Entity', distinctName='', beanName='VisualHome', view='interface HomeInterfaces.VisualHome'}

 

Exception in thread "Thread-79" java.lang.NoClassDefFoundError: HomeInterfaces/VisualHome

Caused by: java.lang.ClassNotFoundException: HomeInterfaces.VisualHome from [Module "deployment.JarA.jar:main" from Service Module Loader]

 

 

Am getting the object but not able to convert object to home interface object.

Please help me to solve this issue.

Advance thanks for your valuable help.


Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community