3 Replies Latest reply on Oct 29, 2006 12:03 AM by Piotr Lizurek

    First application in EJB 3.0 and JBoss 4.0.5GA

    Piotr Lizurek Newbie

      Hi!
      I am brand new to EJB 3.0 programming and I need some help.
      I have simple bean class (StatelessTekst1.java):

      import org.jboss.annotation.ejb.LocalBinding;
      import javax.ejb.*;
      
      @Stateless
      public class StatelessTekst1 implements tekst1
      {
       public String podajTekst(int numer)
       {
       if(numer==1)
       return "Hej, udalo sie!";
       }
      }


      And interface (tekst1.java):
      public interface tekst1
      {
       public String podajTekst(int numer);
      }


      I put this files to <JAVA_HOME>/bin directory. But, when I want to compile the StatelessTekst1.java file, I get an errors:
      -------------------------------------------------------------------------------------
      C:\Program Files\Java\jdk1.5.0_05\bin>javac StatelessTekst1.java
      StatelessTekst1.java:1: package org.jboss.annotation.ejb does not exist
      import org.jboss.annotation.ejb.LocalBinding;
      ^
      StatelessTekst1.java:2: package javax.ejb does not exist
      import javax.ejb.*;
      ^
      StatelessTekst1.java:4: cannot find symbol
      symbol: class Stateless
      @Stateless
      ^
      3 errors
      -------------------------------------------------------------------------------------
      So, I add the classpath to the javac:

      C:\Program Files\Java\jdk1.5.0_05\bin>javac -classpath .;c:/"program files"/jboss/client/jboss-ejb3-client.jar;c:/"program files"/jboss/client/jboss-j2ee.jar StatelessTekst1.java

      But again I have an error:

      StatelessTekst1.java:1: package org.jboss.annotation.ejb does not exist
      import org.jboss.annotation.ejb.LocalBinding;
      ^
      1 error

      What should I do to compile this files? Please, help me!
      Thanks and best regards!