Calling EJB from class in same ear

Has anyone ever attempted to call an EJB from a class that is in the same ear?
I have a singleton class, not
another EJB, that is trying to get ahold of an EJB to call a method. This method
has been defined to have both
a local and remote interface.
I thought I should be able to get a hold of the local interface. When I try to
get the interface out of JNDI
as follows:
PickupCpaLocalHome cpaHome = (PickupCpaLocalHome) ctx.lookup("pickup.PickupCpaEJBLocal");
I get an exception:
javax.naming.LinkException: [Root exception is
     javax.naming.NameNotFoundException: Unable to resolve
     'app/ejb/PickupCpaEJB.jar#PickupCpaEJB/local-home' Resolved: 'app/ejb'
     Unresolved:'PickupCpaEJB.jar#PickupCpaEJB' ; remaining name
     'PickupCpaEJB.jar#PickupCpaEJB/local-home']; Link Remaining Name:
'java:app/ejb/PickupCpaEJB.jar#PickupCpaEJB/local-home'
When I look at the JNDI tree using the WebLogic console, it shows that "pickup.PickupCpaEJBLocal"
is
in JNDI.
Since the local interface doesn't work, I thought I'd try the remote interface.
The remote interface
works fine from my client and from another EJB in a different ear. Using the
remote interface I get an
exception when trying to cast the result to my home.
java.lang.ClassCastException:
com.fedex.pickup.j2ee.ejb.cpa.PickupCpaEJB_gapk5_HomeImpl_WLStub
// Code
PickupCpaHome cpaHome = (PickupCpaHome) ctx.lookup("pickup.PickupCpaEJBRemote");
As I mentioned earlier, the same code works in a client and in an EJB in another
ear.
Any ideas

Has anyone ever attempted to call an EJB from a class that is in the same ear?
I have a singleton class, not
another EJB, that is trying to get ahold of an EJB to call a method. This method
has been defined to have both
a local and remote interface.
I thought I should be able to get a hold of the local interface. When I try to
get the interface out of JNDI
as follows:
PickupCpaLocalHome cpaHome = (PickupCpaLocalHome) ctx.lookup("pickup.PickupCpaEJBLocal");
I get an exception:
javax.naming.LinkException: [Root exception is
     javax.naming.NameNotFoundException: Unable to resolve
     'app/ejb/PickupCpaEJB.jar#PickupCpaEJB/local-home' Resolved: 'app/ejb'
     Unresolved:'PickupCpaEJB.jar#PickupCpaEJB' ; remaining name
     'PickupCpaEJB.jar#PickupCpaEJB/local-home']; Link Remaining Name:
'java:app/ejb/PickupCpaEJB.jar#PickupCpaEJB/local-home'
When I look at the JNDI tree using the WebLogic console, it shows that "pickup.PickupCpaEJBLocal"
is
in JNDI.
Since the local interface doesn't work, I thought I'd try the remote interface.
The remote interface
works fine from my client and from another EJB in a different ear. Using the
remote interface I get an
exception when trying to cast the result to my home.
java.lang.ClassCastException:
com.fedex.pickup.j2ee.ejb.cpa.PickupCpaEJB_gapk5_HomeImpl_WLStub
// Code
PickupCpaHome cpaHome = (PickupCpaHome) ctx.lookup("pickup.PickupCpaEJBRemote");
As I mentioned earlier, the same code works in a client and in an EJB in another
ear.
Any ideas

