try{
_context = (Context) new InitialContext().lookup("java:comp/env/");
_messageLocalHome = (MessageLocalHome) _context.lookup("local/Message");
}catch(NamingException ned){
_systemLogger.error("Couldn't initialize all of the business objects: " + ned.getMessage());
}
I now get this on the console:
13:27:01,385 ERROR [system] Couldn't initialize all of the business objects: local not bound
Do I need something different in the arguments to lookup() than this:
_context = (Context) new InitialContext().lookup("java:comp/env/");
Thanks, -M@
On Saturday, March 22, 2003, at 02:04 AM, costin wrote:
Hi!
I`ve had the same problem when moving from Resin. As far as I can tell deploying a bean without any jndi configuration(i.e. jboss.xml) will deploy your beans under local:
i.e.you should search your bean like this: <snip> _contex.lookup("local/Message"); </snip>
I don`t why this isn`t specified in the docs - I am using Jboss 3.0.6 btw.
Anyway a great tool to see where your beans are deployed is using the jmx-console. Start the jboss server and then point your web browser at localhost:8080 (or whatever settings you have). Then enter the jmx-console(by default it won`t ask for a user/pass). The there select
service=JNDIView and at the bottom of the page invoke the list bean.
In the end you`ll see all the deployed names in the JNDI space.
Hope it helps...
MH> On Friday, March 21, 2003, at 07:11 PM, Guy Rouillier wrote:
Note I changed your subject - don't use the digest as the subject for a particular question, many people may skip it.
MH> And I've changed it back to the original because I almost skipped this
MH> one.
I do things the old fashioned way, with deployment descriptors. But your context isn't being properly constructed. You don't do a lookup to establish a context.
MH> Here's my code again since the original got mangled.
MH> try{
MH> _context = (Context) new
MH> InitialContext().lookup("java:comp/env/ejb");
MH> _messageLocalHome = (MessageLocalHome) _context.lookup("Message");
MH> }catch(NamingException ned){
MH> _systemLogger.error("Couldn't initialize all of the business
MH> objects: " +
MH> ned.getMessage()); MH> }
MH> The above code is currently working with Resin. I'm trying to make it
MH> work with JBoss, but don't know if Resin is doing something
MH> non-standard or not. I think maybe Resin is doing something that is
MH> allowing me to skip the PortableRemoteObject.narrow() call. Do I need
MH> to do that when using JBoss?
MH> Thanks,
MH> -M@
Here is an example from some code I wrote; this would get the params to construct the context from the jndi.properties file:
Object metricsRef = new InitialContext().lookup("com/masergy/ejb/NetworkMetrics/ NetworkMetrics"); NetworkMetricsHome metricsHome = (NetworkMetricsHome) PortableRemoteObject.narrow(metricsRef, NetworkMetricsHome.class); metrics = metricsHome.create();
If you want to specify explicit properties to your context, you can do
something like this:
java.util.Hashtable env = new java.util.Hashtable(); env.put("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory"); env.put("java.naming.factory.url.pkgs", "org.jboss.naming;"); env.put("java.naming.provider.url", jndiNamingProviderUrl);
Object ref = new InitialContext(env).lookup("com/masergy/ejb/NCC/NCC"); NCCHome home = (NCCHome) PortableRemoteObject.narrow(ref, NCCHome.class); ncc = home.create();
------------------------------------------------------- This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
MH> ------------------------------------------------------- MH> This SF.net email is sponsored by:Crypto Challenge is now open! MH> Get cracking and register here for some mind boggling fun and MH> the chance of winning an Apple iPod: MH> http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en MH> _______________________________________________ MH> JBoss-user mailing list MH> [EMAIL PROTECTED] MH> https://lists.sourceforge.net/lists/listinfo/jboss-user
-- costin mailto:[EMAIL PROTECTED]
------------------------------------------------------- This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user
------------------------------------------------------- This SF.net email is sponsored by:Crypto Challenge is now open! Get cracking and register here for some mind boggling fun and the chance of winning an Apple iPod: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0031en _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user