I've done it this way before but I was looking for a solution that is
more EJB server independent. This solution ties my servlet to jBoss. I
want to be able to take my ear file and deploy it as is on another J2EE
complient application server.
One solution I found was to modify the run.sh script and in the java
command that starts the server add
-Djava.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
I suppose I could also add the provider url in the java command as well.
Does this seem to be a reasonable solution or should I do this another
way.
Thanks for your help,
Scot.
>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
On 11/28/00, 12:19:09 PM, Adrian K�pe <[EMAIL PROTECTED]> wrote regarding
Re: [jBoss-User] Problem with ear/war with embeded tomcat:
> And not to forget add these lines to your Servlet:
> Context ctx = null;
> try {
> Hashtable env = new Hashtable(1);
> env.put(Context.INITIAL_CONTEXT_FACTORY,
> "org.jnp.interfaces.NamingContextFactory");
> env.put(Context.PROVIDER_URL, "127.0.0.1:1099");
> env.put(Context.URL_PKG_PREFIXES, "org.jnp.interfaces");
> ctx = new InitialContext(env);
> } catch (Exception e) {
> e.printStackTrace(System.err);
> }
> in the required method (init/doGet/doPost)
> Scot Bellamy wrote:
> > I tried exporting the CLASSPATH, and tried modifying the run.sh script to
> > add the jnp-client.jar to the classpath passed into the java command for
> > starting jBoss. Neither made a difference. I have also placed the
> > jnp-client.jar in the /library directory of my ear file. None of these
> > made a difference. It does appear that it is not finding
> > org.jnp.interfaces.NamingContextFactory (or is this really the problem?)
> > but I don't know how else to resolve this.
> >
> > Any other ideas?
> >
> > Thanks,
> > Scot.
> >
> > >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
> >
> > On 11/28/00, 10:59:23 AM, Adrian K�pe <[EMAIL PROTECTED]> wrote regarding
> > Re: [jBoss-User] Problem with ear/war with embeded tomcat:
> >
> > > Hi,
> > > Put your jnp-client.jar from jboss/client folder in your classpath when
> > you
> > > start the jBoss ... it should solves your problems
> > > bye.
> >
> > > Scot Bellamy wrote:
> >
> > > > I get the same problem with an ear or a war file. Either one deploys
> > > > successfully. But when I attempt to talk to a bean through my JSP, I get
> > > > a javax.naming.NoInitialContextException (see stack trace below). What
> > > > do I need to do to solve this?
> > > >
> > > > Thanks,
> > > > Scot.
> > > >
> > > > [EmbeddedTomcat] javax.naming.NoInitialContextException: Need to specify
> > > > class name in environment or system property, or as an applet parameter,
> > > > or in an application resource file: java.naming.factory.initial
> > > > at java.lang.Throwable.<init>(Throwable.java:96)
> > > > at java.lang.Exception.<init>(Exception.java:44)
> > > > at javax.naming.NamingException.<init>(NamingException.java:103)
> > > > at
> > > > javax.naming.NoInitialContextException.<init>(NoInitialContextException.
> > > > java:55)
> > > > at
> > > > javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:647)
> > > > at
> > > > javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
> > > > at
> > > > javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:2
> > > > 84)
> > > > at javax.naming.InitialContext.lookup(InitialContext.java:351)
> > > > at com.actsi.util.JNDI.lookup(JNDI.java:43)
> > > > at
> > > > com.actsi.enterprise.EJBSessionMessageProcessor.processMessage(EJBSessio
> > > > nMessageProcessor.java:62)
> > > > at
> > > > com.actsi.enterprise.xml.MessagingResponseProvider.processDocument(Messa
> > > > gingResponseProvider.java:55)
> > > > at
> > > > com.actsi.enterprise.xml.JDOMResponseProvider.processXML(JDOMResponsePro
> > > > vider.java:59)
> > > > at
> > > > com.actsi.enterprise.xml.JDOMResponseProvider.processXML(JDOMResponsePro
> > > > vider.java:39)
> > > > at com.actsi.enterprise.XMLServlet.doPost(XMLServlet.java:102)
> > > > at com.actsi.enterprise.XMLServlet.doGet(XMLServlet.java:61)
> > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
> > > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
> > > > at
> > > > org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
> > > > at org.apache.tomcat.core.Handler.service(Handler.java:286)
> > > > at
> > > > org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
> > > > at
> > > > org.apache.tomcat.core.ContextManager.internalService(ContextManager.jav
> > > > a:799)
> > > > at
> > > > org.apache.tomcat.core.ContextManager.service(ContextManager.java:745)
> > > > at
> > > > org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(H
> > > > ttpConnectionHandler.java:210)
> > > > at
> > > > org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:407)
> > > > at
> > > > org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:49
> > > > 8)
> > > > at java.lang.Thread.run(Thread.java:498)
> > > >
> > > > --
> > > > --------------------------------------------------------------
> > > > To subscribe: [EMAIL PROTECTED]
> > > > To unsubscribe: [EMAIL PROTECTED]
> > > > Problems?: [EMAIL PROTECTED]
> >
> > > --
> > > --------------------------------------------------------------
> > > To subscribe: [EMAIL PROTECTED]
> > > To unsubscribe: [EMAIL PROTECTED]
> > > Problems?: [EMAIL PROTECTED]
> >
> > --
> > --------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> > Problems?: [EMAIL PROTECTED]
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]