Even if jBoss and Tomcat run in the same VM, there are ClassLoader
differences. Currently each Tomcat web app and each jBoss EJB JAR uses a
separate ClassLoader. There's no way to pass objects between ClassLoaders
without serializing, so you can't get a reference to a pool you configured
in jBoss from your JSP.
There are two solutions:
1) Wait. Eventually if you package your servlets and JSPs and EJBs into a
single EAR, Tomcat and jBoss should share a ClassLoader for all code in
the web app. This will be great for performance, plus allow things like
you're trying. However, it seems to be quite complex, so I wouldn't hold
your breath.
2) Create a separate Minerva pool for your JSPs. You can put the Minerva
binary distribution (see the link on the web page) in you WEB-INF/lib
directory, and then create a helper class with a static initializer that
creates a Minerva pool for your JSPs. Then the helper class or the JSP
can look up connections via JNDI or via the Minerva DriverManager URL. I
would recommend a helper class since that could be easily changed to use
solution #1 when that becomes available.
Aaron
On Tue, 19 Sep 2000, Rodrigo B. de Oliveira wrote:
> But it's not a bean. I'm having the same problem trying to acquire a
> connection inside a JSP (Tomcat running inproc to jboss).
>
> Is it doable at all?
>
> Here's the code for my JSP page:
> <%@ page import="javax.naming.*,java.sql.*,javax.sql.*" %>
> <%
> InitialContext context = new InitialContext();
> Object dsObject = context.lookup("InstantDB");
> %>
> <html>
> <body>
> Hello, JBOSS!!<br />
> DataSource is <%=dsObject.toString()%>. Class is
> <%=dsObject.getClass().getName()%><br />
>
> Dumping references...<br />
> <%
> Reference ref = (Reference)dsObject;
> %>
>
> Storing <%=ref.size()%> references of class <%=ref.getClassName()%>.<br />
>
> Narrowing...
> <%
> 'Exception...
> DataSource ds = (DataSource)javax.rmi.PortableRemoteObject.narrow(dsObject,
> DataSource.class);
> %>
>
> </table>
> </body>
> </html>
>
> Thanks,
> Rodrigo
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]