Larry Brewster

JBoss connection problem

Discussion created by Larry Brewster on Nov 4, 2009
Latest reply on Nov 5, 2009 by Larry Brewster

I wrote a Java class that just has a static method to return a proxy to an EJB3 stateless session bean hosted on JBoss 5.1.  I have the JBoss server running locally. The class works just fine when I call it from a test client in Eclipse but when I import the class into Blaze Advisor 6.8 and call the static method it always returns null. No exceptions are raised and there is nothing in the server log. Anyone have any thoughts?  Thanks

11-4 Update:  Here's the source code:

packagecom.kingsway.services.data.ejb;

importjava.util.Properties;

importjavax.naming.Context;

importjavax.naming.InitialContext;

importjavax.naming.NamingException;

public classBlazeCacheBeanClient {

public static KaitCacheBeanRemote getCacheBean(String url){KaitCacheBeanRemote cacheBean =

null;

Properties properties = new Properties();properties.put(

"java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");

properties.put("java.naming.factory.url.pkgs","org.jboss.naming:smileysurprised:rg.jnp.interfaces"); properties.put(

"java.naming.provider.url",url);

try{Context ctx=

new InitialContext(properties);

cacheBean = (KaitCacheBeanRemote) ctx.lookup("KaitCacheBean/remote");}

catch (NamingException e){

e.printStackTrace();

throw new RuntimeException(e);

}

return cacheBean;

}

}

 

After adding the line to throw a RuntimeException I not get a little more info in Blaze:

 

com.blazesoft.engines.rules.NdEvaluationException: Call to 'getCacheBean' failed
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException: org.jnp.interfaces.NamingContextFactory]
Cannot instantiate class: org.jnp.interfaces.NamingContextFactory while evaluating BlazeCacheBeanClient.getCacheBean("localhost:1099")

 I have made sure that the jar containing the org.jnp.interfaces.NamingContextFactory is in the classpath, but that doesn't make any difference.

Message Edited by larryb on 11-04-2009 03:49 PM

Outcomes