-
1. Re: Servlet JNDI lookup fails but EJB exists on jmx-console
joelvogt Mar 9, 2003 11:32 PM (in response to chrimbo)when it fails, what is your stacktrace?
-
2. Re: Servlet JNDI lookup fails but EJB exists on jmx-console
chrimbo Mar 10, 2003 2:40 AM (in response to chrimbo)Stack trace is :
javax.naming.NameNotFoundException: Name TeamHome is not bound in this Context
at org.apache.naming.NamingContext.lookup(NamingContext.java:811)
at org.apache.naming.NamingContext.lookup(NamingContext.java:194)
at org.apache.naming.SelectorContext.lookup(SelectorContext.java:183)
at javax.naming.InitialContext.lookup(InitialContext.java:347)*****************Failed to lookup home for bean with JNDI Name: TeamHome*****************
at wc2004.TeamAction.perform(TeamAction.java:32)
at org.apache.struts.action.ActionServlet.processActionPerform(ActionServlet.java:1787)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1586)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:510)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:243)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:190)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
at org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:566)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
at org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:1027)
at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125)
at java.lang.Thread.run(Thread.java:536)
So does this must mean that I need to set some properties when I get the initial context ? If so, what ? -
3. Re: Servlet JNDI lookup fails but EJB exists on jmx-console
chrimbo Mar 10, 2003 3:52 AM (in response to chrimbo)B the way I also get this looking at the jmx-console :
Ejb Module: file%/C%/jboss-3.0.6_tomcat-4.1.18/server/default/deploy/teamEJB1.jar
java:comp namespace of the Team bean:
+- env (class: org.jnp.interfaces.NamingContext)
| +- jdbc (class: org.jnp.interfaces.NamingContext)
| | +- DefaultDS[link -> DefaultDS] (class: javax.naming.LinkRef)
also, I am getting my initial context with the following code :
try {
ctx = new javax.naming.InitialContext();
NamingEnumeration items = ctx.list("");
while (items.hasMore()) {
System.out.println("Listing all in context...");
System.out.println(items.next().toString());
}
}
catch (NamingException ne) {
System.out.println("Failed to connect to JNDI service for EJB server");
}
and get no output from the enumeration. -
4. Re: Servlet JNDI lookup fails but EJB exists on jmx-console
chrimbo Mar 10, 2003 3:57 AM (in response to chrimbo)and also ....
Global JNDI Namespace
+- jmx:evesham:rmi
+- Mytab2 (proxy: $Proxy36 implements interface mytest.Mytab2Home,interface javax.ejb.Handle)
+- jmx
| +- rmi
| | +- RMIAdaptor
+- matchs (proxy: $Proxy27 implements interface wc2004.matchsHome)
+- Mybum (proxy: $Proxy16 implements interface mybum.MybumHome,interface javax.ejb.Handle)
+- ConnectionFactory
+- Dtproperties (proxy: $Proxy33 implements interface mytest.DtpropertiesHome,interface javax.ejb.Handle)
+- Abum (proxy: $Proxy13 implements interface abummer.AbumHome,interface javax.ejb.Handle)
+- UserTransactionSessionFactory
+- XAConnectionFactory
+- invokers
| +- evesham
| | +- pooled
| | +- jrmp
| | +- http
+- UserTransaction
+- UILXAConnectionFactory
+- RMIXAConnectionFactory
+- TeamHome (proxy: $Proxy39 implements interface wc2004.TeamHome,interface javax.ejb.Handle)
+- Mytab (proxy: $Proxy35 implements interface mytest.MytabHome,interface javax.ejb.Handle)
which atleast shows my TeamHome JNDI exists in the global JNDI namespace. So why can't I find it ??? -
5. Re: Servlet JNDI lookup fails but EJB exists on jmx-console
chrimbo Mar 10, 2003 9:52 AM (in response to chrimbo)Well...I've only gone and solved it !!! Yipee !!
Here is what I did, changed my JNDI lookup to this as per page 47 (Naming)of the JBoss Quick Guide :
// Get an initial context through JNDI
javax.naming.Context ctx = null;
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
p.put(Context.PROVIDER_URL, "localhost");
p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
so we now point to the JBoss JNDI rather than the one in Tomcat I guess(?). That got me past the above problem. But then I got another one :
MalformedUrlException....no protocol: and
It turns out that the problem was that my JBuilder project was in a directory under a path in C:\Documents and Settings\.... hence the "and" in the error message. I guess Tomcat/JBoss doesn't URL encode the CLASSPATH before trying to construct a URL from it (boo !!). Anyhow, I moved my project to a directory without spaces in it and....BINGO !! It worked !
Does anyone know of any other way of getting around the CLASSPATH / Url problem without having to change directories ? When JBuilder starts up Tomcat, it passes the offending path in the -config option of :
C:\jbuilder8\jdk1.4\bin\javaw -classpath "C:\JBuilder8\thirdparty\jakarta-tomcat-4.0.6-LE-jdk14\bin\bootstrap.jar;C:\jbuilder8\jdk1.4\lib\tools.jar" -Dcatalina.home="C:/JBuilder8/thirdparty/jakarta-tomcat-4.0.6-LE-jdk14" org.apache.catalina.startup.Bootstrap -config H:\chris\jbprojects\wc2004\Tomcat\conf\server8080.xml start
note that my H:\chris\jbprojects\wc2004 used to be C:\Documents and Settings\....\wc2004 when I got the Url exception. Mmmmm.....any offers ??