5 Replies Latest reply on Apr 20, 2004 9:10 AM by zaken

    communication servlet-session bean problem

    zaken

      hi
      I have problem with method call from servlet to sessionBean.
      I have jar with session and war with servlet. I created ear and deploy it.
      I copy client view classes (remote and home) to WEB-INF\classes.
      Problem is that when my servlet call method from remote interface.
      I lost value which I sent as param to method. When I make in method body:
      System.out.println(param); //it is ok, param is String

      but when I do:
      param1 = new String(param);// i also try parm1 = param;
      my param1 all the time is "0"
      Maybe anyone know answer. I think that maybe is problem with dependent clasess (remote or home).

      regards

        • 1. Re: communication servlet-session bean problem

          What is the signature of the remote method you're calling? Are you just passing String? Is there anything else?

          • 2. Re: communication servlet-session bean problem
            zaken

            hi
            In remote (Cat) have :
            //
            public ProdDetails prodDetails(String cat)
            throws ProdDetailsException, RemoteException;


            in session bean (CatBean):
            //
            public ProdDetails prodDetails(String cat)
            throws ProdDetailsException
            {
            String tmpCat = new String(cat);
            System.out.println(cat); //it print value passed from servlet, e.g. "1"
            System.out.println(tmpCat);//it alweys get "0" <-problem is here
            ...
            }

            in servlet i have:
            //
            CatHome phl = (CatHome)PortableRemoteObject.narrow(intCtx.lookup("java:comp/env/ejb/CatHome"), CatHome.class);
            Cat cat = phl.create();
            ProdDetails pd = cat.prodDetails("1");//passing value which lost in session Bean

            • 3. Re: communication servlet-session bean problem

              Yeah I'm not sure on that one. What JVM are you using?

              • 4. Re: communication servlet-session bean problem
                zaken

                win2000
                //
                java version "1.4.1_02"
                Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_02-b06)
                Java HotSpot(TM) Client VM (build 1.4.1_02-b06, mixed mode)
                //
                JBoss 3.2.3
                ------------
                I checked JBoss's Duke's Bank app and it worked correctly but web module is looking for in JNDI by EJBGetter static class and methods and in my app I do it in doGet(), any diff? I will check it yet.

                • 5. Re: communication servlet-session bean problem
                  zaken

                  it is solved.
                  It turned out thet there is a loop. I thought that this loop is not using because of exception, but turned out that control is once in loop and expection is when control go into loop during second pass.
                  It my fault, sorry and thanks for answer.

                  regards