axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Russell Brown" <russell.br...@Freeserve.com>
Subject RE: EJBs deployed as webservices continued
Date Wed, 13 Nov 2002 17:02:35 GMT
Many many thanks to Haneef, Brian and the rest of you have helped with these teething troubles.
 
I took Haneef's advice and removed the javax/servlet directory and now at least the web service
is trying to work. 
 
It connects to thje jndi service on port 1099 but fails to find the ejb/PAFLookUp object.
However when I connect to the same EJB witha simple commandline client I get a response (
IE the object is found ). The actual error is 
 
javax.naming.NameNotFoundException: ejb
 
which is wierd as the deployment wsdd states that the beanJndiName is ejb/PAFLookUp ( which
is the jndi name I gave the bean when I deployed it with the SUN RI deploytool ) 
 
I feel I am certainly getting there with this, anyone out there able to help with this latest
oddness ?
 
Many thanks in advance
 
Russell
 
Below is my wsdd that now ( almost ) works:
 
<?xml version="1.0" encoding="UTF-8"?>
<deployment xmlns=" http://xml.apache.org/axis/wsdd/"
 xmlns:java=" http://xml.apache.org/axis/wsdd/providers/java"
 xmlns:xsi=" http://www.w3.org/2000/10/XMLSchema-instance">
 <service name="PAFLookUp" provider="java:EJB">
 <parameter name="beanJndiName" value="ejb/PAFLookUp"/>
 <parameter name="homeInterfaceName" value="com.freeserve.fsmap.PAF.PAFLookUpHome"/>
 <parameter name="remoteInterfaceName" value="com.freeserve.fsmap.PAF.PAFLookUp"/>
 <parameter name="allowedMethods" value="getReturn,create"/>
 
 <parameter name="jndiURL" value="rmi://localhost:1099"/>
 <parameter name="jndiContextClass" value="com.sun.jndi.rmi.registry.RegistryContextFactory"/>
<typeMapping xmlns:ns=" http://soapinterop.org/xsd"
 qname="ns:com.freeserve.fsmap.ArgumentSet"
 type="java:com.freeserve.fsmap.ArgumentSet"
 serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
 deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
 encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/"/ <http://schemas.xmlsoap.org/soap/encoding/>
>
</service>
</deployment>
 
 
 
-----Original Message----- 
From: ALI,HANEEF (HP-Cupertino,ex1) [mailto:haneef_ali@hp.com] 
Sent: Wed 06/11/2002 21:57 
To: 'axis-user@xml.apache.org' 
Cc: 
Subject: RE: EJBs deployed as webservices continued



Hi,
 
I didn't follow the thread fully. Just my few cents.
 
How about the jmx jars. Tomcat uses mx4j-jmx.jar and jboss uses its own implementation. If
 you happen to use any of the JMX classes
in your ejb,  you will have another nightmare.
 
 
Russell,
 
I have been using Tomcat -> Sun's RI implementation successfully.
 
Just follow the following steps
    *  Un jar the j2ee.jar from sun's ri
    * Remove the  javax.servlet directory from it ( because tomcat will not load the jar if
there is one more implementation which is offending it)
    * Once again jar it
    * put the jar in webapps/lib directory -- no need to put in tomcat/lib directory
 
Now you are all set to go
 
regards,
Haneef
 

-----Original Message-----
From: Brian Ward [mailto:Brian.Ward@BristolWest.com]
Sent: Wednesday, November 06, 2002 1:20 PM
To: 'axis-user@xml.apache.org'
Subject: RE: EJBs deployed as webservices continued



Russell, et al. 

I am using JBoss as my EJB server, but I have a decoupled Tomcat-4.1.12 installation hosting
Axis.  I think that (minus a few Sun RI vs. JBoss issues) the problem domain is nearly identical.
 I  can appreciate your pain in getting this to work.  It was no cake walk, but I'm happy
to share what I have.

Phase one, general Tomcat -> JBoss integration (mileage will vary for Sun RI customers...)
-- slightly off-topic, but since Axis is a servlet  application: somewhat applicable.

Include five magic jars in the $CATALINA_HOME/common/lib directory (why the j2ee.jar from
Sun is causing problems for some, I have no idea -- maybe some additional jars?!?)

        jboss-j2ee.jar 
        jboss-client.jar 
        jboss-common-client.jar 
        jbosssx-client.jar 
        jnp-client.jar 

