2 Replies Latest reply on Oct 3, 2005 1:24 PM by Michel Fornaris

    java.lang.NoClassDefFoundError: javax/servlet/ServletInputSt

    Michel Fornaris Newbie

      Hi there,
      I'm testing EJB3 with Eclipse and JBoss 4.0.3 RC2. I created a super simple @Stateless Bean as show below:

      package test;
      
      import javax.ejb.Remote;
      
      @Remote
      public interface HW {
       public String upper( String message );
      }


      package test;
      
      import ...
      
      public @Stateless class HWBean implements HW {
       public String upper(String message) {
       if ( message == null ) {
       message = "";
       }
       return message.toUpperCase();
       }
      }


      I also created a test application:

      public class Test {
       /**
       * @param args
       */
       public static void main(String[] args) {
       try {
       //System.setProperty("java.security.policy", "client.policy");
       if ( System.getSecurityManager() == null ) {
       System.setSecurityManager(new RMISecurityManager());
       }
       Properties env = new Properties();
      
       env.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
       env.setProperty("java.naming.provider.url", "localhost:1099");
       env.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
       Context ctx = new InitialContext(env);
      
       System.out.println( HW.class.getName() );
       HW hw = (HW) ctx.lookup( HW.class.getName() );
      
       hw.upper( "This is a test" );
       } catch (NamingException e) {
       e.printStackTrace();
       }
       }
      
      }


      I deployed successfully the bean, etc.

      Well, when I tried to run the test application, in the line where it has
      hw.upper( "This is a test" )


      I got the exception:

      Exception in thread "main" java.lang.NoClassDefFoundError: javax/servlet/ServletInputStream
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:164)
       at org.jboss.remoting.InvokerRegistry.class$(InvokerRegistry.java:46)
       at org.jboss.remoting.InvokerRegistry.<clinit>(InvokerRegistry.java:64)
       at org.jboss.remoting.Client.<init>(Client.java:74)
       at org.jboss.remoting.Client.<init>(Client.java:68)
       at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:40)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:46)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:40)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:41)
       at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:88)
       at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:88)
       at $Proxy0.upper(Unknown Source)
       at org.client.Test.main(Test.java:30)


      What am I doing wrong?

      Any help will be more than appreciated.

      Best,
      Michel Fornaris