Lots of googling and searching of these forums havn't solved my problem, so 
here comes a question with a rather lengthy description:

Environment:
Windows XP
JBoss 4.0.5.GA
JBoss-Seam 1.2.1GA
Oracle 9 (ojdbc14.jar)

(Note: This problem might also be related to JBoss Seam or the EJB3 timer 
service)

Basic problem: I schedule a report using the TimerService, when @Timeout hits, 
the report is assembled and stored in a @Lob. As long as the JBoss isn't 
restarted before the "job" has run, this works as a charm. If I stop and start 
the server, the actual generation of the report happens just fine (since the 
Timer is persistent and resumes after startup), BUT - Hibernate fails with 
classloading errors when it tries to write that resulting POJO into the @Lob 
field. The full stacktrace is posted at the end of this post.

And oh - the POJO stored in the @Lob is read by a Seam Component and then 
displayed as PDF using the seam-pdf stuff in a JSF page if someone wonders...


  | @Stateless
  | @Name("reportTimerBean")
  | public class ReportTimerBean implements ReportTimer {
  | 
  |     private static final String BEAN_JNDI = 
"myApp/ScheduledReportProcessorBean/local";
  |     
  |     @Resource
  |     TimerService timerService;
  | public void startReportTimer(Schedulable schedulableReport)
  |     GregorianCalendar startTime= new GregorianCalendar();
  |     startTime.add(GregorianCalendar.MINUTE, 3);
  |     timerService.createTimer(startTime.getTime(), schedulableReport);
  | }
  | 
  | @Timeout
  | public void createScheduledReport(Timer timer) {                            
  |     try {                   
  |             Context ctx = new InitialContext();
  |             ScheduledReportProcessor scheduledReportProcessor =   
  |                 (ScheduledReportProcessor) 
  |                  ctx.lookup(REPORT_PROCESSOR_BEAN_JNDI);
  |                  scheduledReportProcessor.processReport(    
  |                                              (Schedulable) timer.getInfo());
  |     } catch (NamingException e) {                   
  |             throw e;
  |     }
  | }
  | 

At time of timeout, @Timeout methid is invoked which calls the 
ScheduledReportProcessor EJB which generates the report data into a POJO using 
Hibernate queries. This POJO (which implements Serializable) is then set into 
an @Entity bean field, i.e:


  |         @Column(name="DATAMODEL")
  |     @Lob @Basic(fetch = FetchType.EAGER)
  |     private Serializable data;
  | 

and is persisted using a normal EntityManager


  | @AutoCreate
  | @Name("scheduledReportProcessor")
  | @Scope(ScopeType.APPLICATION)
  | @Stateless
  | public class ScheduledReportProcessorBean implements 
ScheduledReportProcessor {
  |         @PersistenceContext(unitName="myApp")
  |     private EntityManager entityManager;
  |     
  |     public void processReport(Schedulable schedulableReport) {
  |             schedulableReport.doReport(entityManager);
  |         }
  | }
  | 
As seen, the Schedulable instance contains its own report creation code in 
command-pattern style.

The supplied EntityManager is first used to assemble the data from the 
database, and is then used to insert the resulting data into the Serializable 
field shown further up.


  | private int createAndPersistReportDataModel(MyAppReportDataModel 
reportDataModel, EntityManager entityManager) {
  | 
  |             
  |             ReportDataModel dataModel = new ReportDataModel();
  |             dataModel.setData(reportDataModel);
  |             dataModel.setCreated(new java.util.Date());
  |             entityManager.persist(dataModel); // HERE IT CAN GO WRONG!
  | }
  | 
The class MyAppReportDataModel normally contains a lot of fields, but in order 
to narrow possible causes, it is a simple POJO now containing only 2 simple 
strings.

The stacktrace below, I repeat, happens AFTER all of the data has been 
assembled, the only thing left is to write it to the database. Also, I repeat - 
as long as a scheduled report runs before any server stop/start, this works 
perfectly.


