Hi,
I am fairly new to JBoss, so I am possibly missing something.
I have a simple EJB, which just sets up a Connection to a JNDI datasource, then closes the
connection.
try {
| Context loContext = (Context) new InitialContext().lookup("java:");
| DataSource loDataSource = (DataSource)loContext.lookup("Prophet_Data");
| Connection loConnection = loDataSource.getConnection();
| try {
| //
| } finally {
| if (!(loConnection == null)) {
| loConnection.close();
| }
| }
| } catch (Exception e) {
| e.printStackTrace();
| }
The JNDI Prophet_Data is defined within a seperate application, which is packaged into its
own EAR (Which is Pentaho).
If I deploy this EJB jar to JBoss, then call the EJB within a simple jsp:
Properties props = new Properties();
| props.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jnp.interfaces.NamingContextFactory");
|
| props.put(Context.PROVIDER_URL, "localhost:1099");
|
| Context ctx = new InitialContext(props);
|
| HelloHome home = (HelloHome)ctx.lookup("ejb/Hello");
| Hello bean = home.create();
| bean.simpleFunction();
| bean.remote();
| ctx.close();
When browsing to the jsp (eg:
http://localhost:8080/testejb/testejb.jsp), it works fine.
However, If I modify the EJB code (and just add say, the initialisation of an integer eg:
int i = 0;
Then I redeploy the EJB jar... when I goto
http://localhost:8080/testejb/testejb.jsp, it
causes an exception to occur:
java.rmi.ServerException: EJBException:; nested exception is:
| javax.ejb.EJBException: Invalid invocation, check your deployment packaging,
method=public abstract nz.co.mcpond.test.ejb.helloejb.Hello
nz.co.mcpond.test.ejb.helloejb.HelloHome.create() throws
javax.ejb.CreateException,java.rmi.RemoteException
| org.jboss.ejb.plugins.LogInterceptor.handleException(LogInterceptor.java:365)
| org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:136)
|
org.jboss.ejb.plugins.ProxyFactoryFinderInterceptor.invokeHome(ProxyFactoryFinderInterceptor.java:107)
| org.jboss.ejb.SessionContainer.internalInvokeHome(SessionContainer.java:637)
| org.jboss.ejb.Container.invoke(Container.java:981)
| sun.reflect.GeneratedMethodAccessor402.invoke(Unknown Source)...
I can get around this by setting, CallByValue to true, however, reading
http://wiki.jboss.org/wiki/Wiki.jsp?page=ClassLoadingConfiguration seems to suggest that
this is a performance hit.
Am I doing something wrong? or not setting something correctly?
Is this because the JNDI datasource is not defined within my EJB jar? (ie: because it is
defined within Pentaho.ear, does this mean that only that application can use the JNDI
(without using CallByValue??)
Any help would be appreciated
Antonio Broughton
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4113222#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...