You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@geronimo.apache.org by Willi Nüßer <Wi...@gmx.net> on 2006/11/10 14:36:25 UTC

ClassCastException in org.openejb.client.CgLibProxy

Hi all,

I know it must be something trivial (config ...) but I'm at a loss.
Can't find anything related in the web, groups etc.

The problem:
running a very simple standalone HelloWorld client against
a corresponding EJB app in Geronimo 1.1.1 gives
the following error message:

> java echo.client.SayHelloClient
java.lang.ClassCastException: org.openejb.client.CgLibProxy$$EnhancerByCGLIB$$28a286c9
        at org.openejb.client.CgLibProxy$$EnhancerByCGLIB$$eaec4f0a.create(<generated>)
        at de.fhdw.echo.client.SayHelloClient.getEJBReference(SayHelloClient.java:43)
        at echo.client.SayHelloClient.main(SayHelloClient.java:53)
Exception in thread "main" java.lang.NullPointerException
        at echo.client.SayHelloClient.main(SayHelloClient.java:55)

There are no errors logged to the log file. JNDI access seems
to work, deployment in geronimo, too.

So, can anyone pls give me a hint.

TIA
  Willi

PS:
Relevant source client code:

private static final String PURE_JNDI_HELLOBEAN = "echo.HelloBean";
private static HelloBean hellobean;

private static void getEJBReference () {

  Properties props = new Properties();
  props.put("java.naming.factory.initial",
             "org.openejb.client.RemoteInitialContextFactory");
  props.put("java.naming.provider.url", "127.0.0.1:4201");
  props.put("java.naming.security.principal", "system");
  props.put("java.naming.security.credentials", "manager");

  try {
     javax.naming.InitialContext initialContext =
        new javax.naming.InitialContext(props);
     Object objRef = initialContext.lookup(PURE_JNDI_HELLOBEAN);
     HelloBeanHome hellobeanHome = (HelloBeanHome)
         PortableRemoteObject.narrow(objRef, HelloBeanHome.class);
>> crash here     
     hellobean = hellobeanHome.create();
  } catch (Exception ex) {
     ex.printStackTrace();
  }

 }


-- 
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl

Re: ClassCastException in org.openejb.client.CgLibProxy

Posted by Willi Nüßer <wi...@gmx.net>.
Christoph, Manu

thanks for your reply.

To Manu: 
Geronimo reports the Application to be running
in the console. Furthermore: the usual JNDI naming problems
were solved before. So I can't see any connection to 2297.
But perhaps I'm only looking at the wrong places ...

To Chris:
the ejb-bar.xml seems to give the correct information. It is appended below.


Best
	Willi


=== ejb-jar.xml ===
<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar id="ejb-jar_1"
  xmlns="http://java.sun.com/xml/ns/j2ee"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd"
  version="2.1">

  <description>J2EE Hello-Beispiel</description>
  <display-name>J2EEHelloBean</display-name>
  <enterprise-beans>
    <session id="Session_Hello">
      <description>Eine triviale EJB HelloBean</description>
      <display-name>HelloBean</display-name>
      <ejb-name>HelloBean</ejb-name>
      <home>echo.HelloBeanHome</home>
      <remote>echo.HelloBeanRemote</remote>
      <local-home>echo.HelloBeanLocalHome</local-home>
      <local>echo.HelloBeanLocal</local>
      <ejb-class>echo.HelloBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>
    </session>
  </enterprise-beans>



Am Montag, 13. November 2006 07:54 schrieb Manu George:
> Hi,
>      Check whether it is because of this issue
> http://issues.apache.org/jira/browse/GERONIMO-2297
> 
> Thanks
> Manu
> 
> 
> On 11/12/06, Christoph Reich <rc...@hs-furtwangen.de> wrote:
> > Hi Willi,
> >
> > your client looks good to me. Have you checked, that you are
> > using remote and remote-home interfaces in the EJB? If you
> > are using lokal interfaces I think you get a similar error
> > message
> >
> > Cheers,
> > Chris
> >
> > On Fri, 10 Nov 2006 14:36:25 +0100, Willi Nüßer wrote
> > > Hi all,
> > >
> > > I know it must be something trivial (config ...) but I'm at a loss.
> > > Can't find anything related in the web, groups etc.
> > >
> > > The problem:
> > > running a very simple standalone HelloWorld client against
> > > a corresponding EJB app in Geronimo 1.1.1 gives
> > > the following error message:
> > >
> > > > java echo.client.SayHelloClient
> > > java.lang.ClassCastException:
> > org.openejb.client.CgLibProxy$$EnhancerByCGLIB$$28a286c9
> > >         at
> > > org.openejb.client.CgLibProxy$$EnhancerByCGLIB$$eaec4f0a.create(<generated>)
> >        at
...
> > PS:
> > Relevant source client code:
> >
> > private static final String PURE_JNDI_HELLOBEAN = "echo.HelloBean";
> > private static HelloBean hellobean;
> >
> > private static void getEJBReference () {
> >
> >   Properties props = new Properties();
> >   props.put("java.naming.factory.initial",
> >              "org.openejb.client.RemoteInitialContextFactory");
> >   props.put("java.naming.provider.url", "127.0.0.1:4201");
> >   props.put("java.naming.security.principal", "system");
> >   props.put("java.naming.security.credentials", "manager");
> >
> >   try {
> >      javax.naming.InitialContext initialContext =
> >         new javax.naming.InitialContext(props);
> >      Object objRef = initialContext.lookup(PURE_JNDI_HELLOBEAN);
> >      HelloBeanHome hellobeanHome = (HelloBeanHome)
> >          PortableRemoteObject.narrow(objRef, HelloBeanHome.class);
> > >> crash here
> >      hellobean = hellobeanHome.create();
> >   } catch (Exception ex) {
> >      ex.printStackTrace();
> >   }
> >
> >  }
> >
> > --

