You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Marcelo de Oliveira Dias <ma...@students.ic.unicamp.br> on 2009/06/05 23:31:19 UTC

Problem with IntraVmProxy when using openEJB in a embedded way.

Hi folks.

Let me explain my problem:
I'm using OpenEJB embedded with Jetty. I have created a WebApp that have a
Servlet which instantiates the OpenEJB, deploy all of its EJBs (just one in
that case, called Catalogo), and deploy other EJBs from others WebApps that
are running on Jetty (just one in that case, called CatalogoLivraria).

And it has a service to handle the EJB requests:*
    protected void service(HttpServletRequest request, HttpServletResponse
response) throws ServletException, IOException {
        ServletInputStream in = request.getInputStream();
        ServletOutputStream out = response.getOutputStream();
        try {
            ejbServer.service(in, out);
        } catch (ServiceException e) {
            throw new ServletException("ServerService error: " +
ejbServer.getClass().getName() + " -- " + e.getMessage(), e);
        }
    }*

The deployment seems that works, I get the Log messages:
*
*For the EJB that belong to my "Embedder openejb webapp"
*INFO - Jndi(name=CatalogoLocal) --> Ejb(deployment-id=Catalogo)
INFO - Jndi(name=CatalogoRemote) --> Ejb(deployment-id=Catalogo)
INFO - Created Ejb(deployment-id=Catalogo, ejb-name=Catalogo,
container=Default Stateless Container)*

For the EJB that belong to another webapp
*INFO - Jndi(name=CatalogoLivrariaLocal) -->
Ejb(deployment-id=CatalogoLivraria)
INFO - Jndi(name=CatalogoLivrariaRemote) -->
Ejb(deployment-id=CatalogoLivraria)
INFO - Created Ejb(deployment-id=CatalogoLivraria,
ejb-name=CatalogoLivraria, container=Default Stateless Container)

*When I run a simple J2SE ejb client that "look up" at "Catalogo" it works
ok!
But when I run it "looking up" at "CatalogoLivraria" a get this exception:

*javax.naming.NamingException: Unknown error in container [Root exception is
java.lang.IllegalArgumentException: interface
org.apache.openejb.core.ivm.IntraVmProxy is not visible from class loader]

*I guess that my problem is related to how my Servlet deploys the EJBs.
And how this proxy is instantiated by "Proxy.newProxyInstance()" in the
class "org.apache.openejb.util.proxy.Jdk13ProxyFactory".
Which is likely a ClassLoader problem.

I'm sure that the *IntraVmProxy *is visible. Taking a look at the peace of
code that throws that exception in "Proxy.newProxyInstance()" we have:

*String interfaceName = interfaces[i].getName();
  367               Class interfaceClass = null;
  368               try {
  369                   interfaceClass = Class.forName(interfaceName,
false, loader);
  370               } catch (ClassNotFoundException e) {
**  371               }
  372               if (interfaceClass != interfaces[i]) {
  373                   throw new IllegalArgumentException(
  374                       interfaces[i] + " is not visible from
class loader");
  375               }*

 So maybe, if it is visible, it is visible by a wrong ClassLoader.

I know that what I'm trying to do isn't easy. So any thing that helps me to
understand why I'm having this problem with "Proxy.newProxyInstance()" will
be very "helpful" :-)

Thank you a lot in advance,
Marcelo

Re: Problem with IntraVmProxy when using openEJB in a embedded way.

Posted by Marcelo Dias <ma...@gmail.com>.
Ok, sure!

Sorry for not mentioned my GSoC project before. It was my fault.
As you saw, my project is based on Openejb plugin for Tomcat, and it'd be
nice if you could introduce me someone who can answer my questions about
this integration.

Thank you for helping me,
Marcelo

Re: Problem with IntraVmProxy when using openEJB in a embedded way.

Posted by David Blevins <da...@visi.com>.
On Jun 6, 2009, at 7:55 AM, Marcelo Dias wrote:

> No, I only have openejb libraries in the webapp that embedded  
> OpenEJB. But I
> already tried it. Now, I'm following the paradigm of trial and  
> error, and I
> have no success yet. Because of that, I need some insight of why I'm  
> getting
> this error. To at least follow a idea of how solve it.

Ok, I see.  It looks like you're working on creating a Jetty and  
OpenEJB integration as part of Google Summer of Code.

   http://wiki.eclipse.org/Embed_OpenEJB_in_J2EE_Preview_Server_Adapter

