9 Replies Latest reply on Oct 14, 2002 1:17 PM by Adrian Brock

    Deplyment error: Class not found

    Henrik Andersson Newbie

      Hi

      I'm trying to deploy a simple entity bean using the standard template. I have these files in the directory project/src/main/ejb/trs/entity:

      Sal.java
      SalBean.java
      SalHome.java

      All with "package trs.entity;"

      When I try to deploy I get:

      18:03:12,560 INFO [EJBDeployer]
      Bean : trs.entity.Sal
      Section: 22.2
      Warning: The Bean Provider must specify the fully-qualified name of the Java class that implements the enterprise bean's business methods in the <ejb-class> element.
      Info : Class not found: trs.entity.SalCMP

      18:03:12,586 INFO [EjbModule] Creating
      18:03:12,830 INFO [EjbModule] Deploying trs.entity.Sal
      18:03:16,001 WARN [ServiceController] Problem creating service jboss.j2ee:service=EJB,jndiName=trs/entity/Sal
      java.lang.ClassNotFoundException: trs.interfaces.SalHome
      at java.net.URLClassLoader$1.run(URLClassLoader.java:198)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:186)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:299)

      And so on....

      What am I doing wrong?

      Thanks

      Henrik

        • 1. Re: Deplyment error: Class not found
          prabhakar chaganti Apprentice

          How are you creating the deployment descriptors. Are you using the ant build file with the template?

          -prabhakar

          • 3. Re: Deplyment error: Class not found
            prabhakar chaganti Apprentice

            Check and make sure that all of the interfaces are being generated by the build script. What version of xdoclet are you using?

            -prabhakar

            • 4. Re: Deplyment error: Class not found
              Henrik Andersson Newbie

              1.1.2

              These are the files that are generated:

              ./build/classes/trs/entity/Sal.class
              ./build/classes/trs/entity/SalHome.class
              ./build/classes/trs/entity/SalBean.class
              ./build/classes/trs/entity/SalCMP.class
              ./build/classes/trs/interfaces/SalHome.class
              ./build/classes/trs/interfaces/SalPK.class
              ./build/classes/trs/interfaces/Sal.class
              ./build/classes/trs/interfaces/SalData.class

              • 5. Re: Deplyment error: Class not found
                Adrian Brock Master

                You're doing something wrong?

                With Xdoclet, you only need SalBean,
                the Sal and SalHome should be generated.

                Regards,
                Adrian

                • 6. Re: Deplyment error: Class not found
                  Henrik Andersson Newbie

                  Ok, that sounds nice.

                  I deleted the files I've created except the Bean, but the error remains.

                  Here's the code:

                  package trs.entity;

                  import java.util.Collection;
                  import javax.ejb.EntityBean;
                  import javax.ejb.EntityContext;
                  import javax.ejb.RemoveException;
                  import javax.ejb.CreateException;

                  public abstract class SalBean implements EntityBean
                  {
                  public abstract void setSalsId(String sals_id);
                  public abstract String getSalsId();
                  public abstract void setByggnad(String byggnad);
                  public abstract String getByggnad();
                  public abstract Collection getDatorer();
                  public String ejbCreate(String sals_id, String byggnad) throws CreateException
                  {
                  setSalsId(sals_id);
                  setByggnad(byggnad);
                  return null;
                  }
                  public void ejbPostCreate(String sals_id, String byggnad) {}

                  public void ejbRemove() throws RemoveException {}
                  public void ejbActivate() {}
                  public void ejbPassivate() {}
                  public void ejbLoad() {}
                  public void ejbStore() {}
                  public void setEntityContext(EntityContext ec) {}
                  public void unsetEntityContext() {}
                  }

                  Here's .ant.properties:

                  jboss.home=/usr/local/jboss
                  jboss.configuration=default
                  xdoclet.home=/usr/local/xdoclet
                  xdoclet.force=false
                  ejb.version=2.0
                  jboss.version=3.0
                  type.mapping=PostgreSQL 7.2
                  datasource.name=java:/DefaultDS
                  servlet-lib.path=/usr/local/jboss/lib/javax.servlet.jar

                  When I start JBoss this is the classpath I see:

                  CLASSPATH: /usr/local/jboss/bin/run.jar:/usr/local/j2sdk1.4.1/lib/tools.jar

                  JBoss complains: Class not found: trs.entity.SalCMP
                  java.lang.ClassNotFoundException: trs.interfaces.SalHome

                  though they exist in build/classes/trs/entity/SalCMP.class
                  build/classes/trs/interfaces/SalHome.class

                  • 7. Re: Deplyment error: Class not found
                    Adrian Brock Master

                    I don't see any xdoclet tags in your source?

                    You've included all the classes in your deployed jar?

                    Regards,
                    Adrian

                    • 8. Re: Deplyment error: Class not found
                      Henrik Andersson Newbie

                      ...no. That I forgot.

                      I copied the tag from the example and changed it a bit:

                      /**
                      * This is the Sal entity bean. It is an example of how to use the
                      * EJBDoclet tags.
                      *
                      * @ejb.bean
                      * name="trs/Sal"
                      * type="CMP"
                      * jndi-name="ejb/trs/Sal"
                      *
                      * @ejb:env-entry name="SequenceName"
                      * value="Sal"
                      *
                      * @ejb:ejb-ref ejb-name="trs/SequenceGenerator"
                      *
                      * @ejb.transaction
                      * type="Required"
                      *
                      * @ejb:data-object extends="trs.interfaces.AbstractData"
                      * setdata="false"
                      *
                      * @ejb.finder
                      * signature="java.util.Collection findAll()"
                      * unchecked="true"
                      *
                      * setdata="false" * @ejb:finder signature="java.util.Collection findAll()"
                      * @ejb:finder signature="trs.interfaces.Sal findByName(java.lang.String sals_id)"
                      * @jboss:table-name table-name="Sal"
                      * @jboss:create-table create="true"
                      * @jboss:remove-table remove="true"

                      */

                      When I try this I get:

                      SalBean.java:8: cannot resolve symbol
                      [ejbdoclet] symbol : class SequenceGenerator
                      [ejbdoclet] location: package interfaces
                      [ejbdoclet] import trs.interfaces.SequenceGenerator;

                      I guess it's something simple.

                      Thanks for your time

                      /Henrik

                      • 9. Re: Deplyment error: Class not found
                        Adrian Brock Master

                        Do you have such a class?

                        Sometimes xdoclet prints "Cannot resolve symbol"
                        messages for classes it is going to generate.
                        It is just a warning.
                        This is usually on the first compile. Once it is
                        generated, the message goes away.

                        I think the example project includes an example for
                        generating entity bean keys. Did you copy it and
                        change the package name?

                        You are probably best asking in the
                        "Getting Started Documentation" forum.
                        Andreas can probably answer your questions better,
                        he wrote the example :-)

                        Regards,
                        Adrian