Challenge: call local ejb from remote ejb on weblogic 9.2
Hi ALL,
How do I call to local ejb from remote ejb object. The jar file is deployed on weblogic server 9.2, if you want get it http://geocities.yahoo.com.br/lindembe/BEAProject.jar and the source code are http://geocities.yahoo.com.br/lindembe/BEAProject.zip. It is a sample app with two ejb that works so good on JBOSS, JOnAS, but BEA Weblogic.....
The complete problem you watch http://forum.java.sun.com/thread.jspa?threadID=768718&messageID=4387570#4387570
or
http://forums.bea.com/bea/message.jspa?messageID=600043148&tstart=0
Your code in SigemFacadeBean should just do:
InitialContext ctx = new InitialContext();
when you lookup the local EJB. (This will work on all app servers. There's no need to put an app-server specific intial context factory in your code.)
Also, you can remove the jndi-name setting for the local ejb from your weblogic-ejb-jar.xml. jndi-name is only applied to remote ejbs.
-- Rob
WLS Blog http://dev2dev.bea.com/blog/rwoollen/
Similar Messages
-
I need to make a several calls to the methods inside EJB1 from EJB2. I was getting
the remote reference of the EJB2 inside the ejbCreate() of the EJB1, is it a good
practice ?? If not, do I need to get remote reference of the EJB2 every time I
need to call EJB2 method??
Thanks in advance.To refer a Ejb from another Ejb include <ejb-ref> in ejb-jar.xml
<session>
<ejb-name>Ejb1</ejb-name>
<ejb-ref>
<ejb-ref-name>Ejb2</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.ejb.Ejb2Home</home>
<remote>com.ejb.Ejb2</remote>
</ejb-ref>
<session>
Include a <reference-discriptor> in weblogic-ejb-jar.xml
<weblogic-enterprise-bean>
<ejb-name>EjbSession</ejb-name>
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>Ejb2</ejb-ref-name>
<jndi-name>com.ejb.Ejb2Home</jndi-name>
</ejb-reference-description>
</reference-descriptor>
</weblogic-enterprise-bean>
In Ejb1 bean class refer to Ejb2 method with a remote reference to Ejb2.
InitialContext initialContext = new InitialContext();
Ejb2Home ejb2Home = (Ejb2Home)initialContext.lookup("com.ejb.Ejb2Home");
Ejb2 ejb2 = ejb2Home.findByPrimaryKey();
Alex Pratt wrote:
I need to make a several calls to the methods inside EJB1 from EJB2. I was getting
the remote reference of the EJB2 inside the ejbCreate() of the EJB1, is it a good
practice ?? If not, do I need to get remote reference of the EJB2 every time I
need to call EJB2 method??
Thanks in advance. -
Canu00B4t call an EJB from other EJB
Hi developers,
I need do the next task :
I have a EJB in an EAR and i need call some functionality from other EJB in diferent EAR , when execute the code show the next message error:
java.rmi.RemoteException: com.sap.engine.services.ejb.exceptions.BaseRemoteException: Exception in method generaMDMOutput.
at com.sapconsulting.customer.inc.CustomerIncObjectImpl0.generaMDMOutput(CustomerIncObjectImpl0.java:135)
at com.sapconsulting.customer.inc.CustomerIncObjectImpl0p4_Skel.dispatch(CustomerIncObjectImpl0p4_Skel.java:127)
at com.sap.engine.services.rmi_p4.DispatchImpl._runInternal(DispatchImpl.java(Compiled Code))
at com.sap.engine.services.rmi_p4.DispatchImpl._run(DispatchImpl.java(Inlined Compiled Code))
at com.sap.engine.services.rmi_p4.server.P4SessionProcessor.request(P4SessionProcessor.java(Compiled Code))
at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java(Compiled Code))
at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java(Compiled Code))
at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java(Compiled Code))
at java.security.AccessController.doPrivileged1(Native Method)
at java.security.AccessController.doPrivileged(AccessController.java(Compiled Code))
at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java(Compiled Code))
at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java(Compiled Code))
Caused by: java.lang.ClassCastException: com.sap.engine.interfaces.cross.ObjectReferenceImpl
at com.sapconsulting.customer.inc.CustomerIncBean.generaMDMOutput(CustomerIncBean.java:141)
at com.sapconsulting.customer.inc.CustomerIncObjectImpl0.generaMDMOutput(CustomerIncObjectImpl0.java:119)
... 11 more
the code to invoke the EJB is the next:
ctx = new InitialContext();
TestEJBLocalHome home = (TestEJBLocalHome) ctx.lookup("sap.com/TestEJB_ear/TestEJBBean");
TestEJB servicio=(TestEJB)home.create();
the EJB are in the same server , please help,
regardsHi Siarhei,
thank's for your answers , i'll explain the scenario , i think i copied wrong the code that i have ,
i have two EAR's applications , i want to call one EJB from the other EJB in other EAR , the call have to be remote , my code is the next :
ctx = new InitialContext();
Object obj = ctx.lookup("sap.com/TestEJB_ear/TestEJBBean");
TestEJBHome home = (TestEJBHome) PortableRemoteObject.narrow(obj,TestEJBHome.class);
TestEJB servicio= home.create();
i've confugured the ejb-xml.jar adding
<ejb-ref>
<ejb-ref-name>ejb/TestEJBBean</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.innovativesystems.onl.TestEJBHome</home>
<remote>com.innovativesystems.onl.TestEJB</remote>
</ejb-ref>
I've configured the ejb-j2ee-jar.xml adding
<ejb-ref>
<ejb-ref-name>ejb/TestEJBBean</ejb-ref-name>
<jndi-name>sap.com/TestEJB_ear/TestEJBBean</jndi-name>
</ejb-ref>
I've configured the application-j2ee-engine.xml adding a hard reference
<reference
reference-type="hard">
<reference-target
provider-name="sap.com"
target-type="application">TestEJB_ear</reference-target>
</reference>
with all this configuration still send me the message java.lang.classcast ,
something is missing???? ,
regards -
Calling EJB from other EJB on other J2EE Server
Can I call EJB from other EJB on other J2EE Server
Servers - Websphere 5.0
Do i require home & remote interface of that ejb on client side also
Help me, pleasethe problem is actually i require that is specific to websphere
for example i want to call a method ion that ejb
say my ejb name is myejb
so the normal way i should call is
InitialContext initialContext = new InitialContext();
Object homeObject = initialContext.lookup("ejb/MyEjbHome");
MyEJBHome myEJBHome =(MYEjbHome )javax.rmi.PortableRemoteObject.narrow(homeObjectMYEjbHome.class);
myEJB = lSHome.create();
myEJB.someMethod();
but here i am having class for home and remote available
now if other app server i am not having this classes then what to do -
Error in calling an EJB from another EJB
Hello All,
I have a scenario where i need to call a method of an ejb from another ejb.
Both the EJB's are in different DC's.
EG: DC1 using DC2
I have added the public part of DC2 in DC1.
The following code is written in DC1 to access the EJB of DC2
MyRemote l_remote;
MyHome l_home;
InitialContext l_ctx = new InitialContext();
>> l_home = (MyHome)l_ctx.lookup("JNDI Name");
l_remote = (MyRemote)l_home.create();
There is no error at build time and deploy time, but at run time "MyHome" class is not found.
Even i am not able to access the helper class defined in the DC2 at runtime.
Please help.
Thanks in AdvanceFirst off, wrong forum section.
Check if your JNDI name is correctly placed for the bean you're calling -- check j2ee-engine.xml for that. Check the EJB container if the ear file you deployed is there and updated.
Try placing "localejbs/JNDI name" on your lookup parameter.
Regards,
Jan -
Trouble in communicating with another EJB from an EJB
I have created a stateless session bean, and inside this bean I have methods that calls methods in another stateless session bean (called myEJB, for example). When I run the code, it kept giving me the "noClassDefFoundError":
java.rmi.RemoteException: Error in ejbCreate:; nested exception is:
java.lang.NoClassDefFoundError: com.mybean.myEJBHome
Someone suggested to me that this is because they aren't remote objects, so I created local interfaces for "myEJB". When I run the code again (by binding to the Local interface now), I got this error:
javax.naming.LinkException: [Root exception is javax.naming.NameNotFoundException: Unable to resolve
'app/ejb/mybeans.jar#myEJB/local-home' Resolved: 'app/ejb/ Unresolved:'mybeans.jar#myEJB' ;
remaining name 'mybeans.jar#myEJB/local-home']; Link Remaining Name:
'java:app/ejb/mybeans.jar#myEJB/local-home'
Any ideas??
ThanksTo refer a Ejb from another Ejb include <ejb-ref> in ejb-jar.xml
<session>
<ejb-name>EjbA</ejb-name>
<ejb-ref>
<ejb-ref-name>Ejb2</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home>com.ejb.Ejb2Home</home>
<remote>com.ejb.Ejb2</remote>
</ejb-ref>
<session>
Include a <reference-discriptor> in weblogic-ejb-jar.xml
<weblogic-enterprise-bean>
<ejb-name>EjbA</ejb-name>
<reference-descriptor>
<ejb-reference-description>
<ejb-ref-name>Ejb2</ejb-ref-name>
<jndi-name>protocol://<Ejb2host>:<PortNumber>/com.ejb.Ejb2Home</jndi-name>
</ejb-reference-description>
</reference-descriptor>
</weblogic-enterprise-bean>
Example <jndi-name>:http://localhost:7001/com.ejb.Ejb2Home
In EjbA bean class refer to Ejb2 method with a reference to Ejb2 remote interface.
InitialContext initialContext = new InitialContext();
Ejb2Home ejb2Home = (Ejb2Home)initialContext.lookup("protocol://<Ejb2host>:<PortNumber>/com.ejb.Ejb2Home"); -
Can't call a VI from remote server
I have a VI running on a labview development machine(Labview 2010), the main function is handling excel report using report generator. I follow the link http://www.ni.com/white-paper/14469/en to set up labview machine and teststand machine respectly. But when I tried to call the VI from remote server, it is still not able to load the VI front panel and show the connectors. See the attachment. It looks like it still trying to load VI from local drive because it can't find the builded-in subvis for report generator function.
What should I do to make it work? Thanks!
Solved!
Go to Solution.
Attachments:
TestStand error.png 107 KBFor those interested in the solution, the problem turned out to be two things.
The first is if you want to be able to load a prototype of the VI in TestStand, you will need to either share the VI or create a dummy VI. If the shared VI uses subVIs you do not have access to, then you are better of creating a dummy VI that has matching connector panes.
The second problem had to do with how the remote VI path was specified. If you have shared the VI, then you will enter in the shared folder path as your remote VI path. If you have not shared it, then you will need to enter in the VI path as it is on the remote machine.
Rohama K. -
How to call an EJB from another EJB
Hi
I have a problem here. I need to execute a second EJB which has to get the input from the first EJB as data for execution. So when I call the first EJB, the first EJB should give the data to the second EJB and execute it and provide the result.
Cheers,
Rajok.. Here it goes.. I am writing a sample code..
public class EJB1LogBean implements SessionBean {
// test is a method of stateless session beam
public void test ( TestVal val )
throws RemoteException{
try {
EJB2LogHome ejb2Home= (EJB2LogHome)getHome("java:comp/env/ejb/EJB2LogHome",1);
EJB2Log ejb2Log = ejb2LogHome.create ( val );
} catch ( CreateException e ) {
System.out.println("Create Exception occurred ");
e.printStackTrace();
} catch ( RemoteException e ) {
System.out.println( "RemoteException Occured");
e.printStackTrace();
throw new RemoteException () ;
} catch(Exception ee) {
ee.printStackTrace();
private EJBHome getHome(String jndiName,int type) {
try {
Context context = new InitialContext();
Object ref = context.lookup( jndiName );
switch(type)
case 1:
EJB2LogHome ejb2LogHome = ( EJB2LogHome )
PortableRemoteObject.narrow( ref, EJB2LogHome.class );
return ejb2LogHome;
} catch ( Exception e ) {
e.printStackTrace();
return null;
}//EJB1LogBean ends
Here as you can see, EJB1LogBean(session bean) is calling a second EJB, EJB2LogBean (entity bean). TestVal is a sample value object passed. It is plain java class and can vary from app to app and it has got nothing to do with ejbs.
"java:comp/env/ejb" is a J2EE standard and while getting a home interface, you have to append the home interface class name to "java:comp/env/ejb". Here I am passing "java:comp/env/ejb/EJB2LogHome" and "1" to getHome method, whose job is to get a reference to a home interface. getHome method is a local method. "1" is passed just to give a flexibility to getHome method as you can have more ejbs to invoked. In that case, you can go on adding different case statements for 2, 3 etc.
The only thing you have to keep in mind is that your deployment descriptor for EJB1LogBean will contain the entires for both the beans i.e. for EJB1LogBean and EJB2LogBean. This is because EJB2LogBean is wrapped by EJB1LogBean.
Hope this helps.
Please let me know if you need anything more.
- Amit -
Calling EJBs from other EJBs in other J2EE Server?
How can I call one EJB on one J2EE Server from other
EJB on other J2EE Server?
Help me, please.
Dmitry TumanovBasically call the beans as if you were calling them in the same server through their remote interfaces. Get a InitialContext into the other appserver and then get the home object, narrow it and create a remote reference. You can follow the standard implementation just make sure that the InitialContext you create has the right properties, ie. context factory, urls, etc to the OTHER appserver.
-
HELP!!! How I can call to EJB from another EJB??
I have two EJBs, for each EJB I have a jar, how I can call to EJB jar to another???
I have tried the following, in the first EJB I have import the second EJB jar and call it with context, lookup, PortableRemoteObject etc.. but the instruction lookup not find the second EJB reference.
The name in the lookup instruction is the JNDI name of the second EJB but not find a reference to it.
Please help me!!! Thanks!!
The error is:
javax.naming.NameNotFoundException: Missing node. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(NotFoundHelper.java:34)
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.extract(NotFoundHelper.java:50)
at org.omg.CosNaming._NamingContextStub.resolve(_NamingContextStub.java:161)
at com.inprise.j2ee.jndi.java.CorbaContext.resolveName(CorbaContext.java:242)
at com.inprise.j2ee.jndi.java.CorbaContext.lookup(CorbaContext.java:261)
at com.inprise.j2ee.jndi.java.javaContext.internal_lookup(javaContext.java:483)
at com.inprise.j2ee.jndi.java.javaContext.internal_lookup(javaContext.java:493)
at com.inprise.j2ee.jndi.java.javaContext.internal_lookup(javaContext.java:493)
at com.inprise.j2ee.jndi.java.javaContext.lookup(javaContext.java:937)
at com.inprise.j2ee.jndi.java.javaContext.lookup(javaContext.java:942)
at javax.naming.InitialContext.lookup(InitialContext.java:350)
at ejbclient.EnterpriseClientBean.addition(EnterpriseClientBean.java:115)
at ejbclient.EnterpriseClientBean.actionPerformed(EnterpriseClientBean.java:97)
at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1450)
at avax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstrok.. Here it goes.. I am writing a sample code..
public class EJB1LogBean implements SessionBean {
// test is a method of stateless session beam
public void test ( TestVal val )
throws RemoteException{
try {
EJB2LogHome ejb2Home= (EJB2LogHome)getHome("java:comp/env/ejb/EJB2LogHome",1);
EJB2Log ejb2Log = ejb2LogHome.create ( val );
} catch ( CreateException e ) {
System.out.println("Create Exception occurred ");
e.printStackTrace();
} catch ( RemoteException e ) {
System.out.println( "RemoteException Occured");
e.printStackTrace();
throw new RemoteException () ;
} catch(Exception ee) {
ee.printStackTrace();
private EJBHome getHome(String jndiName,int type) {
try {
Context context = new InitialContext();
Object ref = context.lookup( jndiName );
switch(type)
case 1:
EJB2LogHome ejb2LogHome = ( EJB2LogHome )
PortableRemoteObject.narrow( ref, EJB2LogHome.class );
return ejb2LogHome;
} catch ( Exception e ) {
e.printStackTrace();
return null;
}//EJB1LogBean ends
Here as you can see, EJB1LogBean(session bean) is calling a second EJB, EJB2LogBean (entity bean). TestVal is a sample value object passed. It is plain java class and can vary from app to app and it has got nothing to do with ejbs.
"java:comp/env/ejb" is a J2EE standard and while getting a home interface, you have to append the home interface class name to "java:comp/env/ejb". Here I am passing "java:comp/env/ejb/EJB2LogHome" and "1" to getHome method, whose job is to get a reference to a home interface. getHome method is a local method. "1" is passed just to give a flexibility to getHome method as you can have more ejbs to invoked. In that case, you can go on adding different case statements for 2, 3 etc.
The only thing you have to keep in mind is that your deployment descriptor for EJB1LogBean will contain the entires for both the beans i.e. for EJB1LogBean and EJB2LogBean. This is because EJB2LogBean is wrapped by EJB1LogBean.
Hope this helps.
Please let me know if you need anything more.
- Amit -
How to call the secured EJB from timer ejb timedout method.
Hi All,
I have a couple of questions on EJB 3.1 Timer Service.
1. How to call the secured EJB (annotated @RolesAllowed) from Timer EJB @Timeout Method?
2. What's the default role/principal with which the Timer @Timeout Method gets called?
Please let me know any info regarding the same.
Thanks,
SureshI'd start here:
http://ant.apache.org/manual/index.html
If that doesn't help, go to the table of contents and start poking around. You don't need to read the whole thing front to back, but if you're not willing to spend some time researching and reading, you're not going to get very far. -
How tom invoke an EJB from another EJB using the sun rmi protocl in Weblogi
Hi,
I am particularly new to EJB.
My scenario is
client invoking-->EJB-----invoking ----(Either a webService or an EJB)
in WEBLOGIC
Is it possible that a call from EJB to another EJB or WebService use Sun's RMI as underlying protocol instead of t3 or IIOP which are used in Weblogic ?
Would be really a great help if you could provide me some sample on it on weblogic.Hi Stefan,
You don't need to provide the InitialContextFactory for running a standalone client. The following should work just fine:
Context initial = new InitialContext();
System.out.println("Looking up ...");
Object objref = initial.lookup(EJB); //the lookup name should be a global JNDI name //and not from the java:comp namespace
System.out.println("Looked up EJB");The JNDI implementation looks for the jndi.properties file in your classpath. So make sure that you have the appserv-rt.jar from your <server_installation>/lib directory in your classpath.
HTH,
Sheetal -
Install EBS on local disk from remote win 2003? Can't pass file space check
I have a portable 250G hard disk on my poor performance win xp,I want to install EBS 12 on my portable hard disk,but I xp system's performance is poor,so I connect to a fine performance win 2003 through mstsc and I can access my 250G hard disk from remote computer win 2003;
But when I indecate to use remote hard disk "\\tsclient\M\ebs" as my base directory,I meet some err log like below:
RW-20012: Error: - Free disk space on system returns zero:
probable cause - mount point does not exist.
RW-20013: Error: - Not enough free disk space on system:
Database ORACLE_HOME = \\tsclient\M\ebs\db\tech_st\10.2.0
required = 3280.0
actual = 0.0
If I choose local disk as my base directory ,It pass the file space check;
Can anyone meet such problem? Please help me ,thanks in advance!Instead of using "\\tsclient\M\ebs\db\tech_st\10.2.0" as a directory path, map this network drive as any other free drive (i.e. F:\, G:\ .. etc). You should be able to proceed with the installation then.
If you need more details about mapping network drive, please refer to:
Windows XP: Mapping a network drive
http://www.microsoft.com/windowsxp/using/networking/maintain/mapdrive.mspx -
Error Accessing EJB from remote application - is it supported in 101202?
We are running Oracle App Server 10.1.2.0.2, There is a containers created on midtier server called OC4J_TEST .
We have two applications, one has EJB and another one has JSP.JSP has following code
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
env.put(Context.SECURITY_PRINCIPAL, "ias_admin");
env.put(Context.SECURITY_CREDENTIALS, "welcome1");
String pURL="opmn:ormi://localhost:12401:OC4J_TEST/";
env.put(Context.PROVIDER_URL,pURL );
env.put("dedicated.connection","true");
Context context = null;
sampleejb Sampleejb;
String mess = "Initial message, if you see that is because EJB has not been properly called";
mess = mess + " "+pURL;
try
// Create InitialContext
context = new InitialContext(env);
// Lookup Home interface
sampleejbHome SampleejbHome = (sampleejbHome)PortableRemoteObject.narrow(context.lookup("sampleejb"), sampleejbHome.class);
// Create the bean and the remote interface
Sampleejb = SampleejbHome.create();
mess = Sampleejb.hello("Middle Tier JSP EJB Client");
// Destroy the Bean Instance
catch(Throwable ex)
ex.printStackTrace();
When I run this code we get following exception:
08/10/15 16:21:35 javax.naming.NameNotFoundException: ejbserverapp/sampleejb not found
08/10/15 16:21:35 at com.evermind.server.rmi.RMIContext.lookup(RMIContext.java:165)
08/10/15 16:21:35 at javax.naming.InitialContext.lookup(InitialContext.java:347)
08/10/15 16:21:35 at JspsampleejbClient.jspService(_JspsampleejbClient.java:76)
08/10/15 16:21:35 at com.orionserver.http.OrionHttpJspPage.service(OrionHttpJspPage.java:56)
08/10/15 16:21:35 at oracle.jsp.runtimev2.JspPageTable.compileAndServe(JspPageTable.java:575)
08/10/15 16:21:35 at oracle.jsp.runtimev2.JspPageTable.service(JspPageTable.java:311)
08/10/15 16:21:35 at oracle.jsp.runtimev2.JspServlet.internalService(JspServlet.java:498)
08/10/15 16:21:35 at oracle.jsp.runtimev2.JspServlet.service(JspServlet.java:402)
08/10/15 16:21:35 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
08/10/15 16:21:35 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:835)
08/10/15 16:21:35 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:341)
08/10/15 16:21:35 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:816)
08/10/15 16:21:35 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:231)
08/10/15 16:21:35 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:136)
08/10/15 16:21:35 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
08/10/15 16:21:35 at java.lang.Thread.run(Thread.java:534)
What we really want is to have webapp with JSP running on one server and EJB running on another server. Need some help.
Thanks in advance.
Manoj
Edited by: Manoj Desai on Oct 16, 2008 11:01 AMThis connection string does not look correct to me:
String pURL="opmn:ormi://localhost:12401:OC4J_TEST/";
As you have it, you are specifying the OC4J RMI port to connect to, in conjunction with the ORMI lookup handler.
The correct form for this string should be using the OPMN request port:
String pURL="opmn:ormi://localhost:6003:OC4J_TEST/";
The6003 value comes from the request port that OPMN is using on the target application server instance you need to connect to -- you can observe this port by looking at the $ORACLE_HOME/opmn/conf/opmn.xml file and look for this element:
<port local="6101" remote="6202" request="6003"/>
Use whatever port is specified there in your connect string.
-steve- -
Hi ,
I have an EJB A which is already deployed when the server starts. A second ejb
B is deployed at a later time.
EJB A calls methods in EJB B. I use reflection in EJB A to call methods in EJB
B.
I get a NoSuchMethodException when I call the create method in the Home object
of EJB B. If I add the ejb jar file to the classpath before the server starts
then it is able to resolve the method.
The problem is the EJBs which are called from EJB A is not known before the server
is started. New EJBs can be deployed at runtime and EJB A should be able call
the methods in newly deployed EJB's.
I also use the URLClassLoader to load all the classes in the jar file of the newly
deployed EJB in EJB A and it still gives a NoSuchMethodException because it cannot
resolve the stub class.
My error log is shown below.
This is an urgent issue.
Thanks
SampleConnector::testEJBService called
In Key : P1 Value : Input2
In Key : P3 Value : Input1
In Key : P2 Value : SomeConst
Loaded Class = com.bizwave.samples.rejb.SampleRemote
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_EOImpl
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_HomeImpl
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_Impl
Loaded Class = com.bizwave.samples.rejb.SampleRemoteHome
java.lang.NoSuchMethodException
at java.lang.Class.getMethod0(Native Method)
at java.lang.Class.getDeclaredMethod(Class.java:1151)
at com.bizwave.samples.ejb.SampleConnectorEJB.testEJBService(SampleCon
ctorEJB.java:181)
at com.bizwave.samples.ejb.SampleConnectorEJB_be5y1v_EOImpl.testEJBSer
ce(SampleConnectorEJB_be5y1v_EOImpl.java:98)
at java.lang.reflect.Method.invoke(Native Method)
at com.bizwave.fc.utils.ClassUtils.invokeEJBMethod(ClassUtils.java:109
at com.bizwave.infra.fjet.engine.EJBServiceStepMgr.executeService(EJBS
viceStepMgr.java:91)Hi,
I am attaching a test case. This test case actually demonstrates a security bug.
Unzip the file and modify the StartWeblogic.cmd in domainA to not refer to the
SampleRemoteEJB.jar in the classpath. If u run the test client under the client
dir u will see a NoSuchMethodException.
The reason is it is not able to load the dynamically generated stub file.
Initially I had the getMethod and it didn't work. You might have to modify the
files to suit ur env. The easier way is to run th edomain wizard and create 2
domains. Run the servers in development mode and place the jars under the applications
dir
Thanks
Rajesh Mirchandani <[email protected]> wrote:
Do you have any old EJB classes in your classpath? Did you recompile
your EJBs if you
upgraded from a old release or a Service pack?
Bob Lee wrote:
Hmmmm. That's an interesting problem.
Why is it giving you a NoSuchMethodException instead of a
ClassNotFoundException?
Can you post the code from SampleConctorEJB.java, line 181?
Try changing your call to getDeclaredMethod() to getMethod().
getDeclaredMethod() searches only the class you called it on, whereas
getMethod() traverses to the superclasses and interfaces. You onlyneed
getDeclaredMethod() when you're accessing a nonpublic method.
Not sure if this will help, but it's worth a shot.
Bob
Vasu wrote:
Hi ,
I have an EJB A which is already deployed when the server starts.
A second ejb
B is deployed at a later time.
EJB A calls methods in EJB B. I use reflection in EJB A to call methodsin EJB
B.
I get a NoSuchMethodException when I call the create method in theHome object
of EJB B. If I add the ejb jar file to the classpath before the serverstarts
then it is able to resolve the method.
The problem is the EJBs which are called from EJB A is not knownbefore the server
is started. New EJBs can be deployed at runtime and EJB A shouldbe able call
the methods in newly deployed EJB's.
I also use the URLClassLoader to load all the classes in the jarfile of the newly
deployed EJB in EJB A and it still gives a NoSuchMethodExceptionbecause it cannot
resolve the stub class.
My error log is shown below.
This is an urgent issue.
Thanks
SampleConnector::testEJBService called
In Key : P1 Value : Input2
In Key : P3 Value : Input1
In Key : P2 Value : SomeConst
Loaded Class = com.bizwave.samples.rejb.SampleRemote
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_EOImpl
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_HomeImpl
Loaded Class = com.bizwave.samples.rejb.SampleRemoteEJB_svq1df_Impl
Loaded Class = com.bizwave.samples.rejb.SampleRemoteHome
java.lang.NoSuchMethodException
at java.lang.Class.getMethod0(Native Method)
at java.lang.Class.getDeclaredMethod(Class.java:1151)
at com.bizwave.samples.ejb.SampleConnectorEJB.testEJBService(SampleCon
ctorEJB.java:181)
at com.bizwave.samples.ejb.SampleConnectorEJB_be5y1v_EOImpl.testEJBSer
ce(SampleConnectorEJB_be5y1v_EOImpl.java:98)
at java.lang.reflect.Method.invoke(Native Method)
at com.bizwave.fc.utils.ClassUtils.invokeEJBMethod(ClassUtils.java:109
at com.bizwave.infra.fjet.engine.EJBServiceStepMgr.executeService(EJBS
viceStepMgr.java:91)
Rajesh Mirchandani
Developer Relations Engineer
BEA Support
[user_projects.zip]
Maybe you are looking for
-
I am getting followong error XML Parsing Error: undefined entity Location: chrome://weave/content/options.xul Line Number 6, Column 3: <setting id="weave-account" type="string" title="&account.label;" /> --^
-
Extremely Urgent : Transport of KM Content through ICE Protocol
Hello Friends, This is really urgent. I have been transporting XML content in KM folders through ICE protocol. But of late the problem is that I am able to download the KM foledrs in .zip format in my Desktop but of late when I am trying to upload it
-
How to add values dynamically for custom property during design time?
I am trying to create a user control with custom properties. I have a property named Server. And Values for this property is system dependent. I have the code that can generate the values and is working fine. During the design time, when I include th
-
Hi All, Just wondering if this can be done in Entities Assume I have Child as an Entity, with attribute: Name {string} DOB {number} Pocket Money Allowance {number} Also have a Global attribute Parents Budget Parent_Budget {number} Set to 100
-
Hi All, We have configured act as in OBIEE and its woring fine for answers reports. We have created BIP reports and using on dahsboard. But act as is not working for bip reports. Please suggest !