--- [EMAIL PROTECTED] wrote: > Send JBoss-user mailing list submissions to > [EMAIL PROTECTED] > > To subscribe or unsubscribe via the World Wide Web, > visit > > https://lists.sourceforge.net/lists/listinfo/jboss-user > or, via email, send a message with subject or body > 'help' to > [EMAIL PROTECTED] > > You can reach the person managing the list at > [EMAIL PROTECTED] > > When replying, please edit your Subject line so it > is more specific > than "Re: Contents of JBoss-user digest..." > > > Today's Topics: > > 1. HELP! error while getting reference to ejb > (Scheil, Sven) > 2. Re: OpenSource and J2EE licensing (Ted > Stockwell) > 3. Re: Download and Build JBoss (Sebastian Hauer) > 4. Re: HELP! error while getting reference to ejb > (Dmitri Colebatch) > 5. Two copies of Jboss2.4.1/tomcat3.2.3 on the > same machine ([EMAIL PROTECTED]) > 6. RE: EmbeddedTomcatSX and JAAS (Madock > Chiwenda) > 7. RE: HELP! error while getting reference to ejb > (Scheil, Sven) > 8. AW: [JBoss-user] HELP! error while getting > reference to ejb (Scheil, Sven) > > --__--__-- > > Message: 1 > From: "Scheil, Sven" <[EMAIL PROTECTED]> > To: "'[EMAIL PROTECTED]'" > <[EMAIL PROTECTED]> > Date: Thu, 13 Sep 2001 11:51:22 +0200 > Subject: [JBoss-user] HELP! error while getting > reference to ejb > Reply-To: [EMAIL PROTECTED] > > hi! > > i've successfully deployed a stateless session bean > on my jboss server. on > another server i'm running an web application under > apache/tomcat. from my > webapplication (from within a javabean) i would like > to get a connection to > my ejb with the following lines: > > InitialContext jndiContext = new > InitialContext(); > logger.debug("got context"); > > // Get a reference to the Interest Bean > Object ref = > jndiContext.lookup("KundenModulServices"); > logger.debug("got reference"); > > // Get a reference from this to the Bean's > Home interface > KundenModulServicesHome home = > (KundenModulServicesHome) > PortableRemoteObject.narrow(ref, > KundenModulServicesHome.class); > > // Create an Interest object from the Home > interface > kundenModulServices = home.create(); > logger.debug("ejb created"); > > the result is this error: > > 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 > > i think the jndi.properties file is not found?! > > but: i put the jndi.properties in the > WEB-INF/classes directory where all my > other property files reside. > > i've tested the above code as a standalone client > application. i've > deployed the test client on my web server and the > connection was > established! > > Is there another way to specify the needed > information????? > > please give me a hint.... > This is because the client is not able to find the jndi directory and the naming provider.What you can do is before creating the initalContext object add the follwing lines of code String filepath = "<path to the jndi.properties file>" FileInputStream fileRead = new FileInputStream(filePath); Properties prop = new Properties(); prop.load(fileRead); //Now construct the InitialContext as follows InitialContext iContext = new Icontext(); //Rest of the code will be the same This should ensure that the client communicates with the bean __________________________________________________ Terrorist Attacks on U.S. - How can you help? Donate cash, emergency relief information http://dailynews.yahoo.com/fc/US/Emergency_Information/ _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user