1 Reply Latest reply on Oct 11, 2004 7:42 AM by Bernd Zeitler

    Could not dereference object

    Michal Palacz Newbie

      Hi,
      I would like to call a session bean in an ear from an app client in another ear. When I run the client, at line:
      Object objref = initial.lookup("java:comp/env/ejb/Mod1");
      I receive:
      Could not dereference object
      [java] javax.naming.NamingException: Could not dereference object [Root exception is javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: pl.poznan.put.cs.idss.oppfda.module.HomeInter (no security manager: RMI class loader disabled)]]
      Almost the same is written in jmx-console->MBeanView.
      To resolve that I could delete both bean interfaces in the client ear and put the path to the bean jar file in the client classpath, but I can't do that because I would like to deploy both ear on two different machines.
      I found in the forum that I should turn on java security manager, so I did, I mean, I changed the end of the server starting script (run.sh) to
      while [ $STATUS -eq 10 ]
      do
      # Execute the JVM
      CONFIG=$1
      if [ "$CONFIG" == "" ]; then CONFIG=default; fi
      PF=../server/$CONFIG/conf/server.policy
      OPTS=-Djava.security.manager
      OPTS="$OPTS -Djava.security.policy=$PF"
      echo JBOSS_CLASSPATH=$JBOSS_CLASSPATH
      java $HOTSPOT $JAXP $OPTS -classpath "$JBOSS_CLASSPATH" org.jboss.Main "$@"
      # "$JAVA" $JAVA_OPTS \
      #-Djava.endorsed.dirs="$JBOSS_ENDORSED_DIRS" \
      #-Djava.security.policy="../server/default/conf/server.policy" \
      #-classpath "$JBOSS_CLASSPATH" \
      #org.jboss.Main "$@"
      STATUS=$?
      # if it doesn't work, you may want to take a look at this:
      # http://developer.java.sun.com/developer/bugParade/bugs/4465334.html
      done
      The server.policy file content is:
      grant {
      // Allow everything for now
      permission java.security.AllPermission;
      };
      Then, the entry in jmx-console->MBeanView changed to:
      +- MyModule (proxy: $Proxy73 implements pl.poznan.put.cs.idss.oppfda.module.HomeInter)
      but the exception is still throwing.

      What I should do to make it working, please? Any help will be appreciated.

      Best regards,
      Michal Palacz

      P.S. The descriptors are as follows:
      application-client.xml:
      <?xml version="1.0" encoding="UTF-8"?>

      <!DOCTYPE application-client PUBLIC
      '-//Sun Microsystems, Inc.//DTD J2EE Application Client 1.3//EN'
      'http://java.sun.com/dtd/application-client_1_3.dtd'>
      <application-client>
      <display-name>OPPfDABroker</display-name>
      <ejb-ref>
      <ejb-ref-name>ejb/Mod1</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      < home>pl.poznan.put.cs.idss.oppfda.broker.HomeInter</ home>
      < remote>pl.poznan.put.cs.idss.oppfda.broker.RemoteInter</ remote>
      </ejb-ref>
      <resource-env-ref>
      <resource-env-ref-name>jms/ModuleTopic</resource-env-ref-name>
      <resource-env-ref-type>javax.jms.Topic</resource-env-ref-type>
      </resource-env-ref>
      </application-client>

      jboss-client.xml:
      <jboss-client>
      <jndi-name>oppfda-client</jndi-name>
      <ejb-ref>
      <ejb-ref-name>ejb/Mod1</ejb-ref-name>
      <jndi-name>MyModule</jndi-name>
      </ejb-ref>
      <resource-env-ref>
      <resource-env-ref-name>jms/ModuleTopic</resource-env-ref-name>
      <jndi-name>topic/ModuleTopic</jndi-name>
      </resource-env-ref>
      </jboss-client>

      ejb-jar.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" version="2.1"
      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">
      <display-name>OPPfDAEJBJAR</display-name>
      <enterprise-beans>
      < session>
      <ejb-name>Mod1</ejb-name>
      < home>pl.poznan.put.cs.idss.oppfda.module.HomeInter</ home>
      < remote>pl.poznan.put.cs.idss.oppfda.module.RemoteInter</ remote>
      <ejb-class>pl.poznan.put.cs.idss.oppfda.module.Mod1</ejb-class>
      <session-type>Stateful</session-type>
      <transaction-type>Bean</transaction-type>
      <security-role-ref>
      <role-name>UserRole</role-name>
      <role-link>TheApplicationRole</role-link>
      </security-role-ref>
      </ session>
      </enterprise-beans>
      <assembly-descriptor>
      <security-role>
      The single application role
      <role-name>TheApplicationRole</role-name>
      </security-role>
      <method-permission>
      <role-name>UserRole</role-name>

      <ejb-name>Mod1</ejb-name>
      <method-name>*</method-name>

      </method-permission>
      </assembly-descriptor>
      </ejb-jar>

      jboss.xml:
      <!DOCTYPE jboss PUBLIC
      "-//JBoss//DTD JBOSS 4.0//EN"
      "http://www.jboss.org/j2ee/dtd/jboss_4_0.dtd">

      <enterprise-beans>
      < session>
      <ejb-name>Mod1</ejb-name>
      <jndi-name>MyModule</jndi-name>
      </ session>
      </enterprise-beans>