That would definitely be a great feature and we're certainly happy to  
help.  Let's move this thread to the dev list as it's more about  
developing new features that don't yet exist rather than supporting  
ones that do.

-David


Re: Problem with IntraVmProxy when using openEJB in a embedded way.

Posted by Marcelo Dias <ma...@gmail.com>.
Thank you David for your answer.

No, I only have openejb libraries in the webapp that embedded OpenEJB. But I
already tried it. Now, I'm following the paradigm of trial and error, and I
have no success yet. Because of that, I need some insight of why I'm getting
this error. To at least follow a idea of how solve it.

Thank you,
Marcelo

Re: Problem with IntraVmProxy when using openEJB in a embedded way.

Posted by David Blevins <da...@visi.com>.
On Jun 5, 2009, at 2:31 PM, Marcelo de Oliveira Dias wrote:

> Hi folks.
>
> Let me explain my problem:
> I'm using OpenEJB embedded with Jetty. I have created a WebApp that  
> have a
> Servlet which instantiates the OpenEJB, deploy all of its EJBs (just  
> one in
> that case, called Catalogo), and deploy other EJBs from others  
> WebApps that
> are running on Jetty (just one in that case, called CatalogoLivraria).
>
> And it has a service to handle the EJB requests:*
>    protected void service(HttpServletRequest request,  
> HttpServletResponse
> response) throws ServletException, IOException {
>        ServletInputStream in = request.getInputStream();
>        ServletOutputStream out = response.getOutputStream();
>        try {
>            ejbServer.service(in, out);
>        } catch (ServiceException e) {
>            throw new ServletException("ServerService error: " +
> ejbServer.getClass().getName() + " -- " + e.getMessage(), e);
>        }
>    }*
>
> The deployment seems that works, I get the Log messages:
> *
> *For the EJB that belong to my "Embedder openejb webapp"
> *INFO - Jndi(name=CatalogoLocal) --> Ejb(deployment-id=Catalogo)
> INFO - Jndi(name=CatalogoRemote) --> Ejb(deployment-id=Catalogo)
> INFO - Created Ejb(deployment-id=Catalogo, ejb-name=Catalogo,
> container=Default Stateless Container)*
>
> For the EJB that belong to another webapp
> *INFO - Jndi(name=CatalogoLivrariaLocal) -->
> Ejb(deployment-id=CatalogoLivraria)
> INFO - Jndi(name=CatalogoLivrariaRemote) -->
> Ejb(deployment-id=CatalogoLivraria)
> INFO - Created Ejb(deployment-id=CatalogoLivraria,
> ejb-name=CatalogoLivraria, container=Default Stateless Container)
>
> *When I run a simple J2SE ejb client that "look up" at "Catalogo" it  
> works
> ok!
> But when I run it "looking up" at "CatalogoLivraria" a get this  
> exception:
>
> *javax.naming.NamingException: Unknown error in container [Root  
> exception is
> java.lang.IllegalArgumentException: interface
> org.apache.openejb.core.ivm.IntraVmProxy is not visible from class  
> loader]
>
> *I guess that my problem is related to how my Servlet deploys the  
> EJBs.
> And how this proxy is instantiated by "Proxy.newProxyInstance()" in  
> the
> class "org.apache.openejb.util.proxy.Jdk13ProxyFactory".
> Which is likely a ClassLoader problem.
>
> I'm sure that the *IntraVmProxy *is visible. Taking a look at the  
> peace of
> code that throws that exception in "Proxy.newProxyInstance()" we have:
>
> *String interfaceName = interfaces[i].getName();
>  367               Class interfaceClass = null;
>  368               try {
>  369                   interfaceClass = Class.forName(interfaceName,
> false, loader);
>  370               } catch (ClassNotFoundException e) {
> **  371               }
>  372               if (interfaceClass != interfaces[i]) {
>  373                   throw new IllegalArgumentException(
>  374                       interfaces[i] + " is not visible from
> class loader");
>  375               }*
>
> So maybe, if it is visible, it is visible by a wrong ClassLoader.
>
> I know that what I'm trying to do isn't easy. So any thing that  
> helps me to
> understand why I'm having this problem with  
> "Proxy.newProxyInstance()" will
> be very "helpful" :-)

Sounds very tricky indeed.  Do you by chance have a copy of the  
openejb libraries in each webapp?  That would definitely cause some  
conflicts when trying to share beans between the webapps.

-David