aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Can't invoke a method on an -existing- bean (JEE) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Can Watch "Can New topic
Author

Can't invoke a method on an -existing- bean (JEE)

mark baum
Greenhorn

Joined: Aug 21, 2001
Posts: 18
Hi,

I'm learning JEE and tried a basic example with an entity bean Person
and a stateless bean PersonFeederBean that is getting a list of persons and to persist them, print them and maybe remove them.

The PersonFeederBean is called by ClientPersonFeeder creating the list of person to store.

The code compiles in eclipse 3.2 with java compliance level 5, the jar can is deployed (on JBoss 404), the PersonFeederBean can be looked up and narrowed; to make sure it is not empty I added a test retrieving the methods; they are there.

But when I want to call one of these methods I get the error:

"$Proxy0.testInstanceAlive(Unknown Source)" as listed at the end of the code section.

Can anybody tell me, what went wrong?
I also wonder, what I might do to get rid of the java.lang.reflect.UndeclaredThrowableException, is there a strategy or documentation about it?

The last thing that bothers me, is the way the method narrow works: PortableRemoteObject.narrow(ref, [SESSIONBEANREMOTE].class);
Since I declared a Remote interface, but never a class with that name, there seems to be a pattern for this. Is there some good documentation about it?

Thanks for help

Markus



p.s. I checked the JDWP exit error, seems to be related to a debugger issue and happening after the exception...
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10201
    
166

PersonFeederRemote pfr = (PersonFeederRemote) PortableRemoteObject.narrow(ref, PersonFeederRemote.class);


Since you are using EJB3, you no longer have to use the narrow method. You can directly cast the object returned from the JNDI lookup, to your remote interface.

However, this may not be the actual reason why you are seeing the exception.

Caused by: java.lang.ClassNotFoundException: [Ljava.lang.StackTraceElement;
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.jboss.remoting.loading.RemotingClassLoader.loadClass(RemotingClassLoader.java:50)


Which version of Java do you use on the client as well as the server?


[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Can't invoke a method on an -existing- bean (JEE)