Allow Tomcat to know about initial context stuff for JNDI naming.  I have no idea if this
is required for Axis (since JNDI info is in the deployment descriptor), but my Tomcat is setup
this way so it might help ;-)  This is one long line, which will doubtless get wrapped.  It
defines three properties that control JNDI context.  Two of these are specified in the deployment
descriptor below (as well).

        CATALINA_OPTS=-Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
-Djava.naming.provider.url=localhost:1099 -Djava.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces

Once that was done, my servlets could call EJBs that were running in JBoss!  So, I wrote some
simple Java objects that I let Axis morph into webservices (using Java2WSDL & WSDL2Java).
 That was fine, but the extra work and indirection seemed wasteful.  Then, I saw all the posts
to the mailing list regarding the EJB provider.  I started looking for documentation.  I went
back to the mailing list....  I watched more posts.  I took the best and the worst of the
code/wsdd snippits.  Then I went to work turning them into something that worked for me. 
Tada,

Here is my deployment descriptor for Axis (with some comments).... 

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

<deployment xmlns=" http://xml.apache.org/axis/wsdd/" 
        xmlns:java=" http://xml.apache.org/axis/wsdd/providers/java" 
        xmlns:commonns=" http://common.polk.collaborative.bw.com"> 
        <!-- xmlns:commonns is my namespace for my common elements (i.e. complex types).
--> 
        <!-- I put the remote interface, home interface, and all my complex data types
into 
                the same java namespace.  That namespace is represented above is somesort
of 
                funky xml-ification that I don't fully understand. --> 

        <service name="polk" provider="java:EJB"> 
                <!-- the following is particular to your deployment of your SessionBean
--> 
                <parameter name="beanJndiName" value="ejb/Polk"/> 

                <!-- the following are particular to your SessionBean --> 
                <parameter name="homeInterfaceName" value="com.bw.collaborative.polk.common.PolkHome"/>

                <parameter name="remoteInterfaceName" value="com.bw.collaborative.polk.common.Polk"/>


                <!-- I used this to filter out the inheirited EJB methods --> 
                <parameter name="allowedMethods" value="vinDecode,vinDecode2,vinDecode3,listAllYears,listAllManufacturers,getManufacturersForYear,getModelsForManufacturer,getPolkDetailForModel"/>

                <!-- This is JBoss's JNDI stuff; non-JBoss users will have a different
URL and Class --> 
                <!-- Also, I used a real hostname instead of just localhost. --> 
                <!-- Also(2), I have no idea if the usually "defaults" will be used by
the naming context factory, if you don't specify port and protocol -->

                <parameter name="jndiURL" value="jnp://bw003838:1099"/> 
                <parameter name="jndiContextClass" value="org.jnp.interfaces.NamingContextFactory"/>


                <!-- these are my complex types --> 
                <!--    qname is the class name in that funky namespace from above 
                        type is the java class 
                        my complex types are JavaBeans, so I used axis' supplied serializer/deserializer
(whew!) 
                        encoding style(?) -- I just copied this from somewhere else -->


                <typeMapping 
                        qname="commonns:VinDecodeValue" 
                        type="java:com.bw.collaborative.polk.common.VinDecodeValue" 
                        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" 
                        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"

                        encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/"/> 
                <typeMapping 
                        qname="commonns:YearValue" 
                        type="java:com.bw.collaborative.polk.common.YearValue" 
                        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" 
                        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"

                        encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/"/> 
                <typeMapping 
                        qname="commonns:ManufacturerValue" 
                        type="java:com.bw.collaborative.polk.common.ManufacturerValue" 
                        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" 
                        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"

                        encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/"/> 
                <typeMapping 
                        qname="commonns:ModelValue" 
                        type="java:com.bw.collaborative.polk.common.ModelValue" 
                        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" 
                        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"

                        encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/"/> 
                <typeMapping 
                        qname="commonns:PolkDetailValue" 
                        type="java:com.bw.collaborative.polk.common.PolkDetailValue" 
                        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" 
                        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"

                        encodingStyle=" http://schemas.xmlsoap.org/soap/encoding/"/> 
        </service> 
</deployment> 

Axis will have to have access to all the public parts of your EJB.  That means the Remote
Interface, Home Interface and all the complex types being used as parameters.  I just copied
them into the WEB-INF/classes directory, but you could just as easily jar them up and put
them in lib (I assume).

