Enterprise Session Bean Problem

Dear Experts,
I have just installed Netweaver Developer Studio 7.1 Composition Environment and is doing some development on it from the tutorial in the following link
[http://help.sap.com/saphelp_nw04/helpdata/en/c3/679564e11d482f8a706b423f67e56c/content.htm|http://help.sap.com/saphelp_nw04/helpdata/en/c3/679564e11d482f8a706b423f67e56c/content.htm]
I have created a new EJB Project using the Configuration SAP EJB J2EE 1.4 Project and created a new stateless session bean Calculator. 
I finished creating the session bean with all the BUSINESS METHODS, but when I expand the project node Calculator in the J2EE Explorer, I CANNOT see the Calculator.java class.  All other classes such as CalculatorBean.java, CalculatorHome.java, etc are present. 
This is where the problem comes, when I create the JavaBean in the Web Module I will need to access the Calculator.java class and now I cannot access it since it is missing.
Can you please guide me on how to generate the Calculator.java class in the session bean.
Points will be rewarded for correct answers.
Thanks in advance
Edited by: jamison2004 jordan2004 on May 7, 2008 11:16 AM
Edited by: jamison2004 jordan2004 on May 7, 2008 11:25 AM

Hi jamison jordan,
Maybe you check the CE version of the documentation:
[Creating Your First J2EE Application|http://help.sap.com/saphelp_nwce10/helpdata/en/c3/679564e11d482f8a706b423f67e56c/frameset.htm]
kind regards
Stefanie

Similar Messages

  • Static methods in Session Beans problem

    Can a Stateful Session Bean have a static method?
    public static String foo();
    I tried to add a static method to a Stateful Session bean but had two problems:
    When I tried to add the static modifier to the Remote interface:
    static String foo();
    I got the following error message:
    Error(12,17): modifier static not allowed here
    When I tried to compile code calling this function :
    MyClass.foo();
    I got this message:
    Error(795,42): non-static method getNewSuffix(java.lang.String) cannot be referenced from a static context
    Even though a static method was compiled in this class. I assume it can't find the static modifier in the Remote interface which wasn't allowed. Are static methods allowed in EJB's at all?

    dear friend,
    1) Interfaces may not contain static functions!
    2) EJBs doesnt support static methods !
    Maybe you should go and learn more about Java and EJB's ?

  • Multiple session bean problem

    Hi,
    I am developing an admin module to my web app and have created a 2nd session bean to manage data within the admin component of the site just to keep things cleaner and more logical. However there is a problem which I cannot overcome.
    The source code to my main website is located in soulsurfing package. The source code to my admin website is located in soulsurfing.admin package. Inside this package is the java code to my admin web pages and a 2nd session bean called adminSessionBean. So far so good.
    I dropped a database table into my admin page which created a cachedrowset (CustomerRowSet) in my adminSessionBean and a data provider on my admin page (CustomerDataProvider). Ok things are still going well until now.
    There are two main issues i'm facing.
    1. Setting a breakpoint in my code and trying to step through the code line by line (F10) fails whenever the adminSessionBean appears in the line of code. In actuality the system just hangs until I exit debug mode in which the page finishes loading ok. If I step into the code (F11) it still works ok and if there is no breakpoint at all it loads ok too so there is something wrong with the debugger.
    2. Most importantly there is a problem with either the cachedrowset or the data provider because it simply does not return any data from the database. The sql query works fine in both MySQL and when running from creator too so no problem here. If I put a line of code in to capture the sql statement such as String test_var3 = getAdmin$adminSessionBean().getCustomerRowSet().getStatement().toString() a null exception is thrown. However if I ditch the 2nd session bean (adminSessionBean) and run everything exactly the same through the original session bean (SessionBean1) located in soulsurfing package then it all works fine so there must be conflict somewhere with having multiple session beans perhaps in different packages.
    Can anybody help me?
    Below is the java code to my web page that sets and executes the cachedrowset in the prerender method that is failing. Further below that is the code to my 2nd session bean.
    Thanks.
    customer_list.java
    package soulsurfing.admin;
    import com.sun.rave.web.ui.appbase.AbstractPageBean;
    import com.sun.rave.web.ui.component.Body;
    import com.sun.rave.web.ui.component.Form;
    import com.sun.rave.web.ui.component.Head;
    import com.sun.rave.web.ui.component.Html;
    import com.sun.rave.web.ui.component.Link;
    import com.sun.rave.web.ui.component.Page;
    import javax.faces.FacesException;
    import com.sun.rave.web.ui.component.TextField;
    import com.sun.rave.web.ui.component.Button;
    import com.sun.rave.web.ui.component.PageSeparator;
    import com.sun.rave.web.ui.component.StaticText;
    import com.sun.rave.web.ui.component.Table;
    import com.sun.rave.web.ui.component.TableRowGroup;
    import com.sun.rave.web.ui.component.TableColumn;
    import com.sun.data.provider.impl.CachedRowSetDataProvider;
    import com.sun.rave.web.ui.component.MessageGroup;
    import com.sun.rave.web.ui.model.DefaultTableDataProvider;
    public class customer_list extends AbstractPageBean {
        private int __placeholder;
        private void _init() throws Exception {
            customerDataProvider.setCachedRowSet((javax.sql.rowset.CachedRowSet)getValue("#{adminSessionBean.customerRowSet}"));
        private Page page1 = new Page();
        public Page getPage1() {
            return page1;
        public void setPage1(Page p) {
            this.page1 = p;
        private Html html1 = new Html();
        public Html getHtml1() {
            return html1;
        public void setHtml1(Html h) {
            this.html1 = h;
        private Head head1 = new Head();
        public Head getHead1() {
            return head1;
        public void setHead1(Head h) {
            this.head1 = h;
        private Link link1 = new Link();
        public Link getLink1() {
            return link1;
        public void setLink1(Link l) {
            this.link1 = l;
        private Body body1 = new Body();
        public Body getBody1() {
            return body1;
        public void setBody1(Body b) {
            this.body1 = b;
        private Form form1 = new Form();
        public Form getForm1() {
            return form1;
        public void setForm1(Form f) {
            this.form1 = f;
        private TextField textField1 = new TextField();
        public TextField getTextField1() {
            return textField1;
        public void setTextField1(TextField tf) {
            this.textField1 = tf;
        private TextField textField2 = new TextField();
        public TextField getTextField2() {
            return textField2;
        public void setTextField2(TextField tf) {
            this.textField2 = tf;
        private Button button1 = new Button();
        public Button getButton1() {
            return button1;
        public void setButton1(Button b) {
            this.button1 = b;
        private Button button2 = new Button();
        public Button getButton2() {
            return button2;
        public void setButton2(Button b) {
            this.button2 = b;
        private PageSeparator pageSeparator1 = new PageSeparator();
        public PageSeparator getPageSeparator1() {
            return pageSeparator1;
        public void setPageSeparator1(PageSeparator ps) {
            this.pageSeparator1 = ps;
        private StaticText staticText1 = new StaticText();
        public StaticText getStaticText1() {
            return staticText1;
        public void setStaticText1(StaticText st) {
            this.staticText1 = st;
        private StaticText staticText2 = new StaticText();
        public StaticText getStaticText2() {
            return staticText2;
        public void setStaticText2(StaticText st) {
            this.staticText2 = st;
        private Table table1 = new Table();
        public Table getTable1() {
            return table1;
        public void setTable1(Table t) {
            this.table1 = t;
        private TableRowGroup tableRowGroup1 = new TableRowGroup();
        public TableRowGroup getTableRowGroup1() {
            return tableRowGroup1;
        public void setTableRowGroup1(TableRowGroup trg) {
            this.tableRowGroup1 = trg;
        private MessageGroup messageGroup1 = new MessageGroup();
        public MessageGroup getMessageGroup1() {
            return messageGroup1;
        public void setMessageGroup1(MessageGroup mg) {
            this.messageGroup1 = mg;
        private CachedRowSetDataProvider customerDataProvider = new CachedRowSetDataProvider();
        public CachedRowSetDataProvider getCustomerDataProvider() {
            return customerDataProvider;
        public void setCustomerDataProvider(CachedRowSetDataProvider crsdp) {
            this.customerDataProvider = crsdp;
        private TableColumn tableColumn2 = new TableColumn();
        public TableColumn getTableColumn2() {
            return tableColumn2;
        public void setTableColumn2(TableColumn tc) {
            this.tableColumn2 = tc;
        private StaticText staticText4 = new StaticText();
        public StaticText getStaticText4() {
            return staticText4;
        public void setStaticText4(StaticText st) {
            this.staticText4 = st;
        private TableColumn tableColumn3 = new TableColumn();
        public TableColumn getTableColumn3() {
            return tableColumn3;
        public void setTableColumn3(TableColumn tc) {
            this.tableColumn3 = tc;
        private StaticText staticText5 = new StaticText();
        public StaticText getStaticText5() {
            return staticText5;
        public void setStaticText5(StaticText st) {
            this.staticText5 = st;
        private TableColumn tableColumn11 = new TableColumn();
        public TableColumn getTableColumn11() {
            return tableColumn11;
        public void setTableColumn11(TableColumn tc) {
            this.tableColumn11 = tc;
        private StaticText staticText13 = new StaticText();
        public StaticText getStaticText13() {
            return staticText13;
        public void setStaticText13(StaticText st) {
            this.staticText13 = st;
        public customer_list() {
        protected adminSessionBean getAdmin$adminSessionBean() {
            return (adminSessionBean)getBean("admin$adminSessionBean");
        protected soulsurfing.ApplicationBean1 getApplicationBean1() {
            return (soulsurfing.ApplicationBean1)getBean("ApplicationBean1");
        protected soulsurfing.SessionBean1 getSessionBean1() {
            return (soulsurfing.SessionBean1)getBean("SessionBean1");
        protected soulsurfing.RequestBean1 getRequestBean1() {
            return (soulsurfing.RequestBean1)getBean("RequestBean1");
        public void init() {
            super.init();
            try {
                _init();
            } catch (Exception e) {
                log("customer_list Initialization Failure", e);
                throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
        public void preprocess() {
        public void prerender() {
            try {
                if (getAdmin$adminSessionBean().getFilter1().equalsIgnoreCase("")) {
                    getAdmin$adminSessionBean().getCustomerRowSet().setString(1, "%");
                } else {
                    getAdmin$adminSessionBean().getCustomerRowSet().setString(1, getAdmin$adminSessionBean().getFilter1());
                if (getAdmin$adminSessionBean().getFilter1().equalsIgnoreCase("")) {
                    getAdmin$adminSessionBean().getCustomerRowSet().setString(2, "%");
                } else {
                    getAdmin$adminSessionBean().getCustomerRowSet().setString(2, getAdmin$adminSessionBean().getFilter2());
                getAdmin$adminSessionBean().getCustomerRowSet().execute();
                customerDataProvider.refresh();
                customerDataProvider.cursorFirst();
                getAdmin$adminSessionBean().setRowCount(customerDataProvider.getRowCount());
                getAdmin$adminSessionBean().setMsg(getAdmin$adminSessionBean().getRowCount() + " records returned.");
                //i have a breakpoint here which hangs when stepping over code however works if breakppoint not set
                String test_var1 = getAdmin$adminSessionBean().getFilter1();
                int test_var2 = getAdmin$adminSessionBean().getRowCount();
            } catch (Exception e) {
                log("Exception occurred!!", e);
                error("Error: "+e.getMessage()); //null exception is being caught
        public void destroy() {
            customerDataProvider.close();
    adminSessionBean.java
    package soulsurfing.admin;
    import com.sun.rave.web.ui.appbase.AbstractSessionBean;
    import javax.faces.FacesException;
    import com.sun.sql.rowset.CachedRowSetXImpl;
    public class adminSessionBean extends AbstractSessionBean {
        private int __placeholder;
        private void _init() throws Exception {
            customerRowSet.setDataSourceName("java:comp/env/jdbc/SoulSurfing_User");
            customerRowSet.setCommand("SELECT * \nFROM customer ");
            customerRowSet.setTableName("customer");
        private CachedRowSetXImpl customerRowSet = new CachedRowSetXImpl();
        public CachedRowSetXImpl getCustomerRowSet() {
            return customerRowSet;
        public void setCustomerRowSet(CachedRowSetXImpl crsxi) {
            this.customerRowSet = crsxi;
        public adminSessionBean() {
        protected soulsurfing.ApplicationBean1 getApplicationBean1() {
            return (soulsurfing.ApplicationBean1)getBean("ApplicationBean1");
        public void init() {
            super.init();
            try {
                _init();
            } catch (Exception e) {
                log("adminSessionBean Initialization Failure", e);
                throw e instanceof FacesException ? (FacesException) e: new FacesException(e);
        public void passivate() {
        public void activate() {
        public void destroy() {
        private String filter1 = "";
        public String getFilter1() {
            return this.filter1;
        public void setFilter1(String filter1) {
            this.filter1 = filter1;
        private String filter2 = "";
        public String getFilter2() {
            return this.filter2;
        public void setFilter2(String filter2) {
            this.filter2 = filter2;
        private int rowCount;
        public int getRowCount() {
            return this.rowCount;
        public void setRowCount(int rowCount) {
            this.rowCount = rowCount;
        private String msg;
        public String getMsg() {
            return this.msg;
        public void setMsg(String msg) {
            this.msg = msg;
    }

    Hi Harini,
    What I didn't explain in my initial post is that there are more than 2 views in my application.  There are a total of 9 jsp's so far, so I coded multiple controllers due to the high amount of views.  After taking the HTMLB training class, I noticed that the examples used contained no more than 2 jsp's, so only 1 controller was needed.
    However, I talked with another Portal developer, and he suggested that it would be simpler to code the application using only 1 controller.  The problem is, I will have 1 LOOOOONG controller since there are many buttons across all of the jsp's (hence many events that will need to be handled) and many beans that need to be populated.
    Harini, thanks very much for offering to view my par file.  I think I have solved the problem on my own, but could you let me know what the design standard is for an application of this size?  Think of an online banking application that needs to handle bill payment (paying the bill, viewing past payments, etc.,).
    Would you use 1 controller for this type of application?
    Thanks very much for your help.
    -Jamie

  • JDeveloper 10.1.3 EA 1 Session Bean Problems

    Hello,
    it seems there are some problems in JDeveloper 10.1.3 EA1 related to Session EJBs:
    1) The Create Session Bean Wizard doesn't work correctly. After finishing the Wizard, JDeveloper only creates the ejb-jar.xml and orion-ejb-jar.xml, but not the Session EJB classes/interfaces themselves (Bean, Remote, Home). So I had to develop the Session Bean in JDeveloper 10.1.3 Developer Preview. That worked fine. I finally migrated the project to 10.1.3 EA1.
    2) When I try to run my JSF/EJB application with the Session Bean in 10.1.3 EA1, the following error occurred:
    05/10/24 17:31:15 Error instantiating application 'current-workspace-app' at file: <a file path>...oc4j-app.xml:
    Error initializing ejb-modules:
    Error loading module file: <a file path>.../Model/classes/:
    Syntax error in source or compilation failed in:
    <a file path>...\Software\JDeveloper\jdevj2eebase1013\jdev\system\oracle.j2ee.10.1.3.34.12\embedded-oc4j\application-deployments\current-workspace-app\Umfragesystem02_Model_0\generated\CommandHandlerSession_StatelessSessionBeanWrapper0.java
    I have no idea how to solve this problem. Does anybody have a solution?
    Regards,
    Matthias

    Tested Session Bean and Entity Bean.<br>
    The bean class and the deployment descriptors get<br>
    generated.<br>
    The remote/local, home/local home interfaces do not<br>
    get generated.<br><br>
    Thanks. The Session Bean Creation Wizard problem is a problem I could solve using a workaround. But the problem that really stems me is the error I receive when I try to run my webapp using the Session Bean and some more classes and JavaServer Faces files:<br>
    <br>
    Error instantiating application 'current-workspace-app' at file: ...oc4j-app.xml: <br>Error initializing ejb-modules: <br>
    Error loading module file: .../Model/classes/: <br>
    Syntax error in source or compilation failed in:<br> ...\Software\JDeveloper\jdevj2eebase1013\jdev\system\oracle.j2ee.10.1.3.34.12\embedded-oc4j\application-deployments\current-workspace-app\Umfragesystem02_Model_0\generated\CommandHandlerSession_StatelessSessionBeanWrapper0.java <br>
    <br>
    What goes wrong with JDeveloper or the application?

  • JDeveloper EJB3 Session Bean Problem

    Hi Everyone,
    I am new to JDeveloper. I tried to do a EJB3 Stateless Session Bean. I want to add the AroundInvoke Function to the Bean class. At below
    @AroundInvoke
    // mark this method as a bean interceptor
    public Object checkPermission(InvocationContext ic) throws Exception {
    System.out.println("*** checkPermission interceptor invoked");
    // you can implement your own security framework using interceptors
    if (!ic.getEJBContext().getCallerPrincipal().getName().equals("oc4jadmin")) {
    throw new SecurityException("Caller: '"
    + ic.getEJBContext().getCallerPrincipal().getName()
    + "' does not have permissions for method "
    + ic.getMethod());
    return ic.proceed();
    However, the Jdeveloper 11g keep show me the error message that AroundInvoke is not found. Then I put the import javax.ejb.AroundInvoke. It still complain import javax.ejb.AroundInoke not found.
    Please help and advise.
    Thank you

    A small tip - if you go to the add a library dialog in the project properties you'll see a search box at the top - you can put a class name there and JDeveloper will show you in which library it is.

  • Add session bean problems

    i tried to add session bean sets, but when i reach the 'configure EJB methods' dialog box, i cannot proceed to click on button 'finish' because of the errors "one or more collection element types are not specified: [getAuthorizerId] ".
    how to fix it??? thanx.

    this is the getAuthorizerId methods that i have written.
    public List getAuthoId (String code)throws HibernateException{
              Session ses = null;
                   try{
                        boolean trace = logger.isTraceEnabled();
                        if(trace)
                             logger.trace("Begin to search Authorizer code " + code);                    
                        ses = ThreadLocalSession.currentSession();          
                        Query query = ses.createQuery("from Authorizer as authorizer where authorizer.authoId=?");
                        query.setString(0, code);
                        List result = query.list();
                        ses.flush();
                        if(trace)
                             logger.trace("End of searching authorizer code " + code);
                        return result;
                   } catch (HibernateException e) {
                        ctx.setRollbackOnly();
                        throw new HibernateException("Unable to search authorizer code " + code, e);
                   }finally{
                        try {
                             ThreadLocalSession.closeSession();
                        } catch (HibernateException e1) {
                             e1.printStackTrace();
    is it because jsc cannot support java.util.list??

  • Problem while deploying a stateless Session bean

    hi,
    I am a beginner in J2EE. Please help..
    I have encountered an error while i am deploying a session bean in IBM Webspere App Servere
    the eroor is
    D:\Program Files\WebSphere\AppServer\deploytool\itp>ejbdeploy.bat c:\account\dep
    loy\account.jar c:\account\deploy c:\account\deploy\account-ejb.jar
    Starting workbench.
    Creating the project.
    Validating
    Generating deployment code
    Refreshing: /account.jar/ejbModule.
    Building: /account.jar.
    Invoking RMIC.
    error: Invalid class file format in C:\account\deploy\account.jar(com/fl/ac/Acco
    unt.class). The major.minor version '49.0' is too recent for this tool to under
    stand.
    error: Class com.fl.ac.Account not found in class com.fl.ac.EJSRemoteStatelessAc
    countEJB_ca490e54.
    error: Invalid class file format in C:\account\deploy\account.jar(com/fl/ac/Acco
    untHome.class). The major.minor version '49.0' is too recent for this tool to u
    nderstand.
    error: Class com.fl.ac.AccountHome not found in class com.fl.ac.EJSRemoteStatele
    ssAccountEJBHome_ca490e54.
    4 errors
    [*Error] An unexpected exception was thrown. Halting execution.
    Shutting down workbench.
    Error generating RMI code: RMIC Command returns RC = 1. The problems which stopp
    ed RMIC are displayed, and have also been recorded in the .log file in c:\accoun
    t\deploy\account-ejb._\.metadata.
    RMIC command was:
    -extdirs D:\Program Files\WebSphere\AppServer\java\jre\lib\core.jar;D:\Program F
    iles\WebSphere\AppServer\java\jre\lib\graphics.jar;D:\Program Files\WebSphere\Ap
    pServer\java\jre\lib\security.jar;D:\Program Files\WebSphere\AppServer\java\jre\
    lib\server.jar;D:\Program Files\WebSphere\AppServer\java\jre\lib\xml.jar;D:\Prog
    ram Files\WebSphere\AppServer\java\jre\lib\charsets.jar;D:\Program Files\WebSphe
    re\AppServer\java\jre\lib\ext;D:\Program Files\WebSphere\AppServer\java\lib;D:\P
    rogram Files\WebSphere\AppServer\classes;D:\Program Files\WebSphere\AppServer\li
    b;D:\Program Files\WebSphere\AppServer\lib\ext;D:\Program Files\WebSphere\AppSer
    ver\web\help;D:\Program Files\WebSphere\AppServer\deploytool\itp\plugins\com.ibm
    .etools.ejbdeploy\runtime;D:\Program Files\ibm\WebSphere MQ\Java\lib; -classpath
    c:\account\deploy\account-ejb._\account.jar\ejbModule;C:\account\deploy\account
    .jar -iiop -always -keep -d c:\account\deploy\account-ejb._\account.jar\ejbModul
    e -sourcepath c:\account\deploy\account-ejb._\account.jar\ejbModule com.fl.ac.EJ
    SRemoteStatelessAccountEJBHome_ca490e54 com.fl.ac.EJSRemoteStatelessAccountEJB_c
    a490e54
    BEAN SOURCE CODE IS
    ------------------Remote Interface -------------------------------
    package com.fl.ac;
    import java.rmi.*;
    import javax.ejb.*;
    public interface Account extends EJBObject     {
         public double withdraw(double balance,double amount) throws RemoteException;
         public double deposite(double balance,double amount) throws RemoteException;
    ------------------------ Home Interface -----------------------------------
    package com.fl.ac;
    import java.rmi.*;
    import javax.ejb.*;
    public interface AccountHome extends EJBHome     {
         public Account create() throws CreateException,RemoteException;
    ------------------------- Bean Class -----------------------------------------------
    package com.fl.ac;
    import java.rmi.*;
    import javax.ejb.*;
    public class AccountEJB implements SessionBean     {
         public void setSessionContext(SessionContext ctx)     {     }
         public void unsetSessionContext()     {     }
         public void ejbCreate()     {     }
         public void ejbActivate()     {     }
         public void ejbPassivate()     {     }
         public void ejbRemove()     {     }
         public double withdraw(double balance,double amount){
              return (balance - amount);
         public double deposite(double balance,double amount){
              return (balance+amount);
    ------------------------------ ejb-jar.xml --------------------------------------------
    <?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 id="ejb-jar_ID">
    <display-name>Account EJB</display-name>
    <enterprise-beans>
    <session>
    <ejb-name>AccountEJB</ejb-name>
    <home>com.fl.ac.AccountHome</home>
    <remote>com.fl.ac.Account</remote>
    <ejb-class>com.fl.ac.AccountEJB</ejb-class>
    <session-type>Stateless</session-type>
    <transaction-type>Container</transaction-type>
    </session>
    </enterprise-beans>
    </ejb-jar>
    PLZ HELP ME......
    francis

    Hi Gauarv,
    Did you not see my reply in the following post?
    Re: 502 service temporarily unavailable
    If I'm not mistaken, this is exactly the same question as you asked
    there.
    By the way, is there some reason you are still using OC4J version
    1.0.2.2? Is there something stopping you from upgrading to the later
    versions (9.0.2 and 9.0.3)?
    Good Luck,
    Avi.

  • 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                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Odd marshalling problems with EJB 3.0 stateless session bean

    Hello,
    I began encountering marshalling exceptions when invoking methods on a previously functionining facade bean. The problem seems to be almost arbitrary, in that certain packages receive marshalling exceptions, while others do not (my main client started failing, but then I realized that a simple test class was still working, along with oddly JSFs that invoke that main client, which fails outside of that scope). Is there some config issue with stateless session beans (in 3.0) that I might be missing? There are no duplicate versions of these class; they have not been modified; they've been compiled with the current IDE. Any help would be appreciated. Thanks.
    full stack trace:
    com.evermind.reflect.UndeclaredExceptionTypeException: oracle.oc4j.rmi.OracleRemoteException
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
    oracle.oc4j.rmi.OracleRemoteException: Invocation error: java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:142)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
         Nested exception is:
    java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:128)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
    oracle.oc4j.rmi.OracleRemoteException: Invocation error: java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:142)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
         Nested exception is:
    java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:128)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)

    Hello,
    I began encountering marshalling exceptions when invoking methods on a previously functionining facade bean. The problem seems to be almost arbitrary, in that certain packages receive marshalling exceptions, while others do not (my main client started failing, but then I realized that a simple test class was still working, along with oddly JSFs that invoke that main client, which fails outside of that scope). Is there some config issue with stateless session beans (in 3.0) that I might be missing? There are no duplicate versions of these class; they have not been modified; they've been compiled with the current IDE. Any help would be appreciated. Thanks.
    full stack trace:
    com.evermind.reflect.UndeclaredExceptionTypeException: oracle.oc4j.rmi.OracleRemoteException
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
    oracle.oc4j.rmi.OracleRemoteException: Invocation error: java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:142)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
         Nested exception is:
    java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:128)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
    oracle.oc4j.rmi.OracleRemoteException: Invocation error: java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:142)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)
         Nested exception is:
    java.rmi.UnmarshalException: Error deserializing return-value: java.io.InvalidClassException: com.jwt.gui.menus.persistence.ViewRight; local class incompatible: stream classdesc serialVersionUID = 2365320765203750319, local class serialVersionUID = -8750611773395720631
         at com.evermind.server.rmi.RMICall.EXCEPTION_ORIGINATES_FROM_THE_REMOTE_SERVER(RMICall.java:109)
         at com.evermind.server.rmi.RMICall.throwRecordedException(RMICall.java:128)
         at com.evermind.server.rmi.RMIClientConnection.obtainRemoteMethodResponse(RMIClientConnection.java:472)
         at com.evermind.server.rmi.RMIClientConnection.invokeMethod(RMIClientConnection.java:416)
         at com.evermind.server.rmi.RemoteInvocationHandler.invoke(RemoteInvocationHandler.java:63)
         at com.evermind.server.rmi.RecoverableRemoteInvocationHandler.invoke(RecoverableRemoteInvocationHandler.java:28)
         at com.evermind.server.ejb.StatelessSessionRemoteInvocationHandler.invoke(StatelessSessionRemoteInvocationHandler.java:43)
         at __Proxy1.findAllViewRight(Unknown Source)
         at com.jwt.gui.menus.beans.ViewRightBean.<init>(ViewRightBean.java:34)
         at com.jwt.gui.menus.beans.ViewRightBean.main(ViewRightBean.java:63)

  • Problem Deploying EJB3 Stateless session bean in Jboss4.0.3

    Hi All,
    I have developed an EJB 3 Stateless session bean and tried to deploy in JBoss 4.0.3 , But i get the following Exception.
    javax.naming.NameNotFoundException: ejb not bound
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
    at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
    at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
    at org.jnp.server.NamingServer.lookup(NamingServer.java:249)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:610)
    at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:572)
    at javax.naming.InitialContext.lookup(InitialContext.java:351)
    at org.apache.jsp.session_jsp._jspService(org.apache.jsp.session_jsp:69)
    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
    at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:157)
    at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
    at java.lang.Thread.run(Thread.java:595)
    I am sorry if the question is silly..... My Remote Interface will be one like this
    import javax.ejb.Remote;
    @Remote
    public interface CityService {
         public String getCity();
    And My Bean Class will be
    import javax.ejb.EJB;
    import javax.ejb.Remote;
    import javax.ejb.Stateless;
    import javax.persistence.EntityManager;
    import javax.persistence.EntityTransaction;
    import javax.persistence.PersistenceContext;
    import javax.persistence.Query;
    @EJB
    @Remote(CityService.class)
    @Stateless(mappedName="ejb/CityService")
    public class CityServiceBean implements CityService {
    public String getCity(){
    return "Chennai Metropolitan";
    And the client which invokes the bean will be
    InitialContext ctx = new InitialContext();
    CityService c = (CityService)ctx.lookup("ejb/CityService");
    System.out.println("Msg from Bean"+c.getCity());
    please help me out of this issue....
    Thanks in advance

    ford wrote:
    If you deploy your application in a .ear, you also can use this:
    You have to set a name to your EJBBean -> @Stateless(name = "XXX")
    The client for remote interface -> cxt.lookup(Name_of_your_own_ear_without_extension + "/XXX/Remote");
    The client for local interface -> cxt.lookup(Name_of_your_own_ear_without_extension + "/XXX/Local");the problem with this approach is that if you version your ears, the version numbers show up in the jndi names, and your client code will be hard coded to specific server versions.

  • Problem While calling a session bean (J2EE)

    Hi!!
    Please see my client-side code..where I am calling a session bean (J2EE Server)
    It's correct or not?????
    InitialContext ctx = new InitialContext();
    Object objref = ctx.lookup("SecDbSecRoleJndi");
    SecBusSecRoleHome home =(SecBusSecRoleHome)PortableRemoteObject.narrow(objref,SecBusSecRoleHome.class);
    SecBusSecRoleRemote remote =(SecBusSecRoleRemote)PortableRemoteObject.narrow(home.create(),SecBusSecRoleRemote.class);
    Here I am getting the error at 3rd line
    java.lang.ClassCastException
    at com.sun.corba.se.internal.javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:296)
    at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137)
    at TestServlet.init(TestServlet.java:22)
    Please do the favor to me..reply me back.
    Bhumika

    Hello,
    Hope you are bale to sole the problem by this time. Iam using the follwing code and its working fine for me. i'm using the weblogic application server.
    <%@ page import="javax.naming.*, java.rmi.*, javax.ejb.*, java.util.*,java.rmi.server.*,java.net.*,javax.rmi.PortableRemoteObject,com.hmp.webcasting.services.ejb.*"%>
    <%
    try{             
    Properties prop = new Properties();
    prop.put(Context.INITIAL_CONTEXT_FACTORY, "weblogic.jndi.WLInitialContextFactory");
              System.out.println("Hello......3333333333Test");
              prop.put(Context.PROVIDER_URL, "t3://pani:7001");
              InitialContext ctx = new InitialContext(prop);
    Object home = ctx.lookup("personMgr");
              KeywordsMgrHome roleHome = (KeywordsMgrHome) javax.rmi.PortableRemoteObject.narrow(home, KeywordsMgrHome.class);
              KeywordsMgr kmgr=roleHome.create();
              //KeywordsMgrHome roleHome = (KeywordsMgrHome) ctx.lookup("personMgr");;
              System.out.println(roleHome);
              System.out.println(kmgr);
              }catch(Exception e){
              e.printStackTrace();
              %>
    Try using this.
    Genrally calss cast exception occurs if you are using classes out of a shared library directory instead of within the webapp, or if you are somehow maintaining references to object instances created with the old class and trying to use them after the reload. So try to delete the old file files and deploy the bean once again . Hope this may help you. Anyway if you can give the full code i will check by deploying it.([email protected])

  • Problems accessing fields in a CMP entity bean from a session bean

    Hello everybody,
    I'm getting the next problem: when I try to access a field in a CMP entity bean that I have instantiated from a session bean (trhoug entitybean.getNameOfField), I get the error "the entity bean does not exist in the database".
    This entity bean is accessing a table in an external database (not the DB of the WAS), but I know that it's getting the correct data from the table, since  I check the entitybean.size() and the entitybean.findByPrimaryKey(), and I get the right information. For some reason, the only thing that it doesn't work in the entity bean are the getter/setter methods (I created them automatically after having created the entity fields).
    I access the entity bean through its local interface...
    I know it's really difficult to give an answer with so few details, but... does anybody think I forgot something important to configure??
    Thank very much in advance!!
    Isidro

    getter and setter methods for cmp-fields are abstract.
    getter and setter methods for cmr-fields are abstract.
    "John Lee" <[email protected]> wrote:
    >
    Hi:
    Which method in a CMP Entity bean should be abstract? just only SetXXX
    and
    GetXXX?
    Thanks!
    John Lee

  • 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

  • Problem invoking gogle web service from session bean

    Hello
    I have developed a Web-Client which consumes the google-WebService with Apache Axis. I have generated the corresponding classes with WSDL2Java and the client works without problems. A little code fragment from my client:
    GoogleSearchService service = new GoogleSearchServiceLocator();
              // Now use the service to get a stub to the Service Definition Interface (SDI)
              GoogleSearchPort google = service.getGoogleSearchPort();
             GoogleSearchResult googleSearchResult =  google.doGoogleSearch(GOOGLE_KEY, // java.lang.String key
                           q.toString(), //java.lang.String q
                           0, // int start
                           10, // int maxResults
                           false, //boolean filter
                           "", // java.lang.String restrict      
                           false, //boolean safeSearch              
                           "lang_ja|lang_en", // java.lang.String lr
                           "UTF-8", // java.lang.String ie
                           "UTF-8"); // java.lang.String oeNow I have to put the Web-Client in a SessionBean. Therfore I defined the code of the web-client in a method and put it into a stateless session bean and wrote a client for the session bean. But when the session bean invokes the corresponding method for consuming the google web service, there always occurs the following error:
    [java] Exception in thread "main" java.rmi.ServerError: Unexpected Error; nested exception is:
    [java] java.lang.NoClassDefFoundError: GoogleSearch/GoogleSearchService
    But I have definitely all necessary classes in my classpath, like GoogleSearchService, etc. So all necessary classes are available. And the code to conume the web service als works because as said I tested it with a web-client.
    Has anybody an idea what went wrong here? Is there anything important when I a web service is invoked by a session bean??:(
    regards
    pat

    Has nobdy an idea?? :(( I tried for such a long time but I was not able to fix this problem....:(
    Please help...

  • A simple problem with sateful Session beans

    Hi,
    I have a really novice problem with stateful session bean in Java EE 5.
    I have written a simple session bean which has a counter inside it and every time a client call this bean it must increment the count value and return it back.
    I have also created a simple servlet to call this session bean.
    Everything seemed fine I opened a firefox window and tried to load the page, the counter incremented from 1 to 3 for the 3 times that I reloaded the page then I opened an IE window (which I think is actually a new client) but the page counter started from 4 not 1 for the new client and it means that the new client has access to the old client session bean.
    Am I missing anything here???
    Isn�t it the way that a stateful session bean must react?
    This is my stateful session bean source.
    package test;
    import javax.ejb.Stateful;
    @Stateful
    public class SecondSessionBean implements SecondSessionRemote
    private int cnt;
    /** Creates a new instance of SecondSessionBean */
    public SecondSessionBean ()
    cnt=1;
    public int getCnt()
    return cnt++;
    And this is my simple client site servlet
    package rezaServlets;
    import java.io.*;
    import java.net.*;
    import javax.ejb.EJB;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import test.SecondSessionRemote;
    public class main extends HttpServlet
    @EJB
    private SecondSessionRemote secondSessionBean;
    protected void processRequest (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    response.setContentType ("text/html;charset=UTF-8");
    PrintWriter out = response.getWriter ();
    out.println("<html>");
    out.println("<head>");
    out.println("<title>Servlet main</title>");
    out.println("</head>");
    out.println("<body>");
    out.println("<h1>Our count is " + Integer.toString (secondSessionBean.getCnt ()) + "</h1>");
    out.println("</body>");
    out.println("</html>");
    out.close ();
    protected void doGet (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    processRequest (request, response);
    protected void doPost (HttpServletRequest request, HttpServletResponse response)
    throws ServletException, IOException
    processRequest (request, response);
    }

    You are injecting a reference to a stateful session bean to an instance variable in the servlet. This bean instance is shared by all servlet request, and that's why you are seeing this odd behavior.
    You can use type-leve injection for the stateful bean, and then lookup the bean inside your request-processing method. You may also save this bean ref in HttpSession.
    @EJB(name="ejb/foo", beanName="SecondBean", beanInterface="com.foo.foo.SecondBeanRemote")
    public MyServlet extends HttpServlet {
    ic.lookup("java:comp/env/ejb/foo");
    }

Maybe you are looking for

  • Photoshop CS4 Trial  installation asking for disc again and again

    I had to uninstall my Creative Suite CS3 because of licensing problems. Then I could not reinstall it on Vista Home Premium SP2 ("unsupported OS"). Now, as long as I am waiting for Adobe to respond to my case, I tried to install CS4 Trial versions of

  • Predefined properties in advanced search

    Hello Experts, We have recently upgraded to SP18 from SP13 I have created new Predefined Property called watercorp_reviewdate I wanted to make this field available in the Advanced Search Functionality in the list of 'Filter by Predefined Properties'.

  • N73- inserting sandisk

    Just got the n73 and don't know how to put the memory stick in. There's a place on the bottom of the phone where it looks like it should go, but can't get it to open. Any help for a newbie?

  • Loading a pdf file

    HI In my CAL application, I want to click on a button or link and for its to load up a pdf file. I've put the file in the same folder as my authorware session. I tried the function JumpOutReturn("program" [, "document"] [, "creator type"]) but when I

  • The ScrollPane doesn't work, and the TextArea just keep getting bigger!

    Here is what I did: I made a Frame first. Then I made a TextArea. Then I made a Scroll. Then I made a panel. Then I add the TextArea and the Scroll to the Panel, and I add the Panel to the Frame, but the whole thing just doesn't work. Anyway, see for