1 Reply Latest reply on Nov 19, 2004 12:49 AM by Kalyan

    Please Help ME:javax.naming.CommunicationException [Root exc

    Angelo Immediata Newbie

      Hi All; i have this problem; i have a pc where there is an EJB; i want to use this ejb on another pc... in order to this in my web app i use this web.xml

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
      <web-app>
      <display-name>TestEjbCall</display-name>
      <servlet>
      <servlet-name>Cocoon</servlet-name>
      <display-name>Cocoon</display-name>
      <description>Cocoon</description>
      <servlet-class>org.apache.cocoon.servlet.CocoonServlet</servlet-class>
      <init-param>
      <param-name>init-classloader</param-name>
      <param-value>false</param-value>
      </init-param>
      <init-param>
      <param-name>configurations</param-name>
      <param-value>/WEB-INF/cocoon.xconf</param-value>
      </init-param>
      <init-param>
      <param-name>logkit-config</param-name>
      <param-value>/WEB-INF/logkit.xconf</param-value>
      </init-param>
      <init-param>
      <param-name>servlet-logger</param-name>
      <param-value>access</param-value>
      </init-param>
      <init-param>
      <param-name>cocoon-logger</param-name>
      <param-value>core</param-value>
      </init-param>
      <init-param>
      <param-name>log-level</param-name>
      <param-value>WARN</param-value>
      </init-param>
      <init-param>
      <param-name>allow-reload</param-name>
      <param-value>no</param-value>
      </init-param>
      <init-param>
      <param-name>load-class</param-name>
      <param-value>org.hsqldb.jdbcDriver</param-value>
      </init-param>
      <init-param>
      <param-name>enable-uploads</param-name>
      <param-value>false</param-value>
      </init-param>
      <init-param>
      <param-name>autosave-uploads</param-name>
      <param-value>true</param-value>
      </init-param>
      <init-param>
      <param-name>overwrite-uploads</param-name>
      <param-value>rename</param-value>
      </init-param>
      <init-param>
      <param-name>manage-exceptions</param-name>
      <param-value>true</param-value>
      </init-param>
      <load-on-startup>1</load-on-startup>
      </servlet>
      <servlet-mapping>
      <servlet-name>Cocoon</servlet-name>
      <url-pattern>/</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>Cocoon</servlet-name>
      <url-pattern>*.jsp</url-pattern>
      </servlet-mapping>
      <servlet-mapping>
      <servlet-name>Cocoon</servlet-name>
      <url-pattern>*.html</url-pattern>
      </servlet-mapping>
      <mime-mapping>
      <extension>css</extension>
      <mime-type>text/css</mime-type>
      </mime-mapping>
      <mime-mapping>
      <extension>xml</extension>
      <mime-type>text/xml</mime-type>
      </mime-mapping>
      <mime-mapping>
      <extension>xsl</extension>
      <mime-type>text/xml</mime-type>
      </mime-mapping>
      <mime-mapping>
      <extension>xconf</extension>
      <mime-type>text/xml</mime-type>
      </mime-mapping>
      <mime-mapping>
      <extension>xmap</extension>
      <mime-type>text/xml</mime-type>
      </mime-mapping>
      <mime-mapping>
      <extension>ent</extension>
      <mime-type>text/plain</mime-type>
      </mime-mapping>
      <mime-mapping>
      <extension>grm</extension>
      <mime-type>text/plain</mime-type>
      </mime-mapping>
      <ejb-ref>
      <ejb-ref-name>ejb/TestBean</ejb-ref-name>
      <ejb-ref-type>Session</ejb-ref-type>
      <home>it.eng.demo.nikko.TestHome</home>
      <remote>it.eng.demo.nikko.TestRemote</remote>
      </ejb-ref>

      </web-app>


      while my jboss-web.xml is:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3V2//EN" "http://www.jboss.org/j2ee/dtd/jboss-web_3_2.dtd">
      <jboss-web>
      <context-root>TestEjbCall</context-root>
      <ejb-ref>
      <ejb-ref-name>ejb/TestBean</ejb-ref-name>
      <jndi-name>jnp://xxx.xxx.xx.xxx:1099/TestBean</jndi-name>
      </ejb-ref>
      </jboss-web>


      where xxx.xxx.xx.xxx is the addres of the pc where my ejb is deployed; in this pc the ejb is successufull deployed; infact i have no error... but if i try to call it on the pc with address: xxx.xxx.xx.yyy (same domain but only different addres) i have this exception


      2004-11-18 10:48:57,968 INFO [org.apache.jk.server.JkMain] Jk running ID=0 time=0/31 config=null
      2004-11-18 10:49:44,703 INFO [it.eng.nikko.demo.util.SessionBeanCaller] Getting context
      2004-11-18 10:49:44,703 INFO [it.eng.nikko.demo.util.SessionBeanCaller] Getting home interface
      2004-11-18 10:49:45,093 ERROR [it.eng.nikko.demo.util.SessionBeanCaller] javax.naming.CommunicationException [Root exception is java.lang.ClassNotFoundException: it.eng.demo.nikko.TestHome (no security manager: RMI class loader disabled)]


      I try to call the ejb by using this class:

      package it.eng.nikko.demo.util;
      
      import javax.naming.InitialContext;
      import javax.naming.NamingException;
      import javax.rmi.PortableRemoteObject;
      
      import java.util.Properties;
      
      import it.eng.demo.nikko.TestRemote;
      import it.eng.demo.nikko.TestHome;
      
      import org.apache.log4j.Logger;
      import java.rmi.RemoteException;
      import javax.ejb.CreateException;
      
      public class SessionBeanCaller {
      
       private static final String MODULE = SessionBeanCaller.class.getName();
       private Logger log = Logger.getLogger( MODULE );
      
       private TestRemote test;
       private InitialContext ctx;
       public SessionBeanCaller() {
       }
      
       private InitialContext getCtx() throws NamingException {
      
       Properties p = new Properties();
       p.put( "java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory" );
       //p.put( "java.naming.provider.url","localhost:1099" );
       p.put( "java.naming.provider.url","192.168.11.201:1099" );
       return new InitialContext( p );
       }
      
       public void ejbInteraction( String msg ){
      
       try {
      
       log.info( "Getting context" );
       ctx = getCtx();
      
       log.info( "Getting home interface" );
       Object reference = ctx.lookup( "TestBean" );
       TestHome ejbHome = ( TestHome )( PortableRemoteObject.narrow( reference, TestHome.class ) );
      
       log.info( "Creating interface" );
       test = ejbHome.create();
       log.info( "Invoking remote method" );
       System.out.println( test.getStringHello( msg ) );
       } catch (NamingException ex) {
      
       log.error( ex );
       } catch (RemoteException ex) {
      
       log.error( ex );
       } catch (CreateException ex) {
      
       log.error( ex );
       }
      
       }
      }


      Must i include the ejb .jar file also in my web-app on the address xxx.xxx.xx.yyy?
      Please can anybody help me??