[jboss-dev-forums] [JBoss AS 7 Development] - calling ejb bean in a jar from another ejb bean in another jar in Jboss 7.1.1

Bijoy James do-not-reply at jboss.com
Mon Aug 27 02:17:29 EDT 2012


Bijoy James [https://community.jboss.org/people/bijoyjp] created the discussion

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

To view the discussion, visit: https://community.jboss.org/message/756053#756053

--------------------------------------------------------------
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
[https://community.jboss.org/message/756053#756053]

Start a new discussion in JBoss AS 7 Development at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2225]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-dev-forums/attachments/20120827/b7fd0f9e/attachment.html 


More information about the jboss-dev-forums mailing list