0 Replies Latest reply on Mar 22, 2006 3:05 AM by sisepago

    Problems Scanning classpath in the embedded-tutorial/simple-

      Hi all and Hi Bill,

      since yesterday I try to solve the problem in a standalone application. First I do not use JBoss-4.0.4RC1 AS to run my application. I use JBoss-EJB-3.0_Embeddable_ALPHA_5 and thus my error in the console of eclipse look like this:

      DEBUG 22-03 08:45:57,203 (KernelFactory.java:assembleNewKernel:86) -Starting JBoss Kernel construction...
      DEBUG 22-03 08:45:57,281 (KernelFactory.java:assembleNewKernel:112) -Completed JBoss Kernel construction. Duration: 63 milliseconds
      DEBUG 22-03 08:45:57,812 (BeanXMLDeployer.java:deploy:91) -Parsing file:/C:/dev/workspace/embedded-ejb3/bin/embedded-jboss-beans.xml took 516 milliseconds
      DEBUG 22-03 08:45:57,968 (UserTransactionImpl.java:start:61) -new UserTx: org.jboss.ejb3.embedded.UserTransactionImpl@1a42792
      INFO 22-03 08:45:58,015 (LocalTxDataSource.java:bindConnectionFactory:117) -Bound datasource to JNDI name 'java:/DefaultDS'
      DEBUG 22-03 08:45:58,046 (BeanXMLDeployer.java:deploy:98) -Deploying file:/C:/dev/workspace/embedded-ejb3/bin/embedded-jboss-beans.xml took 750 milliseconds
      Exception in thread "main" java.lang.RuntimeException: Problems scanning classpath
      at org.jboss.ejb3.embedded.EJB3StandaloneBootstrap.scanClasspath(EJB3StandaloneBootstrap.java:245)
      at de.mathema.doa.beans.Main.main(Main.java:32)

      DEBUG 22-03 08:45:58,312 (EJB3StandaloneBootstrap.java:createDeployer:266) -No MBeanServer
      DEBUG 22-03 08:45:58,328 (JaccHelper.java:initialiseJacc:61) -Initialising JACC Context for deployment: bin
      INFO 22-03 08:45:58,515 (Ejb3AnnotationHandler.java:getContainers:156) -found EJB3: ejbName=CustomerDAOBean, class=de.mathema.doa.beans.CustomerDAOBean, type=STATELESS
      DEBUG 22-03 08:45:58,531 (ProxyDeployer.java:initializeRemoteBindingMetadata:133) -no declared remote bindings for : CustomerDAOBean
      DEBUG 22-03 08:45:58,546 (ProxyDeployer.java:initializeRemoteBindingMetadata:136) -there is remote interfaces for CustomerDAOBean
      DEBUG 22-03 08:45:58,546 (ProxyDeployer.java:initializeRemoteBindingMetadata:138) -default remote binding has jndiName of CustomerDAOBean/remote
      INFO 22-03 08:45:58,562 (Ejb3Deployment.java:create:444) -EJB3 deployment time took: 234
      DEBUG 22-03 08:45:58,562 (JaccHelper.java:initialiseJacc:61) -Initialising JACC Context for deployment: jboss-serialization
      INFO 22-03 08:45:58,640 (Ejb3Deployment.java:create:444) -EJB3 deployment time took: 78
      DEBUG 22-03 08:45:58,640 (JaccHelper.java:initialiseJacc:61) -Initialising JACC Context for deployment: ehcache
      INFO 22-03 08:45:58,656 (Ejb3Deployment.java:create:444) -EJB3 deployment time took: 16
      DEBUG 22-03 08:45:58,656 (JaccHelper.java:initialiseJacc:61) -Initialising JACC Context for deployment: META-INF
      INFO 22-03 08:45:58,671 (Ejb3Deployment.java:create:444) -EJB3 deployment time took: 15
      DEBUG 22-03 08:45:58,671 (JaccHelper.java:initialiseJacc:61) -Initialising JACC Context for deployment: jboss-xml-binding
      INFO 22-03 08:45:58,843 (Ejb3Deployment.java:create:444) -EJB3 deployment time took: 172
      DEBUG 22-03 08:45:58,875 (EJBContainer.java:initialiseInterceptors:708) -Initialising interceptors for CustomerDAOBean...
      DEBUG 22-03 08:45:58,875 (EJBContainer.java:initialiseInterceptors:710) -Default interceptors: null
      DEBUG 22-03 08:45:58,875 (EJBContainer.java:initialiseInterceptors:713) -Class interceptors: []
      DEBUG 22-03 08:45:58,875 (EJBContainer.java:initialiseInterceptors:729) -All applicable interceptor classes: []
      INFO 22-03 08:45:58,875 (MCKernelAbstraction.java:install:79) -installing bean: jboss.j2ee:service=EJB3,jar=bin,name=CustomerDAOBean with dependencies:
      INFO 22-03 08:45:58,875 (MCKernelAbstraction.java:install:82) - AbstractDependencyMetaData@1a0225b{dependency=persistence.units:unitName=custdb}
      DEBUG 22-03 08:45:58,890 (Ejb3Deployment.java:registerEJBContainer:415) -Bound ejb3 container jboss.j2ee:service=EJB3,jar=bin,name=CustomerDAOBean
      ERROR 22-03 08:45:58,906 (KernelErrors.java:validate:107) -
      *** DEPLOYMENTS MISSING DEPENDENCIES:
      jboss.j2ee:service=EJB3,jar=bin,name=CustomerDAOBean depends on:
      persistence.units:unitName=custdb'{Create:NOT FOUND}
      persistence.units:unitName=custdb'{Start:NOT FOUND}



      -----------------------

      In the Classpath i have

      - resources/META-INF/persistence.xml
      and it looks like this

      <?xml version="1.0" encoding="UTF-8"?>

      <persistence-unit name="custdb">
      <jta-data-source>java:/DefaultDS</jta-data-source>



      </persistence-unit>



      - and all config-files in conf/

      + embedded-jboss-beans.xml
      + jboss-jms-beans.xml
      + ejb3-interceptors-aop.xml
      + default.persistence.properties
      + log4j.xml


      and then thus my pojos, bean and interfaces look like this

      - Customer.java

      @Entity
      @Table (name="CUSTOMER_")
      public class Customer {
      private int id;
      private String name;

      public Customer(){}

      @Id @GeneratedValue(strategy=GenerationType.AUTO)
      public int getId() {
      return id;
      }

      public void setId(int id) {
      this.id = id;
      }

      public String getName() {
      return name;
      }

      public void setName(String name) {
      this.name = name;
      }
      }

      - CustomerDAOBean.java

      @Stateless
      public class CustomerDAOBean implements CustomerDAOLocal, CustomerDAORemote {

      @PersistenceContext (unitName="custdb")
      private EntityManager em;

      public int createCustomer(String name) {
      Customer cust = new Customer();
      cust.setName(name);
      em.persist(cust);
      return cust.getId();
      }

      public Customer findCustomer(int id) {
      return em.find(Customer.class, id);
      }

      }

      - Local & Remote Interfaces

      @Local
      public interface CustomerDAOLocal {
      int createCustomer(String name);
      Customer findCustomer(int id);
      }

      @Remote
      public interface CustomerDAORemote {
      int createCustomer(String name);
      Customer findCustomer(int id);
      }


      - Main.java

      public class Main {
      public static void main(String[] args) throws Exception
      {
      EJB3StandaloneBootstrap.boot(null);
      EJB3StandaloneBootstrap.scanClasspath();

      InitialContext ctx = getInitialContext();
      CustomerDAOLocal local = (CustomerDAOLocal)ctx.lookup("CustomerDAOBean/local");
      CustomerDAORemote remote = (CustomerDAORemote)ctx.lookup("CustomerDAOBean/remote");

      System.out.println("----------------------------------------------------------");
      System.out.println("This test scans the System Property java.class.path for all annotated EJB3 classes");
      System.out.print(" ");

      int id = local.createCustomer("Gavin");
      Customer cust = local.findCustomer(id);
      System.out.println("Successfully created and found Gavin from @Local interface");

      id = remote.createCustomer("Emmanuel");
      cust = remote.findCustomer(id);
      System.out.println("Successfully created and found Emmanuel from @Remote interface");
      System.out.println("----------------------------------------------------------");
      }
      public static InitialContext getInitialContext() throws Exception
      {
      Hashtable props = getInitialContextProperties();
      return new InitialContext(props);
      }
      private static Hashtable getInitialContextProperties()
      {
      Hashtable props = new Hashtable();
      props.put("java.naming.factory.initial", "org.jnp.interfaces.LocalOnlyContextFactory");
      props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      return props;
      }
      }



      If somebody have or know the solution of this issue please suggestion or send maill because I do not know where is the probleme in
      my configs or in my classes


      Thanks