Skip to main content

JSR352 ClassCastException with GlassFish v4.0

No replies
kylexxx
Offline
Joined: 2013-06-25
Points: 0

Hello, I'm sorry for my poor English.

I have issue which related to JSR352 with GlassFish v4.0.

I'm developing JSR352 based batch application
of Enterprise Project(EAR) with NetBeans,

It has a sub WAR project which kicks the JSR352 batch through
Servlet(in sub WAR project) -> EJB(in sub EJB project) -> BatchRuntime class.
JSR352 related classes and resources are packaged in sub EJB project.

And I fire the batch through the Servlet,
I got ClassCastException (full stacktrace is in the below).

And I discover: When I package all resources
in single WebApplication project(WAR),
It works fine without any problem.

I attached simplified 2 NetBeans Projects(EAR project and WAR project)
to this posting for verification.

This is a bug of GlassFish or I had something mistake?

Thanks.

--------------------------------------------------------
WARNING: Context path from ServletContext: /EnterpriseApplication3-war differs from path from bundle: EnterpriseApplication3-war
SEVERE: Failure in Read-Process-Write Loop
com.ibm.jbatch.container.exception.BatchContainerRuntimeException: java.lang.ClassCastException: org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor cannot be cast to com.sun.enterprise.deployment.WebBundleDescriptor
at com.ibm.jbatch.container.artifact.proxy.ItemReaderProxy.open(ItemReaderProxy.java:57)
at com.ibm.jbatch.container.impl.ChunkStepControllerImpl.openReaderAndWriter(ChunkStepControllerImpl.java:854)
at com.ibm.jbatch.container.impl.ChunkStepControllerImpl.invokeChunk(ChunkStepControllerImpl.java:543)
at com.ibm.jbatch.container.impl.ChunkStepControllerImpl.invokeCoreStep(ChunkStepControllerImpl.java:684)
at com.ibm.jbatch.container.impl.BaseStepControllerImpl.execute(BaseStepControllerImpl.java:144)
at com.ibm.jbatch.container.impl.ExecutionTransitioner.doExecutionLoop(ExecutionTransitioner.java:112)
at com.ibm.jbatch.container.impl.JobThreadRootControllerImpl.originateExecutionOnThread(JobThreadRootControllerImpl.java:110)
at com.ibm.jbatch.container.util.BatchWorkUnit.run(BatchWorkUnit.java:80)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at org.glassfish.enterprise.concurrent.internal.ManagedFutureTask.run(ManagedFutureTask.java:141)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
at org.glassfish.enterprise.concurrent.ManagedThreadFactoryImpl$ManagedThread.run(ManagedThreadFactoryImpl.java:250)
Caused by: java.lang.ClassCastException: org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor cannot be cast to com.sun.enterprise.deployment.WebBundleDescriptor
at com.sun.enterprise.container.common.impl.EntityManagerFactoryWrapper.lookupEntityManagerFactory(EntityManagerFactoryWrapper.java:234)
at com.sun.enterprise.container.common.impl.EntityManagerFactoryWrapper.lookupEntityManagerFactory(EntityManagerFactoryWrapper.java:203)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.init(EntityManagerWrapper.java:134)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper._getDelegate(EntityManagerWrapper.java:171)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createQuery(EntityManagerWrapper.java:477)
at newpackage.NewClassItemReader.open(NewClassItemReader.java:20)
at com.ibm.jbatch.container.artifact.proxy.ItemReaderProxy.open(ItemReaderProxy.java:54)
... 15 more

WARNING: Caught throwable in chunk processing. Attempting to close all readers and writers.
WARNING: Caught exception executing step: com.ibm.jbatch.container.exception.BatchContainerRuntimeException: Failure in Read-Process-Write Loop
at com.ibm.jbatch.container.impl.ChunkStepControllerImpl.invokeChunk(ChunkStepControllerImpl.java:670)
at com.ibm.jbatch.container.impl.ChunkStepControllerImpl.invokeCoreStep(ChunkStepControllerImpl.java:684)
at com.ibm.jbatch.container.impl.BaseStepControllerImpl.execute(BaseStepControllerImpl.java:144)
at com.ibm.jbatch.container.impl.ExecutionTransitioner.doExecutionLoop(ExecutionTransitioner.java:112)
at com.ibm.jbatch.container.impl.JobThreadRootControllerImpl.originateExecutionOnThread(JobThreadRootControllerImpl.java:110)
at com.ibm.jbatch.container.util.BatchWorkUnit.run(BatchWorkUnit.java:80)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at org.glassfish.enterprise.concurrent.internal.ManagedFutureTask.run(ManagedFutureTask.java:141)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
at org.glassfish.enterprise.concurrent.ManagedThreadFactoryImpl$ManagedThread.run(ManagedThreadFactoryImpl.java:250)
Caused by: com.ibm.jbatch.container.exception.BatchContainerRuntimeException: java.lang.ClassCastException: org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor cannot be cast to com.sun.enterprise.deployment.WebBundleDescriptor
at com.ibm.jbatch.container.artifact.proxy.ItemReaderProxy.open(ItemReaderProxy.java:57)
at com.ibm.jbatch.container.impl.ChunkStepControllerImpl.openReaderAndWriter(ChunkStepControllerImpl.java:854)
at com.ibm.jbatch.container.impl.ChunkStepControllerImpl.invokeChunk(ChunkStepControllerImpl.java:543)
... 13 more
Caused by: java.lang.ClassCastException: org.glassfish.ejb.deployment.descriptor.EjbSessionDescriptor cannot be cast to com.sun.enterprise.deployment.WebBundleDescriptor
at com.sun.enterprise.container.common.impl.EntityManagerFactoryWrapper.lookupEntityManagerFactory(EntityManagerFactoryWrapper.java:234)
at com.sun.enterprise.container.common.impl.EntityManagerFactoryWrapper.lookupEntityManagerFactory(EntityManagerFactoryWrapper.java:203)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.init(EntityManagerWrapper.java:134)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper._getDelegate(EntityManagerWrapper.java:171)
at com.sun.enterprise.container.common.impl.EntityManagerWrapper.createQuery(EntityManagerWrapper.java:477)
at newpackage.NewClassItemReader.open(NewClassItemReader.java:20)
at com.ibm.jbatch.container.artifact.proxy.ItemReaderProxy.open(ItemReaderProxy.java:54)
... 15 more

AttachmentSize
EnterpriseApplication3.zip52.53 KB
WebApplication3.zip21.98 KB