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

Similar Messages

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

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

  • Stateless Session Bean + EJB Question + Jboss

    Hello,
    If I have a stateless session bean on a linux machine and it works locally what do i need to do to access a method in the session bean from a remote windows machine.
    I would like to be able to execute my client jar file on a windows machine and have it access the jboss server on the linux machine. what do i need to do?
    i have the session bean working locally on both windows and linux machine. do i need to to have a JSP/Servlet to access the session bean? can the session bean not be accessed directly? what should my classpath look like? do I need to include extra jar files in my client jar file.?
    Thanks,
    Joyce

    Thanks guys for the help but I am still a little lost.
    My Client windows machine has the client jar file and all the other jar files. This is my client class
    package helloworld.client;
    import javax.naming.Context;
    import javax.naming.InitialContext;
    import java.util.Hashtable;
    import java.util.Properties;
    import helloworld.interfaces.HelloWorldHome;
    import helloworld.interfaces.HelloWorld;
    public class HelloClient
         public static void main(String[] args)
              Hashtable prop = new Hashtable();
              prop.put ("java.naming.factory.url.pkgs","org.jboss.naming:org.jnp.interfaces");
              prop.put ("java.naming.provider.url","jnp://172.16.220.160:1099");
              prop.put ("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
              try
                   Context ctx = new InitialContext(prop);
                   Object obj = ctx.lookup("ejb/helloworld/HelloWorld");
                   System.out.println(obj);
                   HelloWorldHome home = (HelloWorldHome)javax.rmi.PortableRemoteObject.narrow(obj, HelloWorldHome.class);
                   HelloWorld helloWorld = home.create();
                   String str = helloWorld.sayHelloEJB("JOYCE is COOL");
                   System.out.println(str);
                   helloWorld.remove();
              catch(Exception e)
                   e.printStackTrace();
    I get a NullPointer ie the home object is null. The IP address is the IP of the Linux machine that has Jboss running on.
    Questions are:
    1. Do I need to have Tomcat running on my client machine if I am to connect via HTTP? Does this alter my client code.?
    2. My JNDI lookup is what is causing the problem. Does my jboss.xml and my ejb-jar.jar look okay to you.
    jboss.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">
    <jboss>
    <enterprise-beans>
    <session>
    <ejb-name>helloworld/HelloWorld</ejb-name>
    <jndi-name>ejb/helloworld/HelloWorld</jndi-name>
    </session>
    </enterprise-beans>
    <resource-managers>
    </resource-managers>
    </jboss>
    ejb-jar.jar
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">
    <ejb-jar >
    <description>No Description.</description>
    <display-name>Generated by XDoclet</display-name>
    <enterprise-beans>
    <!-- Session Beans -->
    <session >
    <description><![CDATA[No Description.]]></description>
    <ejb-name>helloworld/HelloWorld</ejb-name>
    <home>helloworld.interfaces.HelloWorldHome</home>
    <remote>helloworld.interfaces.HelloWorld</remote>
    <ejb-class>helloworld.session.HelloWorldBean</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Bean</transaction-type>
    </session>
    <!--
    To add session beans that you have deployment descriptor info for, add
    a file to your merge directory called session-beans.xml that contains
    the <session></session> markup for those beans.
    -->
    <!-- Entity Beans -->
    <!--
    To add entity beans that you have deployment descriptor info for, add
    a file to your merge directory called entity-beans.xml that contains
    the <entity></entity> markup for those beans.
    -->
    <!-- Message Driven Beans -->
    <!--
    To add message driven beans that you have deployment descriptor info for, add
    a file to your merge directory called message-driven-beans.xml that contains
    the <message-driven></message-driven> markup for those beans.
    -->
    </enterprise-beans>
    <!-- Relationships -->
    <!-- Assembly Descriptor -->
    <assembly-descriptor >
    <!-- finder permissions -->
    <!-- transactions -->
    <!-- finder transactions -->
    </assembly-descriptor>
    </ejb-jar>
    Do I need RMI ? Do I need to concern myself with CORBA? All Im looking for is a step by step to understanding what I need to configure? Is their some way I can debug?
    Thanks alot,
    Joyce

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

  • How to use jta in toplink and stateless session bean EJB 3.0?

    I have an application with techologies jsf,stateless session bean, adf, toplink
    generated by toplink workbench.
    In web side ı want to use two methods in stateless session bean which are updated
    different tables. I call these methods in my page backing bean.
    I also want to JTA in web side. My first methods is done correctly, but second method has an error. I wanto to rollback all transaction.
    How can ı do that? with using JTA in Toplink...

    Yuichi
    Did you manage to solve this?  I'm doing something similar and seeing the same problem, although they're up to 7.3 SP7.
    Any help greatly appreciated.
    Lewis

  • Reg: calling default desktop page of enterprise portal from webdynpro java

    hi Experts
    Here is an scenario where i need to call enterprise portal desktop from webdynpro java application.
    Actually i have designed a custom Home page in  WDJAVA  and this page i have assigned as default  frame work page in enterprise portal ,so once we logon through the portal URL wewill  be getting this custom home page as default page and when i click on next button it should connect to the predefined  SAP given default frame work page.
    The thing is i am able to see the custom page and the button but when i click on the button it is opening the same custom home page only not able to log on to portal default frame work page.
    My question is how can we connect to the predefined page from the custom home page.
    please share your regarding this scenario...
    regards & Thanks
    Deepika
    Edited by: deepika_indian on Mar 3, 2010 6:05 AM

    hi Experts
    you didnt get my point  i vl give in brief
    1) that at first we are going to enter the portal URL.
    2)we are going give userid and password and click  logon button.
    3)so once we click on that button it should open custom page what we have designed in by using web dynpro java.with in this application we will have next button which should connect to the sap given predefined default desktop page.
    i hope you have got my point.
    and more over where can we get the logon action coding in which par file,if so can you give brief information related to it.
    i changed the themes master rule collection there i have assigned this custom home page ,but when i click on next button it is opening the same custom it is not connecting to the default desktop.i think this is not the write approach.
    please share your knowledge and document also related to it.
    Thanking you
    Deepika.

  • Problem calling a session bean (EJB 3.0)

    Hello,
    I'm new to netbeans and J2EE. I'm using NetBeans 5.5 Beta 2 and sun application server 9 pe.
    I created a new enterprise application and i'm trying to access a Session Bean (Remote and Stateless)
    from the app-client (outside the main class).
    This is the loockup method that was generated by the IDE (Enterprise Resources > Call enterprise bean):
    private ejb.SessionBeanDoenteRemote lookupSessionBeanDoenteBean() {
    try {
    javax.naming.Context c = new javax.naming.InitialContext();
    return (ejb.SessionBeanDoenteRemote) c.lookup("java:comp/env/ejb/SessionBeanDoenteBean");
    catch(javax.naming.NamingException ne) {
    java.util.logging.Logger.getLogger(getClass().getName()).log(java.util.logging.Level.SEVERE,"exception caught" ,ne);
    throw new RuntimeException(ne);
    When I run the application and try to invoke the lookup method my application gets the following exception:
    SEVERE: exception caught
    javax.naming.NameNotFoundException: No object bound to name java:comp/env/ejb/Se
    ssionBeanDoenteBean
    at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.
    java:751)
    at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.j
    ava:156)
    at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at intensivecare.entrada.JDialogEntrada.lookupSessionBeanDoenteBean(JDia
    logEntrada.java:219)
    at intensivecare.entrada.JDialogEntrada.buttonMenuGravarActionPerformed(
    JDialogEntrada.java:79)
    at intensivecare.JDialogWizzard$2.jButtonGravarActionPerformed(JDialogWi
    zzard.java:178)
    at componentes.JTaskPanelMenu$3.actionPerformed(JTaskPanelMenu.java:54)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:18
    49)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.jav
    a:2169)
    Please... can someone help me?

    The portable way to acquire the dependency is through java:comp/env or @EJB. Accessing the
    global namespace directly is not recommended. If you use an ejb-ref, you need to define it
    in the component environment within which you'll be looking up the dependency. So if you're
    looking it up from an Application Client, you'll need to define the ejb-ref in application-client.xml.
    Also, the ejb-ref-name is the portion of the string after java:comp/env. There is no automatic
    "ejb" appended to it. If you do ic.lookup("java:comp/env/foo"), your ejb-ref-name would be "foo".
    You can use @EJB but it can only be defined in certain managed classes such as the
    Application Client main class.
    You can find additional info in our EJB FAQ :
    https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html
    --ken                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Null Pointer Exception in Stateless Session Beans(EJB 3.0)

    I am executing a simple HelloUser example i code session bean interface and implementing session bean class in the EJB project.
    package ejb3inaction.ejb;
    import javax.ejb.Remote;
    @Remote
    public interface HelloUser {                                       
    public void sayHello(String name);
    package ejb3inaction.ejb;
    import javax.ejb.Stateless;
    @Stateless
    public class HelloUserBean implements HelloUser {                  
    public void sayHello(String name) {
    System.out.println("Hello " + name + " welcome to EJB 3 In Action!");
    And in the client project i code this class and add JAR file of the EJB project.
    package ejb3inaction.example;
    import javax.ejb.EJB;
    import ejb3inaction.ejb.*;
    public class HelloUserClient {
    @EJB
    private static HelloUser helloUser;
         public static void main(String[] args) {
    helloUser.sayHello("Curious George");
    System.out.println("Invoked EJB successfully .. see server console for output");
    I am using netbeans 6.0(10 M) and Sun Application server 9.
    it gives NullPointer Exception at the following line...
    helloUser.sayHello("Curious George");
    how i can resolve this error.
    regards,
    deemy

    Well, helloUser is just a null reference, you haven't created an instance of HelloUser to use, hence the NPE

  • Error while Look up session bean (EJB 3.0) in WebDynpro

    hi ,
                 I want to look up session bean inside webdynpro. I hv written following code inside init of component controller. but not able to look up session bean
    try{
                   InitialContext context = new InitialContext();
                   ApplicationFetcherLocal applicationFetcherLocal = null;
                 applicationFetcherLocal = (ApplicationFetcherLocal)context.lookup((ApplicationFetcherLocal.class.getName());
              catch (Exception ex){
                   System.err.println("LookUp Failed\n\n"+ex.getMessage());

    Have you read my latest reply in your other [thread|session bean look up  across DCs in EJB3.0;?
    What's the value of asking the same question again if you don't care about the answer?
    Regards,
    -- Vladimir

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

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

  • EJB: Stateless Session Bean create() Question.

    Lets say I have a stateless session bean that fetches data from my database. The point of the bean is to just do large SQL searches and funnel data back to the client. The prolem I have is that I am somehow fighting memory leaks. Despite having checked the code a number of times, the memory usage on my appserver continues to climb no matter what I do. I have theorized that the problem might be in the way Im using ma DataFetchBean (DFB).
    When I start the client, he obtains a user session. This is a stateful session bean that he uses for almost all communication with the server. Then I call "getDataFetchBean" in the user session which calls DataFetchBeanHome.create(). Then the client holds onto the returned reference, using it for the live of his connection. As he disconnects, he calls remove on the bean.
    Question is this:
    1) Is it better for me to call create() prior to each call to the stateless session bean ?
    2) Do you have any theories on why im loosing memory with this setup?
    TIA
    -- Rob

    1. But I thought you were using a 'stateful session bean'?
    2. For stateless session beans, there is no direct link between a remote reference and an instance of the bean. It is safe to hang on to the remote reference as long as you would like, of course it may go stale if the server dies. You will also find that the create() method does not actually contact the server, so doing it each usage costs very little. So, either way you should be fine.
    3. As for memory leaks, make sure that you are closing all statements, result sets, etc. promptly. These are commonly the problem. Also, use hprof or some other profile tool to determine what types of data you are allocating and (with better tools) what types of data you may be holding on to references to.
    Chuck

  • EJB 3.1new instance of stateless session bean not created on new invocation

    I am using Netbeans 6.8 bundle that comes with JAVA EE 6. I have created a web application then created restful web services and then created few stateless session beans (with local interfaces) that are invoked from restful web services. From the browser, when I call the url with get method, restful web services are being invoked and they in turn calls stateless session beans and does the appropriate business logic. While testing, I observed that for every new url call from the browser, the same bean is being invoked. I tested this by adding a instance variable vector and adding one item ('test") to the vector in bean's method. My understanding is that on every bean's method invocation the vector should have only one item. However, the vector is growing with many "test" items. I am literally confused, not sure this is the way it is supposed to work. I tried to invoke bean's method from restful web service by using both dependency injection and jndi look up, both instances the vector is growing with many "test" items.
    I would really appreciate if some body gives me more insight.

    I appreciate your answers. There is a strong reason for posting this question. Basically, I am using JPA and using stateless session beans to invoke database calls. In the bean I am using the following code for entity manager.
    @PersistenceContext(unitName = "AsgProtocolServerPU")
    private EntityManager em;
    I have noticed very strange scenario while getting records. From the application, I have obtained few records of a table. Then, I manually deleted few records from the table. Very strangely, I have obtained the deleted records during my next call to bean. After 2 hours, I tested the same and did not get those records. This is not consistent.
    I am totally confused. I am just wondering this is happening because I made beans local (not remote) and placed them in the web application (Java EE6 allows this). I am not sure whether this is JPA related issue or beans issue.

  • Jdeveloper (9.0.5.1)- Stateless Session Bean + OC4J  Exception - Urgent Ple

    I have a stateless Session Bean EJBs deployed on the OC4J Application Server that calls this method:
    public String getCurrentTime()
    return ""+ new java.util.Date();
    I try to access it from a client running on the same machine(windows nt).
    DateEJBClient dateEJBClient = new DateEJBClient();
    try
    Context context = getInitialContext();
    DateEJBHome dateEJBHome = (DateEJBHome)PortableRemoteObject.narrow(context.lookup("DateEJB"), DateEJBHome.class);
    DateEJB dateEJB;
    // Use one of the create() methods below to create a new instance
    dateEJB = dateEJBHome.create();
    // Call any of the Remote methods below to access the EJB
    System.out.println("Date & Time >>> "+dateEJB.getCurrentTime());
    catch(Throwable ex)
    Any idea why I get this error?
    com.evermind.server.rmi.OrionRemoteException: jazn.com/admin is not allowed to call this EJB method, check your security settings (method-permission in ejb-jar.xml and security-role-mapping in orion-application.xml).
    at DateEJBHome_StatelessSessionHomeWrapper3.create(DateEJBHome_StatelessSessionHomeWrapper3.java:40)
    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 com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:124)
    at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
    at java.lang.Thread.run(Thread.java:534)
    at connection to localhost/127.0.0.1 as admin
    at DateEJBHome_StatelessSessionHomeWrapper3.create(DateEJBHome_StatelessSessionHomeWrapper3.java:40)
    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 com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:124)
    at com.evermind.server.rmi.RMICallHandler.run(RMICallHandler.java:48)
    at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:186)
    at java.lang.Thread.run(Thread.java:534)
    Process exited with exit code 0.

    I beleive you need the POI jar file in the <ias_home>/j2ee//home/applib directory or in your app severs PATH.

Maybe you are looking for