Since you're attempting to access the EJB (actually the JNDI registry in
general) from OUTSIDE THE EJB CONTAINER (i.e. from Tomcat), you need to
specify a naming provider as a system property in the JAVA_ARGS of your
java command line. For example:

Not sure what the actual "java" command used to launch Tomcat is, but it's something 
like this:

set  NAMING_PROVIDER=172.168.12.23
set  JAVA_ARGS=-Djava.naming.provider.url=%NAMING_PROVIDER%
java      %JAVA_ARGS%  {other stuff to launch tomcat}

This needs to be set somewhere in the cmd file you use to launch Tomcat.

Alternatively, you can also create the initial context by passing it a
HashMap containing all parameters you need to specify the JNDI provider.
This is done in the code when you're creating the InitialContext. Here's
sample code that generates an initial context for an EJB client attempting
to access an ejb in a weblogic container:


   Hashtable env = new Hashtable();
   env.put(Context.INITIAL_CONTEXT_FACTORY, JNDI_FACTORY);
   env.put(Context.PROVIDER_URL, "t3://localhost:7001");
   Context ctx = new InitialContext(env);

Some of the details here are missing, but it should get you on the right track.

Regarding the NoClassDefFoundError - gosh this could be anything. Are you
sure that your the ejb classes are visible to Tomcat? Resolving your jndi
issue may allow you to pull the classes using traditional rmi
functionality.

Best of luck. Send more info if you make progress.



Kevin



Kevin







Stan Burnitt <[EMAIL PROTECTED]> on 05/04/2002 07:49:11 PM

Please respond to "Struts Users Mailing List"
      <[EMAIL PROTECTED]>

To:   [EMAIL PROTECTED], [EMAIL PROTECTED]
cc:    (bcc: Kevin Bedell/Systems/USHO/SunLife)
Subject:  struts + jndi + ejb (on iAS)


Hello,

I'm a struts-newbie, but have worked with WebObjects/Model2 for many years.
So I hope I'm not asking a dumb question here ;-)

I've got a simple struts action, and a simple ejb.  They work fine until
I try to access the bean on iAS, from Tomcat.

I want to access the bean via a jndi.properties file:
java.naming.factory.initial=javax.naming.InitialContext
#java.naming.factory.initial=com.evermind.server.rmi.RMIInitialContextFactory

-- this works when I run in JDeveloper
java.naming.provider.url=ormi://brasil/clientes-bean
java.naming.security.principal=*****
java.naming.security.credentials=*****

I put ejb.jar in $CATALINA_HOME/common/lib

I cannot get a connection to the iAS - bean server.

Tomcat is failing to load EJBHome.  The tomcat locahost shows this
exception:
2002-05-04 22:24:18 oreilly: Error creating Action instance for path
'/login',
class name 'com.oreilly.actions.LoginAction'
java.lang.NoClassDefFoundError: javax/ejb/EJBHome
        at java.lang.ClassLoader.defineClass0(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:493)
        at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:111)
        at
org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLo

ader.java:1631)
        at
org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.jav

a:926)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav

a:1360)
        at
org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.jav

a:1243)
        ...
        ...

1) What naming factory do I use, since the oracle naming factory is not
available on Tomcat?

2) I think this is part of my problem, what else?


Can anybody clue me in?

Thanks
Stan









---------------------------------------------------------------------------
This e-mail message (including attachments, if any) is intended for the use
of the individual or entity to which it is addressed and may contain
information that is privileged, proprietary , confidential and exempt from
disclosure.  If you are not the intended recipient, you are notified that
any dissemination, distribution or copying of this communication is
strictly prohibited.  If you have received this communication in error,
please notify the sender and erase this e-mail message immediately.
---------------------------------------------------------------------------


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to