JSR352 JBeret - Error while running SleepyBatchlet using JBeret

。_饼干妹妹 提交于 2019-12-02 17:04:54

问题


I am trying to run a JSR352 compliant java batch program in Java SE mode using JBeret implementation.

I took the SleepyBatchlet program, converted to a executable JAR (with all necessary dependencies packaged along with it) to use Jberet and tried running it from my windows command prompt but, got this error stack trace. The same project runs without any error from my Eclipse IDE

I have checked to see the jdk version used in Eclipse and Command prompt is the same.

Here is the exception when i run java -jar jarfilename.jar

Exception 0 :
org.jboss.weld.exceptions.DeploymentException: WELD-001409: Ambiguous dependencies for type InjectionPoint with qualifiers @Default
  at injection point [UnbackedAnnotatedParameter] Parameter 1 of [UnbackedAnnotatedMethod] @Produces @BatchProperty public org.jberet.creation.BatchBeanProducer.getS
hort(InjectionPoint)
  at org.jberet.creation.BatchBeanProducer.getShort(BatchBeanProducer.java:0)
  Possible dependencies:
  - Managed Bean [class org.jboss.weld.manager.BeanManagerImpl$InstanceInjectionPoint] with qualifiers [@Any @Default],
  - Managed Bean [class org.jboss.weld.injection.EmptyInjectionPoint] with qualifiers [@Any @Default],
  - Implicit Bean [javax.enterprise.inject.spi.InjectionPoint] with qualifiers [@Default]

        at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:369)
        at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:282)
        at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:133)
        at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:164)
        at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:507)
        at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:68)
        at org.jboss.weld.bootstrap.ConcurrentValidator$1.doWork(ConcurrentValidator.java:66)
        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.run(FutureTask.java:266)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
        at java.lang.Thread.run(Thread.java:745)

        at org.jboss.weld.bootstrap.ConcurrentValidator.validateBeans(ConcurrentValidator.java:76)
        at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:468)
        at org.jboss.weld.bootstrap.WeldStartup.validateBeans(WeldStartup.java:392)
        at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:85)
        at org.jboss.weld.bootstrap.api.helpers.ForwardingBootstrap.validateBeans(ForwardingBootstrap.java:75)
        at org.jboss.weld.environment.se.Weld.initialize(Weld.java:144)
        at org.jberet.se.SEArtifactFactory.<init>(SEArtifactFactory.java:31)
        at org.jberet.se.BatchSEEnvironment.getArtifactFactory(BatchSEEnvironment.java:89)
        at org.jberet.operations.JobOperatorImpl.<init>(JobOperatorImpl.java:69)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442)
        at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
        ... 4 more

The same project when run from Eclipse using the maven goal clean install exec:java

WARN: WELD-001700: Interceptor annotation class javax.ejb.PrePassivate not found, interception based on it is not enabled
Oct 02, 2017 2:36:08 PM org.jberet.repository.JdbcRepository getDDLLocation
INFO: JBERET000021: About to initialize batch job repository with ddl-file: sql/jberet.ddl for database H2
Batchlet submitted: 1
SleepyBatchlet: process: entry
SleepyBatchlet: process: sleep for: 15
SleepyBatchlet: process: [0] sleeping for a second...
SleepyBatchlet: process: [1] sleeping for a second...
SleepyBatchlet: process: [2] sleeping for a second...
SleepyBatchlet: process: [3] sleeping for a second...
SleepyBatchlet: process: [4] sleeping for a second...

Here is the POM file entry

 <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.ibm.ws.jbatch.sample.sleepybatchlet</groupId>
    <artifactId>SleepyBatchletSample</artifactId>
    <version>1.0</version>
    <packaging>jar</packaging>

    <name>SleepyBatchletSample</name>

    <dependencies>

        <dependency>
            <groupId>org.jboss.spec.javax.batch</groupId>
            <artifactId>jboss-batch-api_1.0_spec</artifactId>
            <version>1.0.0.Final</version>
        </dependency>

        <dependency>
            <groupId>org.jberet</groupId>
            <artifactId>jberet-core</artifactId>
            <version>1.0.2.Final</version>
        </dependency>

        <dependency>
            <groupId>org.jberet</groupId>
            <artifactId>jberet-support</artifactId>
            <version>1.0.2.Final</version>
        </dependency>

        <dependency>
            <groupId>org.jboss.spec.javax.transaction</groupId>
            <artifactId>jboss-transaction-api_1.2_spec</artifactId>
            <version>1.0.0.Final</version>
        </dependency>

        <dependency>
            <groupId>org.jboss.weld</groupId>
            <artifactId>weld-core</artifactId>
            <version>2.1.1.Final</version>
        </dependency>
        <dependency>
            <groupId>org.jboss.weld.se</groupId>
            <artifactId>weld-se</artifactId>
            <version>2.1.1.Final</version>
        </dependency>
        <dependency>
            <groupId>org.jberet</groupId>
            <artifactId>jberet-se</artifactId>
            <version>1.0.2.Final</version>
        </dependency>

        <dependency>
            <groupId>org.jboss.marshalling</groupId>
            <artifactId>jboss-marshalling</artifactId>
            <version>1.4.2.Final</version>
        </dependency>


        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <version>1.4.178</version>
        </dependency>


    </dependencies>

    <build>
    <plugins>
    <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <!-- get all project dependencies -->
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <finalName>PilotJBeret</finalName>
                    <appendAssemblyId>false</appendAssemblyId>
                    <!-- MainClass in mainfest make a executable jar -->
                    <archive>
                        <manifest>
                            <mainClass>com.ibm.ws.jbatch.sample.sleepybatchlet.Main</mainClass>
                        </manifest>
                    </archive>

                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <!-- bind to the packaging phase -->
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

    </plugins>

    </build>

</project>

来源:https://stackoverflow.com/questions/46520574/jsr352-jberet-error-while-running-sleepybatchlet-using-jberet

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!