Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

mark baum
Posts: 18
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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


p.s. I checked the JDWP exit error, seems to be related to a debugger issue and happening after the exception...
Jaikiran Pai
Posts: 10447
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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$ Source)
at Method)
at 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(

Which version of Java do you use on the client as well as the server?
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!