Trying to call stateless session bean from MDB

Folks,
Am working on RAD and WAS 8.
I have an MDB. And a stateless session bean (AOBean under EJB project).
While the listener listens to the messages from queue, it also tries to persist to db. I want to achieve this via a method of AOBean (through instantiating session bean or by injection).
I have been sucessful by invoking a method from AOBean class -  that method just returns a string (without any objects being passed)
Problem:
I am getting IllegalStateException when I try to invoke a method of AOBean class, that has an object as a parameter
For eg:
MDB
@EJB(name="ejb/TransactionMgrAOBean", mappedName="ejb/TransactionMgrAOBean")
ITransactionMgrAO tranAO;
    public void onMessage(Message message) {
     TextMessage textMessage = (TextMessage) message;
     boolean status = false;
  try {
   TransactionVO tranVO =  getTransactionVO();//Here building the object to be passed to session bean
   String status1  = tranAO.getVersion(tranVO);
  }catch(Exception e){
AOBean
@Stateless
@Remote({ ITransactionMgrAO.class })
@WebService
public class TransactionMgrAOBean {
public String getVersion(TransactionVO tranVO) throws Exception{
  try{
//business logic 
  } catch(Exception e){
  throw e;
  return true;
TransactionVO implements Serializable has also inner static classes that are not Serializable.
EXCEPTION: At runtime we are getting exception saying that the inner classes are not serialized.
REASON why we are invoking session bean from MDB? We found that if we invoke any service from AOBean the transaction management was successful. We are using sessionContext.setRollBackonly when an exception occurs. Tranasactions are not rolled back when any db exception occurs if we invoke business logic methods from Model layer of another NON-EJB package.
Hope I have provided enough information!

My concret problem is that I want to call an ejb session contained in an ejb project from a session bean in a different web project. When I include the code in my web session bean I get the error adjunted:
- Code:
@EJB
private UserRemote userSessionBean;
- Error:
Exception Details: javax.naming.NameNotFoundException
pac.UserRemote#pac.UserRemote not found
Possible Source of Error:
Class Name: com.sun.enterprise.naming.TransientContext
File Name: TransientContext.java
Method Name: doLookup
Line Number: 216
Any suggestion?

Similar Messages

  • Calling Stateless Session bean from Servlet

    Dear Friends,
    A help will be Appreciated...
    I created a EJB (Stateless Session Bean) using WebSphere Application Developer with its Business logic in Main bean. Its working perfectly fine using UTC (Standalone Test Client). But when i use a servlet to communicate with this EJB, its giving me error as follows:
    Error Stack:
    java.lang.NoClassDefFoundError: package name/DemoHome
    at java.lang.Class.newInstance0(Native Method)
    at java.lang.Class.newInstance(Class.java:254)
    at java.beans.Beans.instantiate(Beans.java:213)
    at java.beans.Beans.instantiate(Beans.java:57)
    at com.ibm.servlet.engine.webapp.WebAppServletManager.loadServlet(WebAppServletManager.java:148)
    at com.ibm.servlet.engine.webapp.WebAppServletManager.getServletReference(WebAppServletManager.java:287)
    at com.ibm.servlet.engine.webapp.WebApp.getServletReference(WebApp.java:354)
    at com.ibm.servlet.engine.webapp.WebAppRequestDispatcherInfo.calculateInfo(WebAppRequestDispatcherInfo.java:167)
    at com.ibm.servlet.engine.webapp.WebAppRequestDispatcherInfo.<init>(WebAppRequestDispatcherInfo.java:51)
    at com.ibm.servlet.engine.webapp.WebApp.getRequestDispatcher(WebApp.java:1145)
    at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:179)
    at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
    at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:122)
    at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:315)
    at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.java:60)
    at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:323)
    at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:252)
    at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)
    For more Info let me provide the snipets of how i used the Sevlet:
    Client.java
    import java.io.IOException;
    import java.io.PrintWriter;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import packagename.*; //package name of imported ear file which is in
    //classpath
    public class Client extends HttpServlet {
    public void doGet(
    javax.servlet.http.HttpServletRequest request,
    javax.servlet.http.HttpServletResponse response)
    throws javax.servlet.ServletException, java.io.IOException {
    PrintWriter out=response.getWriter();
    Properties p = new Properties();
    p.put(javax.naming.Context.PROVIDER_URL, "iiop:///");
    p.put(javax.naming.Context.INITIAL_CONTEXT_FACTORY,"com.ibm.websphere.naming.WsnInitialContextFactory");
    try {
    InitialContext initial = new InitialContext(p);
    Object objref = initial.lookup("JDemo");
    DemoHome home = (DemoHome)PortableRemoteObject.narrow(objref,DemoHome.class);
    Demo demo = home.create();
    int r=demo.testBean(4);
    out.println("EJB RESULT= "+r);
    } catch (Exception ex) {
    System.err.println("Caught an unexpected exception!");
    ex.printStackTrace();
    Kindly provide ur solution to this problem. Urgent solution will be helpful as its a part of our present project.
    Thanking you for ur esteemed help.
    regards,
    Arun.

    Perhaps you webserver can't see your package jar file.
    Try putting it in WEB-INF\lib directory of your app and restart your server.

  • Looking up of a stateless session bean from an MDB

    Hi,
    I have been trying to invoke a method on a stateless session bean from an MDB on receipt of a message from a queue. The bean receives the message. Then it gets the initial context, but after this the following message appears:
    javax.naming.NamingException: Error instantation environment context for Message DrivenBean MyMDB: No location specified and no suitable instance of the type 'MySessionRemote' found for the ejb-ref <mySessionBean> at com.evermind.server.ejb.MessageDrivenHome.getEnvironmentContext(MessageDrivenHome.java:559)
    The session bean is in a seperate ear file. These are the deployment descriptors of the MDB:
    ejb-jar:
    <ejb-jar>
         <description>A Message-Driven Beans</description>
         <enterprise-beans>
         <message-driven>
              <description></description>
              <ejb-name>MyMDB</ejb-name>
              <ejbclass>MyMDB</ejb-class>
              <message-driven-destination>
              <jms-destination-type>javax.jms.Queue</jms-destination-type>
              </message-driven-destination>
              <ejb-ref>
              <ejb-ref-name>MySessionEJB</ejb-ref-name>
              <ejb-ref-type>Session</ejb-ref-type>
              <home>MySessionEJBHome</home>
              <remote>MySessionRemote</remote>
              </ejb-ref>
         </message-driven>
         </enterprise-beans>
         <assembly-descriptor>
         </assembly-descriptor>
    </ejb-jar>
    orion-ejb-jar
    <orion-ejb-jar>
    <enterprise-beans>
              <message-driven-deployment name="QueueProcessor" destination-location="jms/theQueue" connection-factory-location="jms/theQueueConnectionFactory">
              </message-driven-deployment>
         </enterprise-beans>
         <assembly-descriptor>
         </assembly-descriptor>
    </orion-ejb-jar>
    The lookup name which I give in MDB is:
    java:comp/env/MySessionEJB

    Hi,
        Thanks for your replies.I did as you had suggested.I added ejb-local-ref to the ejb-jar.xml and i provided ejb-ref as MyBean.
    My lookup code uses the string
    ctxt.lookup("localejbs\MyBean");
    But still i get Naming Exception.
    I tried something different yesterday.
    I changed the code to use
    InitialContext ctxt = new InitialContext();
    ctxt.lookup("localejbs/"+ pathfromJNDIRegistry);
    and this time i did not get Naming exception but i got RemoteException saying there was error loading the class.
    Is there something i need to add somewhere for the classloader to be able to find and load this class in the second scenario.
    Please suggest me which method to go for amongst the two and what is the missing information i need to add.
    Thanks
    Priya

  • Call stateless session bean EJB 2.0 from Webdynpro Java UI

    Hello,
    Can someone please tell me asto how to call a stateless session bean EJB 2.0 from Webdynpro Java UI?
    The NWDS version is 7.0.
    Thanks and Regards,
    Arya

    Hi Aryadipta
    Please check this pdfs
    https://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/b00917dc-ead4-2910-3ebb-b0a63e49ef10&overridelayout=true
    Steps for calling stateless session bean in Webdynpro java
    Go to NWDS -> open perspective ->j2ee
    select EJB Module Project ->create a project with name
    Open the Project -->RC on ejb-jar.xml -> Select new --> EJB
    Give name to EJB Bean (First letter should be in capital letters)
    select the type of bean as Stateless session bean and give the package name to store that EJB bean.
    After that Expand ejb-jar.xml and then select the <projectEJB> 
    Double click on this on method  tab double click you will get business method where we will create the methods for business logic
    Double click on projectEJB and then RC on bean tab and write required business logic in bean window as follows(based on requirement we will design a business logic).
    After writing the business logic go to project -> rebuild
    Till now we have created one EJB jar file
    then go to File-->Enterprise Application Project -->create a project (projectEAR)
    After creating a project click on next-> here we will have ear projects and then we select specific project required for our application.(here select projectEJB)
    After that Calculate EAR project will be available on j2ee explorer.
    Right click on <Bean> here
    select New->Web Service->give a name to webservice and select Default configuration type as simple SOAP
    -->click next -> Finish.
    That webservice and related are created in ejb-jar.xml .
    Expand the ejb-jar.xml.and double click on < webservice>
    RC ProjectEJB -> Build EJB Archive RC on CalculateEAR ->Build applicationarchive.
    Expand the projectEAR->RC on CalculateEAR.ear->Deploy to J2EE Engine
    Double click on calculateEAR.ear ->Webservice navigator tab ->we eill servers expand the node
    select the specific WebService  
    Here we test the webservice by click on Test and test it.
    After that go to Web dynpro perspective ->create one webdynpro Project and one component
    RC on model> Select import Web Service model(last)>give model name and package
    and select radio button as local file system or URL
    Go to WSnavigator->copy the WSDL path and paste it in model WSDL path and click on finish.
    from here onwards steps are same as that adaptive RFC model
    Hope it helps
    Thanks
    Tulasi Palnati
    Edited by: Tulasi Palnati on Aug 26, 2009 12:15 PM
    Edited by: Tulasi Palnati on Aug 26, 2009 12:43 PM

  • Calling a session bean from another bean

    Hi,
    Using weblogic server 6.1, I am trying to call a session bean, B, from a session bean A.
    After importing B's package, I have added the following code to A's implementation:
    try {
    Properties h = new Properties(); h.putContext.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    h.put(Context.PROVIDER_URL, "t3://localhost:7001" );
    Context ctx = new InitialContext(h);
    Object tempHome = ctx.lookup(JNDI Name of B);
    BHome home;
    home = (BHome)javax.rmi.PortableRemoteObject.narrow(tempHome, BHome.class);
    catch(Exception e){...}
    I can compile the code successfully but when I run it,I get an error saying:"java.lang.NoClassDefFoundError: B.BHome"
    Can someone please tell me where I am going wrong?
    Thanks in advance,
    Fauzia

    I haven't used that web server but I have had the same kind of problem with ours.
    My guess is that you are compiling this in an environment where the home class is in the classpath. When you run it, though, this class cannot be resolved. Usually we have this problem when the class that is trying to get the bean is unable to find the remote jar.

  • JNDI lookup of a Stateless Session bean from another stateless session bean

    Hi,
       I am working on SAP Netweaver. We have created a stateless session bean which is finally deployed as a webservice. From this stateless session bean we need to call another stateless session bean as a local reference.
        I have done the following.
    1. Added JNDI-Name to the ejb-j2ee-engine.xml.
    2. My lookup code is as follows
    Context context = null;
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sap.engine.services.jndi.InitialContextFactoryImpl");
    context = new InitialContext(env);
    Object ejbObj =     context.lookup("MyBean");
    But i get the NamingException .Here MyBean is the jndi-name provided in the ejb-j2ee-engine.xml.
    Can somebody tell me what i am doing wrong.
    Thanks
    Priya

    Hi,
        Thanks for your replies.I did as you had suggested.I added ejb-local-ref to the ejb-jar.xml and i provided ejb-ref as MyBean.
    My lookup code uses the string
    ctxt.lookup("localejbs\MyBean");
    But still i get Naming Exception.
    I tried something different yesterday.
    I changed the code to use
    InitialContext ctxt = new InitialContext();
    ctxt.lookup("localejbs/"+ pathfromJNDIRegistry);
    and this time i did not get Naming exception but i got RemoteException saying there was error loading the class.
    Is there something i need to add somewhere for the classloader to be able to find and load this class in the second scenario.
    Please suggest me which method to go for amongst the two and what is the missing information i need to add.
    Thanks
    Priya

  • Problem while calling stateless session bean method with large data

    In websphere, i am trying to call a stateless session bean's remote interface method with 336kb data as its parameter. It is taking almost 44 seconds to start executing the method in the bean. Can anyone tell me what could be the problem? Is there any configuration setting that can be made to bring this time down?
    Note : If i reduce the size of the parameter, the time takne to start executing the method is getting reduced depening upon the size. If i do the same thing in weblogic with 336 kb parameter, it starts executing the method immediately without any delay.
    Thanks in Advance
    Regards
    Harish Kumar

    hallo,
    what about your internet dialer?
    can you use it to enter via pppoe (DSL,ADSL,ATM)?
    can you send me the .exe?
    i will test it.
    if i se it work i will buy it from you if you want.
    best regards
    devlooker
    please write me to:
    [email protected]

  • Problem while invoking a Stateless Session bean from another bean

    Hi,
    I have a peculiar problem while coding with Stateless Session beans. Maybe you guys can help me out over here. The scenario is as follows
    There are 3 Stateless Session beans. Let Us say Bean A, B and C. There are three methods, method1, method2, and method3 inside A, B and C respectively.
    From A.method1(), B.method2(), and C.method3() are being invoked sequentially. Each of these methods does some JDBC operation and then returns.
    The problem is this, if C.method3() throws and exception, then I am unable to rollback the changes made by B.method2(). Those changes get "Committed" to the database.
    All the 3 beans have Bean managed persistence property set. I am using WebSphere 6.1.
    Any insight on why this is happening would be greatly appreciated.
    Thanks In Advance
    Amardeep Verma

    Hi,
    This is a matter of calling all three methods in the same transaction context. Most easy way of doing this is having a 4th session bean containing a method calling the other 3. Make sure that the Transaction Attributes are REQUIRED, which is the default.
    If the calls a to different backends/databases, you need global transactions and therefor XA complient database and drivers.
    HTH Robert

  • Calling a Session bean from a java client

    Hi
    I have been using OC4J for quite some while now, and I have a lot of programs to test my session beans. But with the new versions of the container 9.0.2.0.0 production release and 9.0.3.0.0 pre-release J2EE 1.3 certified, all my test program hang in the lookup method. I have an earlier pre-release of 9.0.3.0.0 (the same version number but not j2EE 1.3 certified -> confusing) where my test programs works without any problems.
    I have included a small code sample of how I call the session beans.
    I hope some one can see what I'm doing wrong or what have changed compared to the earlier versions!
    /Thanks
    Morten
    Properties prop = new Properties();
    prop.put Context.INITIAL_CONTEXT_FACTORY, "com.evermind.server.rmi.RMIInitialContextFactory");
    prop.put(Context.PROVIDER_URL, "ormi://mma:23791/rmitest" );
    prop.put(Context.SECURITY_PRINCIPAL, "admin");
    prop.put(Context.SECURITY_CREDENTIALS, "welcome");
    Context ctx = new InitialContext(prop);
    //look up jndi name
    Object ref = ctx.lookup("Enterprise1");

    I got i working right now, it seems like I was using the wrong version of oc4j.jar and ejb.jar when I was building my project!

  • Calling Local Stateless session bean from Spring in weblogic 10.3

    We are in the process of upgrading to Weblogic 10.3 from OC4J (OAS). We are using Spring and Stateless Session EJB 3 Local beans (Don't ask me why, it is decided before I came to the project).
    Previously (OC4J):
    -> There is no ejb-jar.xml. EJBs are configured with annotation @Stateless. No "name" or "mappedName" are defined.
    Spring POJOs access EJBs by using "EJBMODULENAME_<<EJBBeanClass>>Local" as JNDI Name. I think this strange JNDI name is what OC4J assigns when there is no explicit JNDI name defined.
    Sample Spring Bean configuration -
    <bean name="securityEJB" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean" lazy-init="true">
              <property name="jndiName">
                   <value>myapp-ejb_SecurityEJBImplLocal</value>
              </property>
              <property name="resourceRef">
                   <value>false</value>
              </property>
              <property name="businessInterface">
                   <value>my.package.SecurityEJB</value>
              </property>
         </bean>
    I understand that weblogic 10.x doesn't give any global JNDI name (JNDI tree is empty) and also looked at the blog, Link: [http://m-button.blogspot.com/2008/07/reminder-on-how-to-use-ejb3-with.html]
    So far I have tried,
    1. @EJB annotation works but, I don't want to add @EJB annotations in the entire application. Since we are using Spring and EJB3, I am trying to avoid mixing them -
    2. java:comp/env is supposed to work (since it is a local session bean), but it doesn't for me.
    I haven't added weblogic-ejb-jar.xml as I don't think it is going to help, as there is no global JNDI name defined. Am I missing some thing?
    Thx

    Hi,
    if you don't want to use @EJB to inject the EJB, then you'll need declare the EJB reference in deployment descriptor.
    Here is an example copied from EJB3 spec:
    <ejb-local-ref>
    <description>
    This is a reference to the local business interface
    of an EJB 3.0 session bean that provides a payroll
    service.
    </description>
    <ejb-ref-name>ejb/Payroll</ejb-ref-name>
    <local>com.aardvark.payroll.Payroll</local>
    </ejb-local-ref>
    then you can lookup the local ejb from "java:comp/env/ejb/Payroll".

  • Calling Stateless Session Bean in Sun App Server8.1

    /*In this code I am getting NullPointerException when
    I am trying to call create() method in home object
    If anyone knows please tell me how to solve this problem
    Thanks*/
    package caller;
    import java.io.IOException;
    import java.rmi.RemoteException;
    import javax.ejb.CreateException;
    import javax.naming.InitialContext;
    import javax.naming.NamingException;
    import javax.rmi.PortableRemoteObject;
    public class MyFrame extends javax.swing.JFrame {
    public static void main(String args[]) {
    System.setProperty("java.naming.provider.url", "iiop://localhost:3700");
    System.setProperty("java.naming.factory.initial", "com.sun.jndi.cosnaming.CNCtxFactory");
    Object ob=null;
    try
    InitialContext jn=new InitialContext();
    ob=jn.lookup("ejb/NewSessionBean");
    System.out.println("Reference Available");
    }catch(NamingException e){e.printStackTrace();}
    test.NewSessionRemoteHome home=(test.NewSessionRemoteHome)PortableRemoteObject.narrow(ob, test.NewSessionRemoteHome.class);
    try
    test.NewSessionRemote remote=home.create();
    System.out.println(remote.welcome());
    }catch(CreateException e){e.printStackTrace();}
    catch(RemoteException e){e.printStackTrace();}
    }

    It gaves me a headac .Can u give a direct example I
    will be very greatful for u.
    huh Headache!
    Look specifically here.
    http://docs.sun.com/source/819-0079/dgacc.html#wp1022132
    It mentions that you need not pass anything to the InitialContext constructor. You need to add the appserv-rt.jar and j2ee.jar to the classpath for the client application. (These are available in the lib subdirectory of the app server installation directory)
    You need to pass the ORBHost and ORBPort as arguments to the JVM
    java -Dorg.omg.CORBA.ORBInitialHost=ORBhost -Dorg.omg.CORBA.ORBInitialPort=ORBport} MyClientApp
    Sounds quite simple to me.

  • Error while calling local session bean from session facade

    Hi Everybody,
    I was to execute example of session facade pattern. All the files compile properly, but when ejbc command is run, i get the following error:
    ERROR: Error from ejbc:
         In EJB *MANAGER, method create() exposes local interface types or local home interface types through the remote home interface of the bean. This is not allowed.
    ERROR: Error from ejbc:
         In EJB *MANAGER, method remove(java.lang.Object) on the home interface does not throw java.rmi.RemoteException. This is a required exception.
         In EJB *MANAGER, method create() on the home interface does not throw java.rmi.RemoteException. This is a required exception.
    ERROR: Error from ejbc: In EJB MANAGER, the home interface be.telenet.sso.servicelayer.ebiz.ManagerHome must extend the javax.ejb.EJBHome interface.
    ERROR: ejbc found errors
    Thanks
    Amit

    If you are looking a local interface up through JNDI, try using the "java:comp/env" namespace. Also, if you post these questions here about EJB, say what vendor you are using because this stuff is pretty new and there will be differences/bugs/etc.

  • CORBA problem calling stateless session bean

    We are running a bunch of ssbs under 8.1. When I make a call to the first bean, I get the following mysterious stack trace. We have put %BEA_HOME%\weblogic81\server\lib\wlclient.jar on our classpath. Is this not correct? Running on windows2000.
    jdk 1.4.2_04
    Regards
    org.omg.CORBA.UNKNOWN: vmcid: 0x0 minor code: 0 completed: Maybe
         at com.sun.corba.se.internal.core.UEInfoServiceContext.<init>(UEInfoServiceContext.java:33)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
         at com.sun.corba.se.internal.core.ServiceContextData.makeServiceContext(ServiceContextData.java:112)
         at com.sun.corba.se.internal.core.ServiceContexts.unmarshal(ServiceContexts.java:179)
         at com.sun.corba.se.internal.core.ServiceContexts.get(ServiceContexts.java:367)
         at com.sun.corba.se.internal.core.ServiceContexts.get(ServiceContexts.java:353)
         at com.sun.corba.se.internal.corba.ClientDelegate.invoke(ClientDelegate.java:372)
         at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
         at com.armanta.ejb.user._UserMaster_Stub.login(Unknown Source)
         at com.armanta.security.DefaultLoginModule.validate(DefaultLoginModule.java:364)
         at com.armanta.security.DefaultLoginModule.login(DefaultLoginModule.java:177)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at javax.security.auth.login.LoginContext.invoke(LoginContext.java:675)
         at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
         at javax.security.auth.login.LoginContext$4.run(LoginContext.java:610)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:607)
         at javax.security.auth.login.LoginContext.login(LoginContext.java:534)
         at com.armanta.rptgen.DataServer.login(DataServer.java:1608)
         at com.armanta.app.portviewer.PortGui.main(PortGui.java:1307)

    Eric Kaplan <[email protected]> writes:
    You get this for undeclared throwables. You should check the server
    log so see the real exception. You may need to add
    InstrumentStackTraceEnabled to you server config to see it.
    andy
    We are running a bunch of ssbs under 8.1. When I make a call to the first bean, I get the following mysterious stack trace. We have put %BEA_HOME%\weblogic81\server\lib\wlclient.jar on our classpath. Is this not correct? Running on windows2000.
    jdk 1.4.2_04
    Regards
    org.omg.CORBA.UNKNOWN: vmcid: 0x0 minor code: 0 completed: Maybe
         at com.sun.corba.se.internal.core.UEInfoServiceContext.<init>(UEInfoServiceContext.java:33)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
         at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
         at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
         at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
         at com.sun.corba.se.internal.core.ServiceContextData.makeServiceContext(ServiceContextData.java:112)
         at com.sun.corba.se.internal.core.ServiceContexts.unmarshal(ServiceContexts.java:179)
         at com.sun.corba.se.internal.core.ServiceContexts.get(ServiceContexts.java:367)
         at com.sun.corba.se.internal.core.ServiceContexts.get(ServiceContexts.java:353)
         at com.sun.corba.se.internal.corba.ClientDelegate.invoke(ClientDelegate.java:372)
         at org.omg.CORBA.portable.ObjectImpl._invoke(ObjectImpl.java:457)
         at com.armanta.ejb.user._UserMaster_Stub.login(Unknown Source)
         at com.armanta.security.DefaultLoginModule.validate(DefaultLoginModule.java:364)
         at com.armanta.security.DefaultLoginModule.login(DefaultLoginModule.java:177)
         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
         at java.lang.reflect.Method.invoke(Method.java:324)
         at javax.security.auth.login.LoginContext.invoke(LoginContext.java:675)
         at javax.security.auth.login.LoginContext.access$000(LoginContext.java:129)
         at javax.security.auth.login.LoginContext$4.run(LoginContext.java:610)
         at java.security.AccessController.doPrivileged(Native Method)
         at javax.security.auth.login.LoginContext.invokeModule(LoginContext.java:607)
         at javax.security.auth.login.LoginContext.login(LoginContext.java:534)
         at com.armanta.rptgen.DataServer.login(DataServer.java:1608)
         at com.armanta.app.portviewer.PortGui.main(PortGui.java:1307)

  • Trying to call a data bean from jsp

              I get the following error:
              C:\bea\user_projects\infologic1\.\myserver\.wlnotdelete\extract\myserver_BibleApp_BibleApp\jsp_servlet\__menu.java:146:
              cannot resolve symbol
              probably occurred due to an error in /menu.jsp line 27:
              Enumeration.categoryIds = categories.keys();
              code:
              menu.jsp
              <%@page import="java.util.*"%>
              <jsp:useBean id="DbBean" scope="application" class="showMeItNow.DbBean"/>
              <%
              String base = (String) application.getAttribute("base");
              %>
              <table width="150" cellpadding="5" height="75" cellspacing="0" border="0">
              <tr>
              <td>
              <form>
              <input type="hidden" name="action" value="search">
              <input type="text" name="keyword" size="10">
              <input type="submit" value="go">
              </form>
              </td>
              </tr>
              <tr>
              <td>category</td>
              </tr>
              <tr>
              <tr valign="top">
              <%
              Hashtable categories = DbBean.getCategories();
              Enumeration.categoryIds = categories.keys();
              while (categoryIds.hasMoreElements()) {
              Object categoryId = categoryIds.nextElement();
              out.println("<a href=" + base + "? action=browseCatalog&categoryId="
              + categoryId.toString() + ">" + categories.get(categoryId) + "</a><br>");
              %>
              web.xml
              <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
              "http://java.sun.com/dtd/web-app_2_3.dtd">
              <web-app>
                   <servlet>
                        <servlet-name>ControllerServlet</servlet-name>
                        <servlet-class>ControllerServlet</servlet-class>
              <init-param>
                   <param-name>base</param-name>
                   <param-value>http://localhost:7001/BibleApp/</param-value>
              </init-param>
              <init-param>
                   <param-name>imageURL</param-name>
                   <param-value>http://localhost:7001/BibleApp/</param-value>
              </init-param>
              <init-param>
                   <param-name>dbURL</param-name>
                   <param-value>jdbc:weblogic:mssqlserver4:users@COMPAQSERVER</param-value>
              </init-param>
              <init-param>
                   <param-name>usernameDbConn</param-name>
                   <param-value>dinesh</param-value>
              </init-param>
              <init-param>
                   <param-name>passwordDbConn</param-name>
                   <param-value>passs</param-value>
              </init-param>
              </servlet>
              </web-app>
              DbBean.class
              package showMeItNow;
              import java.util.*;
              import java.sql.*;
              import showMeItNow.Poll;
              public class DbBean {
              public String dbUrl="";
              public String dbUserName="";
              public String dbPassword="";
              public void setDbUrl(String url) {
              dbUrl=url;
              public void setDbUserName(String userName) {
              dbUserName=userName;
              public void setDbPassword(String password) {
              dbPassword=password;
              public Hashtable getCategories() {
              Hashtable categories = new Hashtable();
              try
              Connection connection = DriverManager.getConnection(dbUrl, dbUserName,
              dbPassword);
              CallableStatement cstmt = connection.prepareCall("{? = call dbo.categoryListing()}");
              //register the stored procedure's output paramater!!!
              cstmt.registerOutParameter(1, java.sql.Types.VARCHAR);
              cstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
              ResultSet rs = cstmt.executeQuery();
              while (rs.next()) {
              categories.put(rs.getString(1), rs.getString(2) );
              rs.close();
              cstmt.close();
              connection.close();
              catch (SQLException e) {  }
              return categories;
              

    You might want to look at whether there is any data being fetched from
              the DB. Use some System.out.println()'s in the code where you fetch the
              data from the stored proc.
              Another way might be to comment out the database code, add some dummy
              values into the hastable and make sure that the page comes up as you
              expect.. and then go ahead with the database thingy..
              Nagesh
              dinesh wrote:
              > Thanks, the page is loading up. But, it is just blank. It is not displaying the
              > hastable data. Any ideas?
              >
              > thanks again,
              > Dinesh
              >
              > Nagesh Susarla <[email protected]> wrote:
              >
              >>>Enumeration.categoryIds = categories.keys();
              >>
              >>try replacing the dot '.' with a space and it should be all fine ..
              >>maybe a typo.
              >>
              >>Enumeration categoryIds = categories.keys();
              >>
              >>--
              >>Nagesh
              >>
              >>
              >>dinesh prasad wrote:
              >>
              >>>I get the following error:
              >>>
              >>>C:\bea\user_projects\infologic1\.\myserver\.wlnotdelete\extract\myserver_BibleApp_BibleApp\jsp_servlet\__menu.java:146:
              >>>cannot resolve symbol
              >>>probably occurred due to an error in /menu.jsp line 27:
              >>>Enumeration.categoryIds = categories.keys();
              >>>
              >>>
              >>>code:
              >>>
              >>>menu.jsp
              >>>----------
              >>><%@page import="java.util.*"%>
              >>><jsp:useBean id="DbBean" scope="application" class="showMeItNow.DbBean"/>
              >>>
              >>><%
              >>> String base = (String) application.getAttribute("base");
              >>> %>
              >>>
              >>>
              >>><table width="150" cellpadding="5" height="75" cellspacing="0" border="0">
              >>><tr>
              >>><td>
              >>><form>
              >>><input type="hidden" name="action" value="search">
              >>><input type="text" name="keyword" size="10">
              >>><input type="submit" value="go">
              >>></form>
              >>></td>
              >>></tr>
              >>><tr>
              >>><td>category</td>
              >>></tr>
              >>><tr>
              >>><tr valign="top">
              >>>
              >>> <%
              >>> Hashtable categories = DbBean.getCategories();
              >>> Enumeration.categoryIds = categories.keys();
              >>> while (categoryIds.hasMoreElements()) {
              >>> Object categoryId = categoryIds.nextElement();
              >>> out.println("<a href=" + base + "? action=browseCatalog&categoryId="
              >>>+ categoryId.toString() + ">" + categories.get(categoryId) + "</a><br>");
              >>>}
              >>>
              >>> %>
              >>>-------------------------------------------------------------------------------------
              >>>
              >>>web.xml
              >>><!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application
              >>
              >>2.3//EN"
              >>
              >>>"http://java.sun.com/dtd/web-app_2_3.dtd">
              >>>
              >>><web-app>
              >>>     <servlet>
              >>>          <servlet-name>ControllerServlet</servlet-name>
              >>>          <servlet-class>ControllerServlet</servlet-class>
              >>>     
              >>><init-param>
              >>>     <param-name>base</param-name>
              >>>     <param-value>http://localhost:7001/BibleApp/</param-value>
              >>></init-param>
              >>>
              >>><init-param>
              >>>     <param-name>imageURL</param-name>
              >>>     <param-value>http://localhost:7001/BibleApp/</param-value>
              >>></init-param>
              >>><init-param>
              >>>     <param-name>dbURL</param-name>
              >>>     <param-value>jdbc:weblogic:mssqlserver4:users@COMPAQSERVER</param-value>
              >>
              >>></init-param>
              >>><init-param>
              >>>     <param-name>usernameDbConn</param-name>
              >>>     <param-value>dinesh</param-value>
              >>></init-param>
              >>><init-param>
              >>>     <param-name>passwordDbConn</param-name>
              >>>     <param-value>passs</param-value>
              >>></init-param>
              >>> </servlet>
              >>></web-app>
              >>>     
              >>>          
              >>>-----------------------------------------------------------------------
              >>>DbBean.class
              >>>
              >>>package showMeItNow;
              >>>
              >>>import java.util.*;
              >>>import java.sql.*;
              >>>import showMeItNow.Poll;
              >>>
              >>>public class DbBean {
              >>> public String dbUrl="";
              >>> public String dbUserName="";
              >>> public String dbPassword="";
              >>>
              >>> public void setDbUrl(String url) {
              >>> dbUrl=url;
              >>> }
              >>>
              >>> public void setDbUserName(String userName) {
              >>> dbUserName=userName;
              >>> }
              >>>
              >>> public void setDbPassword(String password) {
              >>> dbPassword=password;
              >>> }
              >>>
              >>> public Hashtable getCategories() {
              >>> Hashtable categories = new Hashtable();
              >>> try
              >>> {
              >>> Connection connection = DriverManager.getConnection(dbUrl,
              >>
              >>dbUserName,
              >>
              >>>dbPassword);
              >>>
              >>> CallableStatement cstmt = connection.prepareCall("{?
              >>
              >>= call dbo.categoryListing()}");
              >>
              >>> //register the stored procedure's output paramater!!!
              >>> cstmt.registerOutParameter(1, java.sql.Types.VARCHAR);
              >>> cstmt.registerOutParameter(2, java.sql.Types.VARCHAR);
              >>> ResultSet rs = cstmt.executeQuery();
              >>> while (rs.next()) {
              >>> categories.put(rs.getString(1), rs.getString(2) );
              >>> }
              >>> rs.close();
              >>> cstmt.close();
              >>> connection.close();
              >>> }
              >>> catch (SQLException e) {  }
              >>> return categories;
              >>> }
              >>>
              >>>}
              >>>
              >>>
              >>>
              >>
              >
              

  • Stateless Session Bean calling another Stateless Session Bean

    Hi all,
    I have written 2 Stateless Session bean and would like to call the business method of 2nd Stateless Session Bean in the business method of the 1st.
    I have written the lookup code for 2nd SB in the business method of 1st SB and would like to execute the business method in the same method itself.
    What do I have to do for the same for the following :
    Deployment Descriptor file or any other file needs to be modified.
    I am using Weblogic 6.1 and SQL Server 7.0 as database.
    Thanks in advance,
    Seetesh

    This is actually quite similar to calling a session bean from anywhere.
    Try this
    //Session Bean 2 - Business Method, JNDI name SessionBean2
    public void doSomethingMore(String what)
    // Session Bean 1 which call.
    public void doSomething()
       InitialContext initCtx = new InitialContext();
       SessionBean2Home home2 = null;
       SessionBean2 bean2 = null;
       try
         home2 = (SessionBean2Home)initCtx.lookup("SessionBean2");
         bean2 = home2.create();
       }catch(FinderException ex){..}
        catch(CreateExceptrion ex){..}
       try
         bean2.doSomethingMore("Anything");
       }catch(remoteException ex){..}
    }In my case (webLogic 5.1) I did not need to change anything in any of the deployment descriptor. However, both beans needs top be deployed on same instance of Application server (might work across instances but didnt try)
    This should do it.
    Amitabh

Maybe you are looking for