Re: ClassCastException in org.openejb.client.CgLibProxy

Posted by Manu George <ma...@gmail.com>.
Hi,
     Check whether it is because of this issue
http://issues.apache.org/jira/browse/GERONIMO-2297

Thanks
Manu


On 11/12/06, Christoph Reich <rc...@hs-furtwangen.de> wrote:
> Hi Willi,
>
> your client looks good to me. Have you checked, that you are
> using remote and remote-home interfaces in the EJB? If you
> are using lokal interfaces I think you get a similar error
> message
>
> Cheers,
> Chris
>
> On Fri, 10 Nov 2006 14:36:25 +0100, Willi Nüßer wrote
> > Hi all,
> >
> > I know it must be something trivial (config ...) but I'm at a loss.
> > Can't find anything related in the web, groups etc.
> >
> > The problem:
> > running a very simple standalone HelloWorld client against
> > a corresponding EJB app in Geronimo 1.1.1 gives
> > the following error message:
> >
> > > java echo.client.SayHelloClient
> > java.lang.ClassCastException:
> org.openejb.client.CgLibProxy$$EnhancerByCGLIB$$28a286c9
> >         at
> > org.openejb.client.CgLibProxy$$EnhancerByCGLIB$$eaec4f0a.create(<generated>)
>        at
> de.fhdw.echo.client.SayHelloClient.getEJBReference(SayHelloClient.java:43)
>     at echo.client.SayHelloClient.main(SayHelloClient.java:53) Exception in
> thread "main" java.lang.NullPointerException        at
> echo.client.SayHelloClient.main(SayHelloClient.java:55)
> >
> > There are no errors logged to the log file. JNDI access seems
> > to work, deployment in geronimo, too.
> >
> > So, can anyone pls give me a hint.
> >
> > TIA
> >   Willi
> >
> > PS:
> > Relevant source client code:
> >
> > private static final String PURE_JNDI_HELLOBEAN = "echo.HelloBean";
> > private static HelloBean hellobean;
> >
> > private static void getEJBReference () {
> >
> >   Properties props = new Properties();
> >   props.put("java.naming.factory.initial",
> >              "org.openejb.client.RemoteInitialContextFactory");
> >   props.put("java.naming.provider.url", "127.0.0.1:4201");
> >   props.put("java.naming.security.principal", "system");
> >   props.put("java.naming.security.credentials", "manager");
> >
> >   try {
> >      javax.naming.InitialContext initialContext =
> >         new javax.naming.InitialContext(props);
> >      Object objRef = initialContext.lookup(PURE_JNDI_HELLOBEAN);
> >      HelloBeanHome hellobeanHome = (HelloBeanHome)
> >          PortableRemoteObject.narrow(objRef, HelloBeanHome.class);
> > >> crash here
> >      hellobean = hellobeanHome.create();
> >   } catch (Exception ex) {
> >      ex.printStackTrace();
> >   }
> >
> >  }
> >
> > --
> > GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
> > NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl
>
>
>

Re: ClassCastException in org.openejb.client.CgLibProxy

Posted by Christoph Reich <rc...@hs-furtwangen.de>.
Hi Willi,

your client looks good to me. Have you checked, that you are
using remote and remote-home interfaces in the EJB? If you
are using lokal interfaces I think you get a similar error
message

Cheers,
Chris

On Fri, 10 Nov 2006 14:36:25 +0100, Willi Nüßer wrote
> Hi all,
> 
> I know it must be something trivial (config ...) but I'm at a loss.
> Can't find anything related in the web, groups etc.
> 
> The problem:
> running a very simple standalone HelloWorld client against
> a corresponding EJB app in Geronimo 1.1.1 gives
> the following error message:
> 
> > java echo.client.SayHelloClient
> java.lang.ClassCastException:
org.openejb.client.CgLibProxy$$EnhancerByCGLIB$$28a286c9
>         at 
> org.openejb.client.CgLibProxy$$EnhancerByCGLIB$$eaec4f0a.create(<generated>)
       at
de.fhdw.echo.client.SayHelloClient.getEJBReference(SayHelloClient.java:43)   
    at echo.client.SayHelloClient.main(SayHelloClient.java:53) Exception in
thread "main" java.lang.NullPointerException        at
echo.client.SayHelloClient.main(SayHelloClient.java:55)
> 
> There are no errors logged to the log file. JNDI access seems
> to work, deployment in geronimo, too.
> 
> So, can anyone pls give me a hint.
> 
> TIA
>   Willi
> 
> PS:
> Relevant source client code:
> 
> private static final String PURE_JNDI_HELLOBEAN = "echo.HelloBean";
> private static HelloBean hellobean;
> 
> private static void getEJBReference () {
> 
>   Properties props = new Properties();
>   props.put("java.naming.factory.initial",
>              "org.openejb.client.RemoteInitialContextFactory");
>   props.put("java.naming.provider.url", "127.0.0.1:4201");
>   props.put("java.naming.security.principal", "system");
>   props.put("java.naming.security.credentials", "manager");
> 
>   try {
>      javax.naming.InitialContext initialContext =
>         new javax.naming.InitialContext(props);
>      Object objRef = initialContext.lookup(PURE_JNDI_HELLOBEAN);
>      HelloBeanHome hellobeanHome = (HelloBeanHome)
>          PortableRemoteObject.narrow(objRef, HelloBeanHome.class);
> >> crash here     
>      hellobean = hellobeanHome.create();
>   } catch (Exception ex) {
>      ex.printStackTrace();
>   }
> 
>  }
> 
> -- 
> GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
> NEU: Jetzt bis zu 16.000 kBit/s! http://www.gmx.net/de/go/dsl