Similar Messages

  • Calling EJB from Java Stored Procedures

    Hi,
    I am trying to call an Enterprise Java Bean from stored procedure. This stored procedure calls a java program. As long as it is a simple java program it works fine and loadjava.exe does not give any problem (neither compile-time nor run-time).
    It is not working when I am trying to call EJB from it. It is giving compile-time error.
    If anybody has implemented the same please suggest how to go forward.
    thanks in advance,
    Shashank Agarwal

    I tried the same thing without any luck. I assume you are using OC4J for your EJB ...
    The compiling issue may be because you don't have the classes in your EJB client jar loaded into the database. Once those classes are loaded, you should loadjava without any problem.
    However, you won't be able to call the EJB server because the EJB client (your Java code in the DB) will need the OC4J environment (oc4j.jar). I have tried to load oc4j.jar into the DB as well, and that was a big mess and nothing worked. My DB is 8.1.7, maybe the new 9i have OC4J libs bundled?!?
    I looked around and only found 2 alternatives:
    1. Write a JSP page that acts like an EJB client, then use URLConnection in your DB java code to send params to the JSP for it to invlode the EJB
    2. Replace the JSP with RMI code, and use RMI instead of URLConnection in your DB code to invloke the EJB client.
    If you find any other solution, please share it here.
    Good luck!
    Hi,
    I am trying to call an Enterprise Java Bean from stored procedure. This stored procedure calls a java program. As long as it is a simple java program it works fine and loadjava.exe does not give any problem (neither compile-time nor run-time).
    It is not working when I am trying to call EJB from it. It is giving compile-time error.
    If anybody has implemented the same please suggest how to go forward.
    thanks in advance,
    Shashank Agarwal

  • Calling EJB from from a client app

    Hi all,
    I am trying to call an EJB component from portal. The example EJB I have taken is from SDN Bonus Calculator example - Application Server/Web Dynpro/Samples and Tutorials/Using EJBs (20)
    I deployed the EAR file - no issue
    I wrote the following code in a client app and trying to connect to the EJB remotely.
              try {
                   java.util.Properties properties = new Properties();
                   properties.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
                   properties.put(Context.PROVIDER_URL, "ux0800:55304");
                   InitialContext ctx = new InitialContext(properties);
                   //InitialContext ctx = new InitialContext();
                   // get ejb home
                   home =
                        (BonusCalculatorLocalHome) ctx.lookup(
                             "localejbs/MySessionBean");
                   theCalculator = home.create();
              } catch (Exception namingException) {
                   namingException.printStackTrace();
    I get the following error
    javax.naming.NoInitialContextException: Cannot instantiate class: com.sap.engine.services.jndi.InitialContextFactoryImpl [Root exception is java.lang.ClassNotFoundException: com.sap.engine.services.jndi.InitialContextFactoryImpl]
         at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
         at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
         at javax.naming.InitialContext.init(Unknown Source)
         at javax.naming.InitialContext.<init>(Unknown Source)
         at com.sap.bonus.calculation.sessionBean.MyCommandBean.<init>(MyCommandBean.java:27)
         at com.sap.bonus.calculation.sessionBean.MyCommandBean.main(MyCommandBean.java:68)
    Caused by: java.lang.ClassNotFoundException: com.sap.engine.services.jndi.InitialContextFactoryImpl
         at java.net.URLClassLoader$1.run(Unknown Source)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClass(Unknown Source)
         at java.lang.ClassLoader.loadClassInternal(Unknown Source)
         at java.lang.Class.forName0(Native Method)
         at java.lang.Class.forName(Unknown Source)
         at com.sun.naming.internal.VersionHelper12.loadClass(Unknown Source)
    Any clue will be appreciated.
    thnx

    Hi Sabbir,
    Following code works for me in calling EJB from normal java application. Did you added the jar files to your application?. see the required jar files in end of code.
    Create simple java applcation do the following steps:
    Give JNDI name to the EJB(HelloJNDI)->Add the HelloEJB to HelloEAR ->deploy
    Proxy Program to call ejb:
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import com.sample.Hello;
    import com.sample.HelloHome;
    public class HelloTest {
         public static void main(String[] args) {
                       Hello remote = null;
                      try {
                        Context ctx = new InitialContext();
                        HelloHome home = (HelloHome) ctx.lookup("HelloJNDI");
                        remote = home.create();
                        String result = remote.hello();
                        System.out.print("Result:" + result);
                         } catch (Exception e) {
                                System.out.println("Exception:" + e.getLocalizedMessage());
    1. Go To  Run > Java Application ->New->select your project and select your main class(java program from which your going to call EJB)
    2. Click  next tab ->(x)=Arguments
    paste the following code in VM Arguments
    -Djava.naming.factory.initial=com.sap.engine.services.jndi.InitialContextFactoryImpl -Djava.naming.provider.url=localhost:50104
    replace the server IP address with your server IP address where your ejbs are running.
    Under Class path settings for the program put the following jar files.
    You can search for them from net weaver soruce folders
    or copy from D:\usr\sap\J2E\JC01\j2ee\j2eeclient
    ejb20.jar
    logging.jar
    exception.jar
    sapj2eeclient.jar
    Add Corresponding ejb.jar
    and RUN >>>
    this makes testing of your client programs easier, you can find the error trace on which line and saves lot of time.
    Regards, Suresh

  • 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 EJB from app client

    Hello, everybody,
    I'm very new at EJB and I'm trying to learn it.
    I have created Enterprise Application using Netbeans IDE, I have EJB and APP client. What I want is to connect to my MySql database and get some info from table.
    For e.g. Login and Password.
    How can I call EJB from my client app which connects to my database and gets information I need?

    What server you are using?
    if you use jboss AS ,here is a simple Main class how to connect EJB and access ejb methods:
    package com.david.ejb.client;
    import java.util.Properties;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
    import com.david.ejb.domain.Person;
    import com.david.ejb.domain.PersonRemote;
    public class Main {
         public static void main(String[] args) {
              try {
                   Context ctx = getInitialContext();
                   Object obj = ctx.lookup("PersonSessionRemote/remote");
                PersonRemote pr=(PersonRemote)PortableRemoteObject.narrow(obj, PersonRemote.class);
                Person p=new Person();
                p.setName("david");
                pr.addPerson(p);
                pr.findPerson(1);
                   // System.out.print(br.find(pk).getAuthor_name());
              } catch (Exception ex) {
                   ex.printStackTrace();
         private static Context getInitialContext() throws NamingException {
              Properties p = new Properties();
              p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.NamingContextFactory");
              p.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interfaces");
              p.setProperty(Context.PROVIDER_URL, "jnp://localhost:1099");
              return new InitialContext(p);
    }Person is ant @Entity and PersonRemote is remote interfaces, to connect database you have to make datasource file at jboss-4.2.3.GA\server\default\deploy
    simle mysql-ds.xml looks like this:
    datasources>
       <local-tx-datasource>
          <jndi-name>some name</jndi-name>
          <connection-url>jdbc:mysql://localhost:3306/dbname</connection-url>
          <driver-class>com.mysql.jdbc.Driver</driver-class>
          <user-name>root</user-name>
          <password>root password</password>
          <min-pool-size>5</min-pool-size>
          <max-pool-size>100</max-pool-size>
          <idle-timeout-minutes>15</idle-timeout-minutes>
          <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
          <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>
       </local-tx-datasource>
    </datasources>also at resources/META-INF directory you must have persistence.xml like this
    <persistence>
         <persistence-unit name="SimpleEjb">
              <jta-data-source>java:/some name</jta-data-source>
              <properties>
                   <property name="hibernate.hbm2ddl.auto" value="update" />
                   <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLDialect" />
                   <property name="hibernate.show_sql" value="true"/>
                   <property name="hibernate.format_sql" value="true"/>
              </properties>
         </persistence-unit>
    </persistence>

  • Call ejb from browsers

    Hello Developers!
    I deployed my ejb to OAS4081. I call that
    from JDeveloper so it good. But when I try
    to call from applet in IExpl5 I can't
    instantiate the ORB. I've got a com.ms.security.SecurityException : oracle.oas.orb.CORBA.ORB.init
    I coded the CLASSPATH(oasoorb(yoj),client,
    ejbapi...) perfectly, I think.
    If anybody could help, please...
    Thanx!

    Hi there,
              I saw someone on this group had a problem to locate proper classpath
              to call EJB from JSP. I thought if you call EJB from classpath, you are
              calling the bean. But you loss all the EJB functions. To be able to utilize
              EJB features like object pooling. You need to call it from Weblogic server
              using url/jndi, not from the jar directly.
              Any comment? Am I right?
              BTW, my question about calling EJB from JSP means calling through URL,
              not a local path.
              Thank you
              >-------------------------------------------------------------------->
              Jim wrote in message <[email protected]>...
              >Hi there,
              > Can I call EJB from JSP? Is there a particular security setting or
              >concern for Weblogic? Is there an coding example?
              >
              >Thank you
              >
              >
              

  • "HowTo" Call EJB from different EAR in WLS7

    Hi,
    Im trying to deploy two EAR application modules, both on same WLS7.0 SP2 server
    . I have several problems to give visibility between EAR applications. There is
    dependences between both applications ( I will call them FirstEAR and SecondEAR)
    . A FirstEAR EJB ( FirstEAREJB) uses an EJB from the SecondEAR ( SecondEAREJB
    The deployment result is a "Unable to initialize method info for remote or home
    interface The error is java.lang.NoClassDefFoundError: myPackage.myPackage.SECONDEAREJB"
    when deploy the FirstEAREJB. I try the deployment of both using -iiop ejbc option.
    Which is the way to allow my FirstEAREJB to use SECONDEAREJB?
    I have try
    - to set the manifest Class-Path property for FirstEAREJB with no results.
    - to set the descriptor ejb-jar properties for EJBRefs with no results.
    - to set the SecondEAREJB path in the weblogic start script classpath, with no
    results.
    - to set the SecondEAR classpath at the ejbc -cp option for FirstEAREJB ejbc
    compile, with no results again.
    Is there another way to allow my FirstEAREJB to use SecondEAREJB ?

    Take a look at this documentation on WebLogic Server Application
    Classloading.
    It might be helpful.
    http://edocs.bea.com/wls/docs70/programming/classloading.html
    /k
    "Adolfo Cortés" <[email protected]> wrote in message
    news:[email protected]..
    >
    Hi,
    Im trying to deploy two EAR application modules, both on same WLS7.0 SP2server
    I have several problems to give visibility between EAR applications.There is
    dependences between both applications ( I will call them FirstEAR andSecondEAR)
    A FirstEAR EJB ( FirstEAREJB) uses an EJB from the SecondEAR (SecondEAREJB
    The deployment result is a "Unable to initialize method info for remote orhome
    interface The error is java.lang.NoClassDefFoundError:myPackage.myPackage.SECONDEAREJB"
    when deploy the FirstEAREJB. I try the deployment of both using -iiop ejbcoption.
    >
    Which is the way to allow my FirstEAREJB to use SECONDEAREJB?
    I have try
    - to set the manifest Class-Path property for FirstEAREJB with noresults.
    - to set the descriptor ejb-jar properties for EJBRefs with no results.
    - to set the SecondEAREJB path in the weblogic start script classpath,with no
    results.
    - to set the SecondEAR classpath at the ejbc -cp option for FirstEAREJBejbc
    compile, with no results again.
    Is there another way to allow my FirstEAREJB to use SecondEAREJB ?

  • ClassCastException calling EJB from EJB (diff  EARs) Urgent please help !!

    Hi,
    I�m trying to call a Remote EJB ( in jdev BBEAN.prj ) from another EJB (in jdev ABEAN.prj) located in a different EAR.
    In JDEVELOPER (oc4j 9.0.3) I also considered BBEAN as a libreary which is included in the ABEAN project.
    So that the ABEAN JAR contains the class definition for the Home and remote interface.
    From the ABEAN bean I call this code:
    DO ()
    private static Context getInitialContext() throws NamingException
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "manager");
    env.put(Context.PROVIDER_URL, "ormi://GSARNO-1/BBean");
    return new InitialContext(env);
    BBeanHome BBeanHome = (BBeanHome)PortableRemoteObject.narrow(context.lookup("BBean"), BBeanHome.class);
    BBean bBean;
    ������������..
    After having deployed both projects I then run a client (Calling the Do function).
    Doing so I keep receiving the following error when calling narrow.
    java.lang.ClassCastException
    java.lang.Object com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
    PortableRemoteObject.java:296
    java.lang.Object javax.rmi.PortableRemoteObject.narrow(java.lang.Object, java.lang.Class)
    PortableRemoteObject.java:137
    java.lang.String mypackage1.impl.MySessionEJBBean.Do()
    MySessionEJBBean.java:39
    java.lang.String MySessionEJB_StatelessSessionBeanWrapper6.Do()
    MySessionEJB_StatelessSessionBeanWrapper6.java:85
    java.lang.Object java.lang.reflect.Method.invoke(java.lang.Object, java.lang.Object[])
    native code
    void com.evermind.server.rmi.RMICallHandler.run(java.lang.Thread)
    RMICallHandler.java:119
    void com.evermind.server.rmi.RMICallHandler.run()
    RMICallHandler.java:48
    void EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run()
    PooledExecutor.java:803
    void java.lang.Thread.run()
    Thread.java:484
    Can anyone help ?
    What should I do to call remote e/o local interfaces located on different EARs ?
    I�m using OC4J 9.0.3

    Hi Giuseppe,
    If both EAR files are in the same OC4J instance you do not have to use RMIInitialContextFactory to invoke the EJB. You have to do the following:
    In OC4J
    1) Make the BBEAN as the parent for ABEAN application defined in the server.xml as follows:
    application name="ABEAN" path="../applications/abean.ear" parent="BBEAN" auto-start="true" />
    2)
    You can define ejb-ref or ejb-local-ref in the deployment descriptor of your application
    3) You can use the default InitialContext to lookup your EJB as if both EJBs are in the same application
    regards
    Debu

  • Call EJB from Start Up class

    I'm using OC4J 10.1.3 Standalone.
    I have a requirement to initialize web services and configuration parameters during app server start up.
    Accordingly,I planned to call a EJB 2.0 stateless session bean from a StartUp class.
    The ejb is responsible for initializing some configurations and web services.The ejb is dependent on some other classes which are present as utility jars .
    However,I cannot somehow figure out how to refer the EJB from my startup class because the EAR which contains the EJB jar is in a child loader to that containing the startup class.
    Please guide me!! Please suggest if some alternative approach could be taken to suffice my requirement.
    TIA

    Avi, I was just waiting for the "servlet hack".
    I really prefer the application client way, much cleaner, no servlet container needed, and could be tested outside the container.
    --olaf                                                                                                                                                                                                                                                                                                                                                                                       

  • Call ejb from another class?

    there are some codes form someone I dont understand, can anyone help me out ?
    the class Call will run on the same VM as the CMP entity bean Subscriber. what I am not sure is the call in method f2() , i.e. s.setName() will really wirte data to databank, since the lookup was done in getScriber(), and not visible in f2()!
    Am I right ?
    public class Call {
    pubic void f1(){
    Context jndiContext = new InitialContext();
    public void f2 (){
    Subscriber s = getSubscriber(); // 1
    s.setName(); // 2
    private Subscriber getSubscriber(){
    SubscriberHome sHome = (Subscriber)jndiLookup("SubscriberEJB"); // 3
    Subscriber sb = sHome.fineByPrimaryKey(1);
    }

    call in method f2() , i.e. s.setName() will really
    wirte data to databank, since the lookup was done in
    getScriber(), and not visible in f2()!Can't say this for sure, unless I have a look into the setName() method. It doesn't seem to be taking any argument, and that's certainly not the same as setName(String name). It might be actually doing something meaningful. Better take a closer look.
    public class Call {
    pubic void f1(){
    Context jndiContext = new InitialContext();
    public void f2 (){
    Subscriber s = getSubscriber(); // 1
    s.setName(); // 2
    private Subscriber getSubscriber(){
    SubscriberHome sHome =
    (Subscriber)jndiLookup("SubscriberEJB"); // 3
    Subscriber sb = sHome.fineByPrimaryKey(1);
    }Rich.

  • Connecting to Remote EJB from Servlet in same application

    Please help!
    I was able to connect to SessionBeans and EJB from my sample java client in OCJ4 but when I try to do same thing from my web application using servlets, I get the below NullPointerException error.
    The JNDI lookup works fine using java client but difficult from a servlet.
    I am sure there is something I am missing.
    Thanks
    This is what I do in the servlet:
    public void init() throws ServletException, NamingException, CreateException, RemoteException
    Context jndiContext = getInitialContext();
    SessionCartEJBHome home = (SessionCartEJBHome)jndiContext.lookup("SessionCartEJBBean");
    sessionEJB = null;
    try{
    sessionEJB = (SessionCartEJB) home.create();
    }catch (Exception e)
    e.printStackTrace();
    private static Context getInitialContext() throws NamingException
    Hashtable env = new Hashtable();
    // Standalone OC4J connection details
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    env.put(Context.SECURITY_PRINCIPAL, "admin");
    env.put(Context.SECURITY_CREDENTIALS, "admin");
    env.put(Context.PROVIDER_URL, "ormi://Princeton/ejb1");
    return new InitialContext(env);
    And when I call the following procedure, it blow up at the line sessionEJB.getLineItem(new Long(1304));
    sessionEJB is a class variable.
    void processCatalogPage(HttpServletRequest request,
    HttpServletResponse response,
    ActionMapping mapping,
    HttpSession session
    throws ServletException, IOException , Exception, FinderException{
    try {
    ActionForward actFor = null;
    String itemId = request.getParameter("id");
    if ( itemId != null ) {
    String[] itemIds = new String[1];
    itemIds[0] = itemId;
    sessionEJB.getLineItem(new Long(1304));
    actFor = mapping.findForward("catalog");
    return (mapping.findForward("success"));
    } catch (Exception ex)
    ex.printStackTrace();
    System.err.println(ex.toString());
    throw new EJBException(ex.toString());
    04/12/11 23:45:24 java.lang.NullPointerException
    04/12/11 23:45:24 at com.alashoofi.Cart.processCatalogPage(Cart.java:187)
    04/12/11 23:45:24 at com.alashoofi.Cart.execute(Cart.java:86)
    04/12/11 23:45:24 at org.apache.struts.action.RequestProcessor.processActi
    onPerform(RequestProcessor.java:484)
    04/12/11 23:45:24 at org.apache.struts.action.RequestProcessor.process(Req
    uestProcessor.java:274)
    04/12/11 23:45:24 at org.apache.struts.action.ActionServlet.process(Action
    Servlet.java:1482)
    04/12/11 23:45:24 at org.apache.struts.action.ActionServlet.doGet(ActionSe
    rvlet.java:507)
    04/12/11 23:45:24 at javax.servlet.http.HttpServlet.service(HttpServlet.ja
    va:740)
    04/12/11 23:45:24 at javax.servlet.http.HttpServlet.service(HttpServlet.ja
    va:853)
    04/12/11 23:45:24 at com.evermind.server.http.ServletRequestDispatcher.inv
    oke(ServletRequestDispatcher.java:765)
    04/12/11 23:45:24 at com.evermind.server.http.ServletRequestDispatcher.for
    wardInternal(ServletRequestDispatcher.java:317)
    04/12/11 23:45:24 at com.evermind.server.http.HttpRequestHandler.processRe
    quest(HttpRequestHandler.java:790)
    04/12/11 23:45:24 at com.evermind.server.http.HttpRequestHandler.run(HttpR
    equestHandler.java:270)
    04/12/11 23:45:24 at com.evermind.server.http.HttpRequestHandler.run(HttpR
    equestHandler.java:112)
    04/12/11 23:45:24 at com.evermind.util.ReleasableResourcePooledExecutor$My
    Worker.run(ReleasableResourcePooledExecutor.java:192)
    04/12/11 23:45:24 at java.lang.Thread.run(Thread.java:534)
    04/12/11 23:45:24 java.lang.NullPointerException
    Dec 11, 2004 11:45:24 PM org.apache.struts.action.RequestProcessor processExcept
    ion
    WARNING: Unhandled Exception thrown: class javax.ejb.EJBException

    Avi,
    Thanks for your response. I am actually returning a new InitialContext in a function call in the servlet. What I have noticed though is that JDeveloper creates two ear files for the application. One for the ejbs called ejb1.ear and another for the web files webapp1.ear. These are located in the applications subdirectory in OC4J directory.
    I know I have two projects in the application, model and viewController. I am just trying to follow the MVC pattern.
    In short, I don't think the web and the ejbs are in same ear file. I made the web project depend on the ejbs though. There is an option to set such. I don't know how to tell JDeveloper to put them all in one ear file.
    I will appreciate any suggestion.
    Thanks
    Matilda

  • Call EJB from a XI Javamapping

    I have developed a simple EAR which contains a CMP with local and remote interfaces. This cmp may be successfully called using the remote-interface from a client (j2se) project. Now i like to call the same CMP from within a XI JavaMapping. In the execute method i am using the following code:
              InitialContext ctx;
              MeraConfigurationLocal configLocal = null;
              try {               
                   ctx = new InitialContext();
                   Object obj = ctx.lookup("localejbs/mgb.ch/XIMera_EAR/MeraConfigurationBean");
                   if (trace != null)
                        trace.addInfo("Got object from jndi: "+obj);
                   MeraConfigurationLocalHome configHome =     (MeraConfigurationLocalHome)obj;
                   if (configHome !=null) {
                        if (trace != null)
                             trace.addInfo("ConfigurationLocalHome: "+configHome);                                             
                   configLocal = configHome.create();
              } catch (Exception e) {
                   throw new StreamTransformationException(e.getMessage(), e);
              int port = Integer.parseInt(
                        configLocal.ReadParam(MeraResourcePoolDispatcherService.CFG_GENERAL_LISTENER_PORT));
              if (trace != null)
                   trace.addInfo("Got listenerport from localejbs/mgb.ch/XIMera_EAR/MeraConfigBean: "+port);
    after calling ctx.lookup ... i got the following traceentry in xi:
      <Trace level="1" type="T">*** START APPLICATION TRACE ***</Trace>
      <Trace level="2" type="T">Got object from jndi: [email protected]30</Trace>
      <Trace level="1" type="T">*** END APPLICATION TRACE ***</Trace>
    when i try to cast this obj into a MeraConfigurationLocal the system is throwing a ClassCastException

    Hello.
    Check my wiki article:
    http://wiki.sdn.sap.com/wiki/display/stage/SapNetweaverProcessIntegration.CallEjb3.0methodfromJavaclassmappingPI7.1
    (SapNetweaver Process Integration. Call Ejb 3.0 method from Java class mapping PI 7.1)

  • Consume EJB thats in the same EAR as the WAR

    Hey,
    I've been trying to figure out how to consume an EJB from a servlet in a WAR. Both the EJB and WAR are in the same EAR file. What class files am I going to need to put in the WAR's class folder? Am I going to need any if they are in the same EAR? Since they are in the same EAR can I not just access them via an import?
    If sombody could shed some light on the topic I'd appreciate it.
    Thanks.

    I'd actually found my answer after a good nights sleep... I must have been out of it when I asked that question ha ha... and yes, why wouldn't I use EJB's?

  • Calling EJB from XI Mapping

    Hello,
    i try to call a ejb (deployed on the same machine) within a message mapping (userdefined function).
    Is there any documentation how to do the jndi lookup?
    Do i have to pass user credentials in order get working jndi-lookups. Currently i get only sap....UnsatisfiedReferenceImpl Objects from the context.lookup(...).
    As far as i can see there is no binding of my ejb visible for lookups (tracing the content of context.list("")).
    Do i have to load a foo_client.jar into xi or not. Are there other jars to load into xi to get it work .....?
    Thanks
    Peter

    Hello.
    Check my wiki article:
    http://wiki.sdn.sap.com/wiki/display/stage/SapNetweaverProcessIntegration.CallEjb3.0methodfromJavaclassmappingPI7.1
    (SapNetweaver Process Integration. Call Ejb 3.0 method from Java class mapping PI 7.1)

  • Calling EJB from ApplicationLifecycleListener

    In preStop and postStart of ApplicationLifecycleListener (weblogic.application.ApplicationLifecycleListener) implementation, I want to call a method of a Stateless Session Beans, say MyEJB. MyEJB is packaged in same EAR. I do not want to hard-code the Global JNDI name of MyEJB in Listener implementation. How can I lookup MyEJB in listener class and call its method? Is there some way to pass JNDI name of MyEJB in configurable manner?
    Thanks

    Sadly, the only context you can give the applicationlifecyclelistener declaritively is security (run-as):
    http://e-docs.bea.com/wls/docs100/programming/lifecycle.html
    This not only affects ejbs, but also your ability to use a workmanager in the lifecycle listener
    As such, you can take 3 routes:
    1 Ask bea for a feature request for comp:env like resource refs
    2 hard-code global jndi name
    3 lookup global jndi name via jmx at runtime
    The JMX route is a bit of a paste, so please let me know, if you are interested.
    Regards,
    -Adrian

Maybe you are looking for

  • How can i transfer my old files from 3d phone to my new phone 5s

    I got an old phone 3g now I want to transfer my pictures and others to my new cellphone just newly bought apple 15s 16GB gold lte. I tried following the steps written in by the sales representative but I cannot find the find the things she instructed

  • X79A-GD65 (8D) 64GB RAM

    I want build 64gb workstation to work (video, 3d symulation etc) and have question which memory i need to buy becouse i read someone have problems to see all 64gb. I look at MSI RAM support and find 2 cheap options: DDR3 16 GB 2x8GB 1333 MHZ CL9 DUAL

  • How to uninstall

    I need to uninstall Logic Pro 9 from my Macbook Pro.  Heard it was difficult to do, What's involved in the process??

  • I can not transfer the files using blue tooth?

    I can not transfer the video,pictures using the blue tooth. Though mobile display says I pad paired, But I pad is not connected to the mobile, even both places pass key is entered ok.

  • Playlist created on iPod - iTunes Library

    I created a playlist on my iPod using "playlist to go" function, and I want to burn it to CD in iTunes. I use my iPod in MANUAL update mode and can't seem to get the playlist to transfer to iTunes (I know the actual music files can't be copied back t