Now, here's the difficult part.  Sometimes, you get really helpful messages spewing in the
Tomcat logs/windows -- sometimes not.  Several times, I found myself confronted with "nothing
worked and there don't seem to be any errors."  Regardless of that past pain (much of which
I have tried to block out), this is what does work -- for me and this particular session bean.

Hope this helps some others. 

--- bhw 


-----Original Message----- 
From: Russell Brown [ mailto:russell.brown@Freeserve.com] 
Sent: Wednesday, November 06, 2002 12:42 PM 
To: axis-user@xml.apache.org 
Subject: RE: EJBs deployed as webservices continued 


Objectman, 
I am not using jBoss but the sun RI ( j2sdkee1.3 ). Also I am not trying to deploy axis into
the J2EE app server as a web client to the bean. What I have is a working bean deployed into
the RI container. I then deploy the Bean in Axis as a webservice ( under Tomcat ) with a wsdd.
The deployment throws no errors and ( it appears that it ?) succeeds ( running the axis client
shows it in the list ) but all the axis servlets stop displaying ( wierd ).

No, all I need is a way for Tomcat to find the class javax.ejb.EJBObject and I am laughing,
however whereever I put the j2ee.jar I get badness.

If its under the %TOMCAT_HOME%/webbapps/axis/WEB-INF/lib dir its ignored ( no class def error
) 
If its under    %TOMCAT_HOME%/lib       dir its ignored ( no class def error ) 
If its under    %TOMCAT_HOME%/server/libdir its ignored ( no class def error ) 
if its under     %TOMCAT_HOME%/common/lib then Tomcat will not start, it throws a no class
def error on org/apache/ajp/tomcat4/Ajp13Connector . Which is just as wierd 'cos I haven't
removed anything, I've just added the j2ee.jar.

I'll try a cross post to tomcat_users list on this. I'm sure if I tried the Axis into jBoss
( or even jBoss into Axis ) trail it would work, but I am bloody minded, and if docs say "this
works" I am going to make it work sooner or later ( or go mad )

Thanks for your help 

Russell 


-----Original Message----- 
From: objectman [ mailto:kcintron@elp.rr.com] 
Sent: 06 November 2002 18:15 
To: axis-user@xml.apache.org 
Subject: Re: EJBs deployed as webservices continued 


You directory hierarchy should look like the following. 

/whereverYouJBossIs/server/default/deploy/axis.war 

Under axis.war is where you need to place the axis distribution. 

Once that is in place. Restart the jboss server. You can test your 
installation by 
placing a simple test case class in the WEB-INF subdir of the axis.war 
distribution. 
Name the java source test.jws. Then, point your web browser to 
http://yourhostname:8080/axis/test.jws 

----- Original Message ----- 
From: "Russell Brown" <russell.brown@Freeserve.com> 
To: <axis-user@xml.apache.org> 
Sent: Wednesday, November 06, 2002 9:00 AM 
Subject: EJBs deployed as webservices continued 


Hi again, 
Thanks everyone for all your help to date: here is where I am now. 

I bought the Axis book from wrox, and read the short appendix on deploying 
EJBs as web services. They added the step of putting the jBoss jars into the 
lib directory of Tomcat ( a new one on me ). 

Not being on jBoss I added the j2ee.jar to the lib ( since I'm using Sun's 
RI ). Now when I deploy the service I get the same basic behaviour which is: 

Browsing the service URL results in a blank html page. 
Browsing the services url?wsdl results in a blank html page. 
Running the admin client list function shows that the service is deployed. 
Browsing the list of deployed services in Axis shows a blank html page ( not 
even the original getVersion service et al ) 
BUT 
browsing these services urls and url?wsdl works. 

Curious. 

So I wrote a client for the web service which when I run returns a huge 
amount of error data, sifting through which gets me : 

<b>root cause</b> <pre>java.lan g.NoClassDefFoundError: javax/ejb/EJBObject

at java.lang.ClassLoader.defineClass0(Native Method) . 

Which is at least progress. 

So any ideas on what to do now, I've certainly RTFM and it hasn't helped. 

The j2ee.jar is on the claspath, and in the Tomcat lib dir and in the 
WEB-INF lib dir for Axis but still Tomcat cannot find the 
javax/ejb/EJBObject class. 

If anyone can even give me mild encouragement I will buy them booze!!! 


Thanks in advance 

Russell 

Russell Brown 
Application Developer 
Freeserve.com Plc 
The Malthouse, Chadwick Street, Leeds LS10 1LJ 
Telephone: 0113 222 9110 

Mime
View raw message