1 Reply Latest reply on May 5, 2014 3:10 AM by V K

    Java SE JAR is not finding Weld classes

    Dan Str Newbie

      Hi guys this is my first post in this community and my question is in regards to a project I thought I would be done with until I tried to run it as an executable jar either from the command prompt or as a chron job in which I received mucho issues.

       

      So this is a Java SE project that uses JBoss Weld for CDI, Apache DeltaSpike to start the container and Maven to build the project and JPA. When the project runs from within Netbeans everything works as expected and I can sync data the way it supposed to. Database calls are working, CDI is working as expected and I am not seeing any issues with Weld. That aside, the goal of this project is to run it when needed from a chron job schedule so I need the jar to execute when it is called from batch file which is specified in the chron job.

       

      So when I execute the jar I am running into some weird issues.

      This CDI mode is being run
      [12:02:37,516 WARN  Interceptor]: WELD-001700: Interceptor annotation class javax.ejb.PostActivate not found, interception based on it is not enabled
      [12:02:37,518 WARN  Interceptor]: WELD-001700: Interceptor annotation class javax.ejb.PrePassivate not found, interception based on it is not enabled
      Exception in thread "main" org.jboss.weld.exceptions.DeploymentException: Enclosing method not found
              at org.jboss.weld.executor.AbstractExecutorServices.checkForExceptions(AbstractExecutorServices.java:66)
              at org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:43)
              at org.jboss.weld.executor.AbstractExecutorServices.invokeAllAndCheckForExceptions(AbstractExecutorServices.java:51)
              at org.jboss.weld.bootstrap.ConcurrentBeanDeployer.createClassBeans(ConcurrentBeanDeployer.java:72)
              at org.jboss.weld.bootstrap.BeanDeployment.createBeans(BeanDeployment.java:260)
              at org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:351)
              at org.jboss.weld.bootstrap.WeldBootstrap.deployBeans(WeldBootstrap.java:79)
              at org.jboss.weld.bootstrap.api.helpers.ForwardingBootstrap.deployBeans(ForwardingBootstrap.java:63)
              at org.jboss.weld.environment.se.Weld.initialize(Weld.java:143)
              at org.apache.deltaspike.cdise.weld.WeldContainerControl.boot(WeldContainerControl.java:65)
              at com.baxter.biolife.webservices.easyscheduler.optinsync.sync.EZSOptInSync.main(EZSOptInSync.java:31)
      Caused by: java.lang.InternalError: Enclosing method not found
              at java.lang.Class.getEnclosingMethod(Unknown Source)
              at org.jboss.weld.util.reflection.Reflections.isNonStaticInnerClass(Reflections.java:388)
              at org.jboss.weld.util.Beans.isTypeManagedBeanOrDecoratorOrInterceptor(Beans.java:486)
              at org.jboss.weld.bootstrap.BeanDeployer.createClassBean(BeanDeployer.java:233)
              at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:74)
              at org.jboss.weld.bootstrap.ConcurrentBeanDeployer$2.doWork(ConcurrentBeanDeployer.java:72)
              at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:60)
              at org.jboss.weld.executor.IterativeWorkerTaskFactory$1.call(IterativeWorkerTaskFactory.java:53)
              at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
              at java.util.concurrent.FutureTask.run(Unknown Source)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
              at java.lang.Thread.run(Unknown Source)
      
      

       

       

      Here is a snippet of my pom that relates to the dependencies being used:

                <dependency>
                  <groupId>org.apache.deltaspike.core</groupId>
                  <artifactId>deltaspike-core-api</artifactId>
                  <version>${deltaspike.version}</version>
              </dependency>
      
              <dependency>
                  <groupId>org.apache.deltaspike.core</groupId>
                  <artifactId>deltaspike-core-impl</artifactId>
                  <version>${deltaspike.version}</version>
              </dependency>
             
              <dependency>
                  <groupId>org.jboss.weld.se</groupId>
                  <artifactId>weld-se</artifactId>
                  <version>${weld.version}</version>
              </dependency>
              <dependency>
                  <groupId>org.apache.deltaspike.cdictrl</groupId>
                  <artifactId>deltaspike-cdictrl-api</artifactId>
                  <version>${deltaspike.version}</version>
              </dependency>
             
              <dependency>
                  <groupId>org.apache.deltaspike.cdictrl</groupId>
                  <artifactId>deltaspike-cdictrl-weld</artifactId>
                  <version>${deltaspike.version}</version>
              </dependency>
             
             
              <dependency>
                  <groupId>org.apache.deltaspike.modules</groupId>
                  <artifactId>deltaspike-jpa-module-api</artifactId>
                  <version>${deltaspike.version}</version>
              </dependency>
      
              <dependency>
                  <groupId>org.apache.deltaspike.modules</groupId>
                  <artifactId>deltaspike-jpa-module-impl</artifactId>
                  <version>${deltaspike.version}</version>
              </dependency>
      
      

       

       

      Anyways, it seems that anything I do I cannot get this jar to run without some kind of error and I wanted to know if anyone else has run into this

      or knows of a way to get around it or even if you have experience with Weld and Java SE and getting the jar to run outside of the IDE.