7 Replies Latest reply on Oct 14, 2002 12:00 PM by cpairot

    AXIS and Stateful Session Bean

    cpairot

      Hello everybody,

      I have a stateful session bean which has all of its methods published as SOAP services and this seems to work OK in JBoss 3.0.3. The problem is that I would like to call the ejbCreate() method of the session bean with parameters.

      I have been unable to call this method because it gives me an error telling me that the ejbCreate(...) method is not found.

      I wonder if the state of the session will also be maintained by using this approach or whether it is not recommended to use stateful session beans and SOAP?

      Thank you in advance!

      --

      Carles.

        • 1. Re: AXIS and Stateful Session Bean
          essington

          > I have a stateful session bean which has all of its
          > methods published as SOAP services and this seems to
          > work OK in JBoss 3.0.3. The problem is that I would
          > like to call the ejbCreate() method of the session
          > bean with parameters.

          I don't think this is possible.

          > I have been unable to call this method because it
          > gives me an error telling me that the ejbCreate(...)
          > method is not found.

          When you try to invoke a method via soap it is going to try to invoke the method from either the Local or Remote interface. so, your ejbCreate method is not there (it's in the home interface).

          perhaps you need to make a different method (in the local/remote interface) that does what you intended to do in ejbCreate.

          > I wonder if the state of the session will also be
          > maintained by using this approach or whether it is
          > not recommended to use stateful session beans and
          > SOAP?

          sure, you can maintain state of a stateful session bean via soap.
          In the web-service.xml file you just need to add:

          to your session beans service. Transaction, Session, and Application are valid values for the scope.

          Then the session is maintained with a cookie (so you may have to figure out how that works on your client.)

          good luck
          -jason

          • 2. Re: AXIS and Stateful Session Bean
            essington

            oops, I meant Request, Session, and Application are valid scope values. (Transaction is not. don't know what I was thinking)

            since I don't have a blackboard . . .

            for (int i=0; i<1000; i++){
            log.info("I will always proofread my messages before posting them to the forum.");
            }

            -jason

            • 3. Re: AXIS and Stateful Session Bean
              cpairot

              Hi Jason,

              Thank you for you answer. I have tried to add the scope parameter but when I deploy the wsr file, a NullPointerException is thrown :'-(

              My web-service.xml is as follows:

              <?xml version="1.0" encoding="UTF-8"?>

              <deployment
              xmlns="http://xml.apache.org/axis/wsdd/"
              targetNamespace="http://net.jboss.org/ToxicSession"
              xmlns:SoapFilesTransfer="http://net.jboss.org/ToxicSession"
              xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
              <!-- this is an extension to the Axis deployment descriptor which allows to
              specify the naming environment for the deployed ws logic -->

              <ejb-ref>
              <ejb-ref-name>ToxicSession</ejb-ref-name>
              <ejb-link>ToxicSession</ejb-link>
              </ejb-ref>




















              And the exception is the following one:

              11:38:35,066 ERROR [URLDeploymentScanner] Failed to deploy: org.jboss.deployment
              .scanner.URLDeploymentScanner$DeployedURL@4c1affc8{ url=file:/C:/cygwin/home/pai
              rot/jboss3/server/all/deploy/ToxicSession.wsr, deployedLastModified=0 }
              org.jboss.deployment.DeploymentException: Could not create deployment: file:/C:/
              cygwin/home/pairot/jboss3/server/all/deploy/ToxicSession.wsr; - nested throwable
              : (java.lang.NullPointerException)
              at org.jboss.deployment.MainDeployer.start(MainDeployer.java:822)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:616)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
              at sun.reflect.GeneratedMethodAccessor12.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
              sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:324)
              at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
              nDispatcher.java:284)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
              at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
              at $Proxy4.deploy(Unknown Source)
              at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymen
              tScanner.java:427)
              at org.jboss.deployment.scanner.URLDeploymentScanner.scanDirectory(URLDe
              ploymentScanner.java:648)
              at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentS
              canner.java:499)
              at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:261)
              at org.jboss.system.ServiceMBeanSupport.start(ServiceMBeanSupport.java:1
              64)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
              java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
              sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:324)
              at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
              nDispatcher.java:284)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
              at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceControl
              ler.java:976)
              at $Proxy0.start(Unknown Source)
              at org.jboss.system.ServiceController.start(ServiceController.java:397)
              at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
              sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:324)
              at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
              nDispatcher.java:284)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
              at org.jboss.util.jmx.MBeanProxy.invoke(MBeanProxy.java:174)
              at $Proxy3.start(Unknown Source) at org.jboss.deployment.SARDeployer.start(SARDeployer.java:249)
              at org.jboss.deployment.MainDeployer.start(MainDeployer.java:802)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:616)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:580)
              at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:564)
              at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
              at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
              java:39)
              at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
              sorImpl.java:25)
              at java.lang.reflect.Method.invoke(Method.java:324)
              at org.jboss.mx.capability.ReflectedMBeanDispatcher.invoke(ReflectedMBea
              nDispatcher.java:284)
              at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517)
              at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:324)
              at org.jboss.system.server.ServerImpl.start(ServerImpl.java:221)
              at org.jboss.Main.boot(Main.java:148)
              at org.jboss.Main$1.run(Main.java:381)
              at java.lang.Thread.run(Thread.java:536)
              Caused by: java.lang.NullPointerException
              at org.jboss.net.axis.server.AxisService.start(AxisService.java:551)
              at org.jboss.deployment.MainDeployer.start(MainDeployer.java:802)
              ... 46 more

              I have tried restarting the JBoss server with no luck. Any ideas of what it could be wrong?

              Thanx!

              --

              Carles

              • 4. Re: AXIS and Stateful Session Bean
                essington

                hmm, I am not sure when the scope part started working, but I don't think the more recent versions of axis were backported to jboss 3.0.3

                I am using using statefull session beans and the scope parameter in 3.2beta2 and it is working nicely.

                here is a service section of my web-service.xml:














                but maybe this doesn't work prior to JBoss 3.2, I wouldn't know as I'm not one to stick with the tried and true.

                • 5. Re: AXIS and Stateful Session Bean
                  cpairot

                  Hi again Jason,

                  Thanks, I have tried what you say but it seems that when JBoss (3.2) tries to deploy the web service, he doesn't like the <ejb-ref> tag at all. I wonder if you could attach your complete web-service.xml file to see how you have done it.

                  Thank you so much.

                  --

                  Carles

                  • 6. Re: AXIS and Stateful Session Bean
                    cpairot

                    Hi,

                    I have removed the <ejb-ref> tag and changed the URL from /axis/services to /jboss-net/services and now it seems it works fine.

                    Let's hope so ;-)

                    Greetings!

                    --

                    Carles

                    • 7. Re: AXIS and Stateful Session Bean
                      cpairot

                      Hi,

                      Maybe I am doing something that is not possible to be done: I have a Java Client that is trying to access a Stateful Session Bean through AXIS. As it is not a web client, how can the state be maintained?

                      Does anybody have an example of a Java client and/or a web client doing so?

                      Thanx in advance.

                      --

                      Carles