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,
regards

Hi 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

Similar Messages

  • 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, please

    the 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

  • 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 Tumanov

    Basically 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.

  • 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/

  • Calling EJB from another EJB

    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.

  • 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 Advance

    First 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??
    Thanks

    To 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");

  • 3 iphones in household.All use same apple ID.But all contacts get mixed between phones and facetime calls come in from other contacts.Ho can we change this so our phone information isn't visible to each other?

    3 iphones in household.All use same apple ID.But all contacts get mixed between phones and facetime calls come in from other contacts.How can we change this so our phone information isn't visible to each other?

    Use separate Apple IDs for each family member and use Family Sharing features of those things (if any) that you do want to share. https://www.apple.com/ios/whats-new/family-sharing/

  • How to call a EJB from other computer

    Hi,
    I'm beginer to EJB, and I take a book and complete an example. The example has a stateless EJB on the server side, and a client class.
    the client code is like this:
    import javax.naming.Context;     
    import javax.naming.InitialContext;     
    import javax.rmi.PortableRemoteObject;     
    import java.math.BigDecimal;     
    //import Converter;     
    //import ConverterHome;     
    public class ConverterClient {     
    public static void main(String[] args) {     
    try {     
    Context initial = new InitialContext();     
         Object objref = initial.lookup ("java:comp/env/ejb/SimpleConverter");//what to do here??
    ConverterHome home =      
    (ConverterHome)PortableRemoteObject.narrow(objref,      
    ConverterHome.class);     
    Converter currencyConverter = home.create();     
    BigDecimal param = new BigDecimal ("100.00");     
    BigDecimal amount =     
    currencyConverter.dollarToYen(param);     
    System.out.println(amount);     
    amount = currencyConverter.yenToEuro(param);     
    System.out.println(amount);     
    System.exit(0);     
    } catch (Exception ex) {     
    System.err.println("Caught an unexpected exception!");     
    ex.printStackTrace();     
    I want to run the client class from other machine.
    how to complete the following piece of code for making the remote connection:
    Context initial = new InitialContext();     
    Object objref = initial.lookup ("java:comp/env/ejb/SimpleConverter"); //what's the string supousing the server machine name is "server"??
    Thanks a lot!!!
    George

    Thanks, but gimme pls. the URL...I've go to J2EE FAQ
    but there are only 13 questions....
    Thanks !The link to all the FAQs is on the left side of this page.

  • 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,
    Raj

    ok.. 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,
    Suresh

    I'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.

  • 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(Abstr

    ok.. 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 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

  • Call proxy service from other proxy service with attachment

    Hi!
    I have got an email sending proxy service I would like to call this from an other proxy service and I want to send attachment in email. I can send email with attachment if i call this proxy as a webservice (e.g. from soapUI)
    But if i want to call this email proxy service from other proxy service, the attachment in email is empty. I put a log action (expression: $attachments) in the beginning of email proxy service, and I saw this in the log file:
    +<con:attachments xmlns:con="http://www.bea.com/wli/sb/context"/>+
    So the attachment is really empty...
    I use service callout. I put an insert action in request action of service callout:
    In Variable:
    attachments
    XPath:
    +.+
    Location:
    as first child of
    Expression:
    +<con:attachment xmlns:con="http://www.bea.com/wli/sb/context">+
    +     <con:Content-Type>application/octet-stream</con:Content-Type>+
    +     <con:Content-Disposition>attachment; filename="{$v_fileName}"</con:Content-Disposition>+
    +     <con:Content-Transfer-Encoding>base64</con:Content-Transfer-Encoding>     +
    +     <con:body>{$attachments/ctx:attachment/ctx:body/*}</con:body>+
    +</con:attachment>+
    Why cannot I call this email proxy service from other proxy service for sending email with attachment?
    I tried to solve this other. I called an email sending business service from this proxy service. But in this case I cannot set the body of email. If I put just one Transport Header action in publish action, I could send the email (with empty body). But If I put a replace action in publish action as well then the OSB didn't send the email and I couldn't find any error message in log file... How could I set the body of email in publish action?
    Thanks!
    Viktor

    You should be able to get the current user id from the SPListItemEventProperties object. From here you should be able to create a Claim. For example get the user by using
    user = SPWeb.Users.GetByID(properties.CurrentUserId)
    SPClaim claim = SPClaimProviderManager.CreateUserClaim(user.email, SPOriginalIssuerType.TrustedProvider, issuerIdentifier);
    https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.administration.claims.spclaimprovidermanager.createuserclaim(v=office.14).aspx
    Blog | SharePoint Field Notes Dev Tools |
    SPFastDeploy | SPRemoteAPIExplorer

  • Calling a newly deployed EJB from an EJB gives a NoSuchMethod Exception if the jar of the newly deployed ejb is not in the classpath

    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