0 Replies Latest reply on Apr 23, 2008 8:12 AM by markus baumgartner

    Why can't existing Remote Interface of a deployed session be

    markus baumgartner Newbie


      I'm trying 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?

      Thanks for help



      import java.io.Serializable;
      @NamedQuery(name="Person.findall_sortlastname", query="SELECT p FROM Person p")

      public class Person implements Serializable{

      private static final long serialVersionUID = 1L;

      public Person() {};

      public Person(String firstName, String lastName) {

      private int technicalId;
      public int getTechnicalId() {
      return technicalId;
      public void setTechnicalId(int technicalId) {
      this.technicalId = technicalId;
      private String firstName;
      public String getFirstName() {
      return firstName;
      public void setFirstName(String firstName) {
      this.firstName = firstName;

      private String lastName;
      public String getLastName() {
      return lastName;
      public void setLastName(String lastName) {
      this.lastName = lastName;

      public String toString() {
      return "firstname: "+getFirstName()+"; lastname: "+getLastName()+"; id: "+getTechnicalId();

      public interface PersonFeederRemote {

      public void feedPersonList(Vector personList);
      public void deletePersonList(Vector personList);
      public void listAllPerson();
      public void testInstanceAlive();



      public class PersonFeederBean implements PersonFeederRemote {

      EntityManager manager;

      public void feedPersonList(Vector personList) {

      for (Person person: personList) {
      System.out.println("added "+person.toString());

      public void deletePersonList(Vector personList) {
      for (Person person: personList) {
      System.out.println("added "+person.toString());

      public void listAllPerson() {
      List resultList = manager.createNamedQuery("Person.findAll_sortlastname").getResultList();
      for( Object o: resultList) {


      public void testInstanceAlive() {
      System.out.println("PersonFeederBean is alive");



      14:14:28,109 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=person.jar,name=PersonFeederBean,service=EJB3 with dependencies:
      14:14:28,109 INFO [JmxKernelAbstraction] persistence.units:jar=person.jar,unitName=ForumorganizerTest
      14:14:28,140 INFO [EJBContainer] STARTED EJB: com.informationcontrol.forumorganizer.persistence.PersonFeederBean ejbName: PersonFeederBean
      14:14:28,250 INFO [EJB3Deployer] Deployed: file:/C:/Programme/JBoss/JBoss404/server/default/deploy/person.jar

      public class ClientPersonFeeder {

      * @param args
      public static void main(String[] args) {

      Context ctx =null;
      Object ref = null;
      try {
      ctx = new InitialContext();
      ref = ctx.lookup("PersonFeederBean/remote");
      } catch (NamingException e) {
      System.out.println("could not find PersonFeederBean/remote");
      try {
      NamingEnumeration nameList = ctx.listBindings("");
      while (nameList.hasMore()) {
      Binding binding = (Binding) nameList.next();
      System.out.println(binding.getName()+"; "+binding.getObject());
      } catch (NamingException e) {
      System.out.println("Could not find root directory");

      PersonFeederRemote pfr = (PersonFeederRemote) PortableRemoteObject.narrow(ref, PersonFeederRemote.class);
      if (pfr == null) {
      System.out.println("PersonFeederRemote is null");
      } else {
      Method[] methods = pfr.getClass().getMethods();
      for (Method method: methods) { System.out.println(method.getName());}
      Vector personList = new Vector();
      Person person = new Person("First", "Last");
      person = new Person("Peter", "Muster");

      // !!!!!!!!!!! the first call to a method of the bean causes the error: !!!!!!


      Exception in thread "main" java.lang.reflect.UndeclaredThrowableException
      at $Proxy0.testInstanceAlive(Unknown Source)
      at com.informationcontrol.forumorganizer.clientfortest.ClientPersonFeeder.main(ClientPersonFeeder.java:67)
      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)
      ERROR: JDWP Unable to get JNI 1.2 environment, jvm->GetEnv() return code = -2
      JDWP exit error AGENT_ERROR_NO_JNI_ENV(183): [../../../src/share/back/util.c:820]