Title: Message
Russel,
 
Actually I haven't used   axis to sun's appserver , but used tomcat servlet to sun's appserver. So i believe both are same.
 
If you have JNDI browser it is easy to check. If you eclipse ide then you can install JNDI plugin for it and it makes your life simpler. You can find out what is registered in which port and what are jndi properties etc.
 
Sun's JNDI uses iiop in port 1050.  So instead of trying to connect using rmi use iiop.
 
I have enclosed my jndi properties for your reference -- try this -- just change the ejb Name
 
JNDI PROPERTIES
 
java.naming.factory.initial=com.sun.jndi.cosnaming.CNCtxFactory 
java.naming.factory.url.pkgs=com.sun.enterprise.naming
 
Other parameters
 
URL, "iiop://localhost:1050"
ejbName = "/ejb/mgmt/MEJB";
 
regards,
Haneef
 
 
-----Original Message-----
From: Russell Brown [mailto:[EMAIL PROTECTED]]
Sent: Thursday, November 14, 2002 1:38 AM
To: [EMAIL PROTECTED]
Subject: RE: EJBs deployed as webservices continued

Haneef,
Many thanks for your continued help on this, however I am still stuck:
 
I am using Suns j2ee reference implementation and when I start it up it does say that naming services are bound to port 1050. However when I set the rmi url in the wsdd as 1050 I always always get the following error:
 
faultString: javax.naming.CommunicationException [Root exception is java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: java.net.SocketTimeoutException: Read timed out]
 
This is frustrating.
 
As to your second point, I'm afraid I don't understand. Below are my jndi properties ( minimal aren't they ? ). But at no point to I use the InitialContext in my code ( the bean client, which works ( and is only for test purposes) does ) but the web service is just the bean, and the Web Service client is below.
 
It is embarrising to be so stuck on what is given as a simple example in the user guide.
 
Thanks again
 
Russell
 
------------------------------------------------------------------------------------------
WS CLIENT

package com.freeserve.fsmap.PAF;
 
import java.net.URL;
 
import org.apache.axis.AxisFault;
import org.apache.axis.client.Call;
import org.apache.axis.client.Service;
 

import javax.xml.namespace.QName;
import javax.xml.rpc.ParameterMode;
 
import org.apache.axis.client.Service;
import org.apache.axis.client.Call;
import org.apache.axis.encoding.XMLType;
 
import com.freeserve.fsmap.ArgumentSet;
 
import java.util.*;
 
public class PAFLookUpWSClient {
 
  public PAFLookUpWSClient() {
  }
 
  public static void main (String args[]) {
 
 
 
  //create args as hashtable
 
  Hashtable ht = new Hashtable(5);
  ht.put("postcode","LS176PJ");
  ht.put("addressLine1","2");
 
  //create ArgumentSet
  ArgumentSet as = new ArgumentSet();
        as.setIdentifier("lookupPostCode");
        as.setArguments(ht);
 
 
 
        Service  service = new Service();
 
        try {
         Call     call    = (Call) service.createCall();
         QName    qn      = new QName( "urn:BeanService", "ArgumentSet" );
         call.registerTypeMapping(ArgumentSet.class, qn,
                      new org.apache.axis.encoding.ser.BeanSerializerFactory(ArgumentSet.class, qn),
                      new org.apache.axis.encoding.ser.BeanDeserializerFactory(ArgumentSet.class, qn));
        ArgumentSet result;
        try {
            call.setTargetEndpointAddress( new java.net.URL("
http://localhost:8080/axis/services/PAFLookUp") );
            call.setOperationName( new QName("PAFLookUp", "getReturn") );
            call.addParameter( "arg1", qn, ParameterMode.IN );
            call.setReturnType( qn );
 
            result = (ArgumentSet) call.invoke( new Object[] { as } );
        } catch (AxisFault fault) {
            System.out.println("Error :  "+fault.toString()+"\n\n\n");
            fault.printStackTrace();
        }
 
 
 
 
 
  } catch (Exception e) {
   System.out.println(e.toString());
   System.exit(-1);
  }
 
  System.out.println("yaya");
 
  }
}
 
----------------------------------------------------------------------------------
JNDI PROPERTIES
 
java.naming.factory.initial=com.sun.jndi.rmi.registry.RegistryContextFactory
java.naming.factory.url.pkgs=com.sun.enterprise.naming
 
 
cheers
-----Original Message-----
From: ALI,HANEEF (HP-Cupertino,ex1) [mailto:[EMAIL PROTECTED]]
Sent: 13 November 2002 18:05
To: '[EMAIL PROTECTED]'
Subject: RE: EJBs deployed as webservices continued

Hi,
 
Just try this,
 
I hope you are using the sun's j2ee reference implementation. By default the the name server starts at the port 1050. If you have changed that it is ok.
 
 
1)    In your code don't use InitialContext with default parameters. Find out what is your jndi properties values like CONTEXT_FACTORY etc and use the constructor which takes HashTable as parameter
 
 2) Unjar sun-j2ee jar and  set the .jndi.properties to whatever value which is correct
 
regards,
Haneef
   
 
-----Original Message-----
From: Russell Brown [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, November 13, 2002 9:03 AM
To: [EMAIL PROTECTED]
Subject: RE: EJBs deployed as webservices continued

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/"/>
</service>
</deployment>
 
 
 
-----Original Message-----
From: ALI,HANEEF (HP-Cupertino,ex1) [mailto:[EMAIL PROTECTED]]
Sent: Wed 06/11/2002 21:57
To: '[EMAIL PROTECTED]'
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:[EMAIL PROTECTED]]
Sent: Wednesday, November 06, 2002 1:20 PM
To: '[EMAIL PROTECTED]'
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:[EMAIL PROTECTED]]
Sent: Wednesday, November 06, 2002 12:42 PM
To: [EMAIL PROTECTED]
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:[EMAIL PROTECTED]]
Sent: 06 November 2002 18:15
To: [EMAIL PROTECTED]
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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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

Reply via email to