17:00:29,834 ERROR [STDERR] javax.persistence.PersistenceException: 
org.hibernate.type.SerializationException: could not deserialize
17:00:29,834 ERROR [STDERR]     at 
org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:647)
17:00:29,834 ERROR [STDERR]     at 
org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
17:00:29,834 ERROR [STDERR]     at 
org.jboss.ejb3.entity.TransactionScopedEntityManager.persist(TransactionScopedEntityManager.java:175)
17:00:29,834 ERROR [STDERR]     at 
org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:128)
17:00:29,834 ERROR [STDERR]     at 
com.myapp.reports.MyReportPojo.createAndPersistReportDataModel(MyReportPojoPojo.java:209)
17:00:29,834 ERROR [STDERR]     at 
com.myapp.reports.MyReportPojo.doReport(MyReportPojo.java:167)
17:00:29,834 ERROR [STDERR]     at 
com.myapp.reports.ScheduledReportProcessorBean.processReport(ScheduledReportProcessorBean.java:27)
17:00:29,834 ERROR [STDERR]     at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:00:29,834 ERROR [STDERR]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
17:00:29,834 ERROR [STDERR]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
17:00:29,834 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Unknown 
Source)
17:00:29,834 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
17:00:29,834 ERROR [STDERR]     at 
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
17:00:29,834 ERROR [STDERR]     at 
org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:37)
17:00:29,834 ERROR [STDERR]     at 
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
17:00:29,834 ERROR [STDERR]     at 
org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
17:00:29,834 ERROR [STDERR]     at 
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
17:00:29,834 ERROR [STDERR]     at 
org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:113)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
17:00:29,844 ERROR [STDERR]     at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:00:29,844 ERROR [STDERR]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
17:00:29,844 ERROR [STDERR]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
17:00:29,844 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Unknown 
Source)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:211)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
17:00:29,844 ERROR [STDERR]     at $Proxy131.processReport(Unknown Source)
17:00:29,844 ERROR [STDERR]     at 
com.myapp.action.ReportTimerBean.createScheduledReport(ReportTimerBean.java:55)
17:00:29,844 ERROR [STDERR]     at 
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
17:00:29,844 ERROR [STDERR]     at 
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
17:00:29,844 ERROR [STDERR]     at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
17:00:29,844 ERROR [STDERR]     at java.lang.reflect.Method.invoke(Unknown 
Source)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:46)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:191)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:102)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb3.stateless.StatelessContainer.callTimeout(StatelessContainer.java:150)
17:00:29,844 ERROR [STDERR]     at 
org.jboss.ejb.txtimer.TimerImpl$TimerTaskImpl.run(TimerImpl.java:524)
17:00:29,844 ERROR [STDERR]     at java.util.TimerThread.mainLoop(Unknown 
Source)
17:00:29,844 ERROR [STDERR]     at java.util.TimerThread.run(Unknown Source)
17:00:29,844 ERROR [STDERR] Caused by: 
org.hibernate.type.SerializationException: could not deserialize
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:214)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:240)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.type.SerializableType.fromBytes(SerializableType.java:78)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.type.SerializableType.deepCopyNotNull(SerializableType.java:70)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.type.MutableType.deepCopy(MutableType.java:25)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.type.SerializableToBlobType.deepCopy(SerializableToBlobType.java:102)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.type.TypeFactory.deepCopy(TypeFactory.java:329)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:274)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:121)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
17:00:29,844 ERROR [STDERR]     at 
org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
17:00:29,895 ERROR [STDERR]     ... 76 more
17:00:29,895 ERROR [STDERR] Caused by: java.lang.ClassNotFoundException: No 
ClassLoaders found for: com.myapp.jpa.MyAppReportDataModel
17:00:29,895 ERROR [STDERR]     at 
org.jboss.mx.loading.LoadMgr3.beginLoadTask(LoadMgr3.java:212)
17:00:29,895 ERROR [STDERR]     at 
org.jboss.mx.loading.RepositoryClassLoader.loadClassImpl(RepositoryClassLoader.java:511)
17:00:29,895 ERROR [STDERR]     at 
org.jboss.mx.loading.RepositoryClassLoader.loadClass(RepositoryClassLoader.java:405)
17:00:29,895 ERROR [STDERR]     at java.lang.ClassLoader.loadClass(Unknown 
Source)
17:00:29,895 ERROR [STDERR]     at 
java.lang.ClassLoader.loadClassInternal(Unknown Source)
17:00:29,895 ERROR [STDERR]     at java.lang.Class.forName0(Native Method)
17:00:29,895 ERROR [STDERR]     at java.lang.Class.forName(Unknown Source)
17:00:29,895 ERROR [STDERR]     at 
java.io.ObjectInputStream.resolveClass(Unknown Source)
17:00:29,895 ERROR [STDERR]     at 
org.hibernate.util.SerializationHelper$CustomObjectInputStream.resolveClass(SerializationHelper.java:268)
17:00:29,895 ERROR [STDERR]     at 
java.io.ObjectInputStream.readNonProxyDesc(Unknown Source)
17:00:29,895 ERROR [STDERR]     at 
java.io.ObjectInputStream.readClassDesc(Unknown Source)
17:00:29,895 ERROR [STDERR]     at 
java.io.ObjectInputStream.readOrdinaryObject(Unknown Source)
17:00:29,895 ERROR [STDERR]     at 
java.io.ObjectInputStream.readObject0(Unknown Source)
17:00:29,895 ERROR [STDERR]     at java.io.ObjectInputStream.readObject(Unknown 
Source)
17:00:29,895 ERROR [STDERR]     at 
org.hibernate.util.SerializationHelper.deserialize(SerializationHelper.java:210)
17:00:29,895 ERROR [STDERR]     ... 92 more

So, any ideas? Any help will be greatly appreciated! Thanks in advance.

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4121359#4121359

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121359
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to