2 Replies Latest reply on Sep 5, 2007 10:17 AM by paolo quadrio

    error accessing session stateless ejb in separate server

    paolo quadrio Newbie

      Hi guys,
      I'm developping a J2EE application running into a appl.server jboss-4.0.1sp1 (JVM 1.4.2)and I'm facing a problem that I don't know how to fix it.
      For specialization and reuse reasons, I've created a session-stateless ejb and a message bean packed in a .ear file and, in another ear, I've packed all my web-application code, separated in a war (presentation) and another session stateless ejb (business logic).

      If I deploy the 2 ear files in the same server my appl work fine, but if I deploy the ears in separate servers, I cannot reach the session stateles EJB with the following error, but I can send a message to the message bean

      javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: it.aztech.signer.AZTECH_SignerRemoteHome (no security manager: RMI class loader disabled)]


      I can lookup and use correctly the ejb, and the message bean, from a standalone java application

      This is my code for lookup the ejb

      public AZTECH_SignerRemote getSignerRemote(String who) throws Exception
      {
      String NAMING_CONTEXT_FACTORY = "org.jnp.interfaces.NamingContextFactory";
      String PROVIDER_URL = "192.168.202.241";
      String EJBNAME_SIGNER = "AZTECH_SignerBean";
      Hashtable env = new Hashtable();
      env.put("java.naming.factory.initial", NAMING_CONTEXT_FACTORY);
      env.put("java.naming.provider.url", PROVIDER_URL);
      if (who != null)
      {
      env.put(Context.SECURITY_CREDENTIALS, who);
      env.put(Context.SECURITY_PRINCIPAL, who);
      }
      Context jndiContext = new InitialContext(env);
      Object ref = jndiContext.lookup(EJBNAME_SIGNER);
      AZTECH_SignerRemoteHome home = (AZTECH_SignerRemoteHome) PortableRemoteObject.narrow(ref, AZTECH_SignerRemoteHome.class);
      AZTECH_SignerRemote remote = home.create();
      return remote;
      }

      *************************************************
      And this is my ejb-jar.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <ejb-jar version="2.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">
      <display-name>AZTECH-ejb</display-name>
      <enterprise-beans>

      <display-name>AZTECH_SignerSB</display-name>
      <ejb-name>AZTECH_SignerBean</ejb-name>
      it.aztech.signer.AZTECH_SignerRemoteHome
      it.aztech.signer.AZTECH_SignerRemote
      <ejb-class>it.aztech.signer.AZTECH_SignerBean</ejb-class>
      <session-type>Stateless</session-type>
      <transaction-type>Container</transaction-type>

      <message-driven>
      <display-name>AZTECH_MailerMDB</display-name>
      <ejb-name>AZTECH_MailerBean</ejb-name>
      <ejb-class>it.aztech.mailer.AZTECH_MailerBean</ejb-class>
      <transaction-type>Container</transaction-type>
      <message-destination-type>javax.jms.Queue</message-destination-type>
      <message-destination-link>AZTECH_MailerDestination</message-destination-link>
      <activation-config>
      <activation-config-property>
      <activation-config-property-name>acknowledgeMode</activation-config-property-name>
      <activation-config-property-value>Auto-acknowledge</activation-config-property-value>
      </activation-config-property>
      <activation-config-property>
      <activation-config-property-name>destinationType</activation-config-property-name>
      <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
      </activation-config-property>
      </activation-config>
      </message-driven>
      </enterprise-beans>
      <assembly-descriptor>
      <container-transaction>

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

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <container-transaction>

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

      <trans-attribute>Required</trans-attribute>
      </container-transaction>
      <message-destination>
      <display-name>Destination for AZTECH_Mailer</display-name>
      <message-destination-name>AZTECH_MailerDestination</message-destination-name>
      </message-destination>
      </assembly-descriptor>
      </ejb-jar>


      ***************************************************
      Can someone helps me in fixing this error? Thanks in advance