2011-03-25 63 views
2

我遇到了一個非常奇怪的錯誤,我無法環繞我的頭。我正在運行Seam 2.2.1.CR2和JBoss 4.3.0.GA.我的應用程序包括3個模塊:FullTextHibernateSessionProxy在類加載器中是不可見的

的application.xml

<display-name>CoolWebApp</display-name> 
    <module id="EJB3"> 
     <ejb>EJB3.jar</ejb> 
    </module> 
    <module id="WEB"> 
     <web> 
      <web-uri>WEB.war</web-uri> 
      <context-root>/</context-root> 
     </web> 
    </module> 
    <module> 
     <ejb>jboss-seam-2.2.1.CR2.jar</ejb> 
    </module> 

以下豆計劃,並應異步運行。它駐留在我的EJB3模塊:

package com.coolwebapp.indexing; 

import org.apache.commons.lang.time.DateUtils; 
import org.jboss.seam.Component; 
import org.jboss.seam.ScopeType; 
import org.jboss.seam.annotations.AutoCreate; 
import org.jboss.seam.annotations.Create; 
import org.jboss.seam.annotations.In; 
import org.jboss.seam.annotations.Logger; 
import org.jboss.seam.annotations.Name; 
import org.jboss.seam.annotations.Scope; 
import org.jboss.seam.annotations.Startup; 
import org.jboss.seam.annotations.Transactional; 
import org.jboss.seam.annotations.async.Asynchronous; 
import org.jboss.seam.annotations.async.Expiration; 
import org.jboss.seam.annotations.async.IntervalDuration; 
import org.jboss.seam.core.Events; 
import org.jboss.seam.log.Log; 
import com.coolwebapp.events.CompanyTouched; 
import com.coolwebapp.model.Company; 
import com.coolwebapp.model.CompanyInNeedOfIndexing; 

import javax.persistence.EntityManager; 
import java.util.Date; 
import java.util.HashMap; 
import java.util.List; 
import java.util.Map; 

/** 
* 
*/ 
@Name("indexBean") 
@AutoCreate 
public class IndexBean { 

    @Logger 
    private static Log log; 

    /** 
    * @return Will fetch an applicationBean 
    */ 
    private EntityManager entityManager() { 
     return (EntityManager) Component.getInstance("entityManager", true); 
    } 

    @SuppressWarnings({"unchecked"}) 
    @Transactional 
    @Asynchronous 
    public void investigatePendingIndexings(@Expiration Date when, @IntervalDuration Long interval) { 
     log.info("IndexBean.investigatePendingIndexings()"); 
     final EntityManager em = entityManager(); 
     List<CompanyInNeedOfIndexing> indexingTasks = 
       em.createQuery(
         "from CompanyInNeedOfIndexing C where C.hasBeenIndexedOnNode not like :nodeName") 
         .setParameter("nodeName", getNodeName()) 
         .getResultList(); 

     Map<Long, Company> idToCompanyToIndexMap = new HashMap<Long, Company>(); 
     for (CompanyInNeedOfIndexing indexingTask : indexingTasks) { 
      final Company company = indexingTask.getCompany(); 
      final long id = company.getId(); 
      if (!idToCompanyToIndexMap.containsKey(id)) 
       idToCompanyToIndexMap.put(id, company); 
     } 

     for (Company company : idToCompanyToIndexMap.values()) { 
      log.info("Indexing " + company.getName()); 
      Events.instance().raiseEvent(CompanyTouched.EVENT_NAME, company, em); 
      em.persist(new CompanyInNeedOfIndexing(company, getNodeName())); 
     } 
    } 

    private String getNodeName() { 
     return "N0"; // TODO get from -D param 
    } 

    @Startup(depends = {"applicationBean", "entityManager"}) 
    @Scope(ScopeType.APPLICATION) 
    @Name("indexBeanKicker") 
    public static class Kicker { 

     private final long INTERVAL = 15; 


     @In 
     private IndexBean indexBean; 

     @Create 
     public void initBean() { 
      log.info("Will check for indexing every " + INTERVAL + " minutes."); 
      final Date firstRunIn30sec = new Date(30 * DateUtils.MILLIS_PER_SECOND + System.currentTimeMillis()); 
      indexBean.investigatePendingIndexings(
        firstRunIn30sec, 
        INTERVAL * DateUtils.MILLIS_PER_MINUTE); 
     } 
    } 

} 

當引發事件以下豆撿起來(也是在EJB3模塊):

package com.coolwebpp.search.util; 

import org.apache.commons.logging.Log; 
import org.apache.commons.logging.LogFactory; 
import org.apache.lucene.document.Document; 
import org.hibernate.annotations.common.reflection.java.JavaReflectionManager; 
import org.hibernate.search.engine.DocumentBuilder; 
import org.hibernate.search.jpa.FullTextEntityManager; 
import org.hibernate.search.jpa.Search; 
import org.hibernate.search.store.NotShardedStrategy; 
import org.jboss.seam.ScopeType; 
import org.jboss.seam.annotations.AutoCreate; 
import org.jboss.seam.annotations.Name; 
import org.jboss.seam.annotations.Observer; 
import org.jboss.seam.annotations.Scope; 
import com.coolwebapp.events.CompanyTouched; 
import com.coolwebapp.model.Company; 

import javax.persistence.EntityManager; 
import java.io.Serializable; 

@Name("indexUtils") 
@AutoCreate 
@Scope(ScopeType.SESSION) 
public class IndexUtils implements ArticleSaved, ReviewsUpdated, CompanyPublished, CompanyRemoved, SearchWordsUpdated, CompanyTouched, Serializable { 

    public final static Log log = LogFactory.getLog(IndexUtils.class); 

    public IndexUtils() { 
    } 

    public static FullTextEntityManager getFullTextEntityManager(EntityManager entityManager) { 
     if (entityManager instanceof FullTextEntityManager) 
      return (FullTextEntityManager) entityManager; 
     else 
      return Search.createFullTextEntityManager(entityManager); 
    } 

    private void reindexWithoutModifyingLastUpdated(Company company, EntityManager entityManager) { 
     log.warn("--------------->>> Reindexing without updating lastModified: " + company.getName()); 
     getFullTextEntityManager(entityManager).index(company); 
    } 

    @Observer(CompanyTouched.EVENT_NAME) 
    public void handleCompanyTouched(Company owningCompany, EntityManager entityManager) { 
     reindexWithoutModifyingLastUpdated(owningCompany, entityManager); 
    } 

} 

的components.xml

<persistence:managed-persistence-context name="entityManager" 
              auto-create="true" 
              entity-manager-factory="#{entityManagerFactory}"/> 

    <persistence:entity-manager-factory name="entityManagerFactory" 
             persistence-unit-name="theDatabase"/> 

當我啓動應用程序和kicker踢在一切運作良好,直到

getFullTextEntityManager(entityManager).index(company); 

然後以下異常被拋出:

11:10:34,681 ERROR [AsynchronousExceptionHandler] Exception thrown whilst executing asynchronous call 
java.lang.IllegalArgumentException: interface org.jboss.seam.persistence.EntityManagerProxy is not visible from class loader 
    at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353) 
    at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581) 
    at org.jboss.seam.persistence.PersistenceProvider.proxyEntityManager(PersistenceProvider.java:220) 
    at org.jboss.seam.persistence.HibernatePersistenceProvider.proxyEntityManager(HibernatePersistenceProvider.java:314) 
    at org.jboss.seam.persistence.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:81) 
    at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:108) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) 
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) 
    at org.jboss.seam.Component.callComponentMethod(Component.java:2275) 
    at org.jboss.seam.Component.unwrap(Component.java:2301) 
    at org.jboss.seam.Component.getInstance(Component.java:2044) 
    at org.jboss.seam.Component.getInstance(Component.java:1986) 
    at org.jboss.seam.Component.getInstance(Component.java:1980) 
    at com.coolwebapp.indexing.IndexBean.entityManager(IndexBean.java:43) 
    at com.coolwebapp.indexing.IndexBean.investigatePendingIndexings(IndexBean.java:51) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) 
    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) 
    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97) 
    at org.jboss.seam.util.Work.workInTransaction(Work.java:61) 
    at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:52) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) 
    at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) 
    at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) 
    at com.coolwebapp.indexing.IndexBean_$$_javassist_seam_2.investigatePendingIndexings(IndexBean_$$_javassist_seam_2.java) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) 
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) 
    at org.jboss.seam.async.AsynchronousInvocation$1.process(AsynchronousInvocation.java:62) 
    at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:80) 
    at org.jboss.seam.async.AsynchronousInvocation.execute(AsynchronousInvocation.java:44) 
    at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:243) 
    at org.quartz.core.JobRunShell.run(JobRunShell.java:203) 
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520) 

如果我添加範圍,我管理,持久化上下文:

<persistence:managed-persistence-context name="entityManager" 
              auto-create="true" scope="APPLICATION" 
              entity-manager-factory="#{entityManagerFactory}"/> 

    <persistence:entity-manager-factory name="entityManagerFactory" 
             persistence-unit-name="theDatabase"/> 

我收到以下錯誤:

10:49:46,689 WARN [HibernatePersistenceProvider] Unable to wrap into a FullTextSessionProxy, regular SessionProxy returned 
java.lang.IllegalArgumentException: interface org.jboss.seam.persistence.FullTextHibernateSessionProxy is not visible from class loader 
    at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353) 
    at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581) 
    at org.jboss.seam.persistence.HibernatePersistenceProvider.proxySession(HibernatePersistenceProvider.java:119) 
    at org.jboss.seam.persistence.HibernatePersistenceProvider.proxyDelegate(HibernatePersistenceProvider.java:142) 
    at org.jboss.seam.persistence.EntityManagerInvocationHandler.handleGetDelegate(EntityManagerInvocationHandler.java:81) 
    at org.jboss.seam.persistence.EntityManagerInvocationHandler.invoke(EntityManagerInvocationHandler.java:40) 
    at $Proxy229.getDelegate(Unknown Source) 
    at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.getFullTextSession(FullTextEntityManagerImpl.java:32) 
    at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.index(FullTextEntityManagerImpl.java:65) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.jboss.seam.persistence.EntityManagerInvocationHandler.invoke(EntityManagerInvocationHandler.java:46) 
    at $Proxy230.index(Unknown Source) 
    at com.coolwebapp.search.util.IndexUtils.reindexWithoutModifyingLastUpdated(IndexUtils.java:85) 
    at com.coolwebapp.search.util.IndexUtils.handleCompanyTouched(IndexUtils.java:115) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) 
    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) 
    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) 
    at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) 
    at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) 
    at com.coolwebapp.search.util.IndexUtils_$$_javassist_seam_21.handleCompanyTouched(IndexUtils_$$_javassist_seam_21.java) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) 
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) 
    at org.jboss.seam.Component.callComponentMethod(Component.java:2279) 
    at org.jboss.seam.core.Events.raiseEvent(Events.java:85) 
    at com.coolwebapp.indexing.IndexBean.investigatePendingIndexings(IndexBean.java:68) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) 
    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) 
    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97) 
    at org.jboss.seam.util.Work.workInTransaction(Work.java:61) 
    at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:52) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) 
    at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) 
    at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) 
    at com.coolwebapp.indexing.IndexBean_$$_javassist_seam_2.investigatePendingIndexings(IndexBean_$$_javassist_seam_2.java) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) 
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) 
    at org.jboss.seam.async.AsynchronousInvocation$1.process(AsynchronousInvocation.java:62) 
    at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:80) 
    at org.jboss.seam.async.AsynchronousInvocation.execute(AsynchronousInvocation.java:44) 
    at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:243) 
    at org.quartz.core.JobRunShell.run(JobRunShell.java:203) 
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520) 
10:49:46,702 ERROR [AsynchronousExceptionHandler] Exception thrown whilst executing asynchronous call 
java.lang.RuntimeException: could not proxy delegate 
    at org.jboss.seam.persistence.HibernatePersistenceProvider.proxyDelegate(HibernatePersistenceProvider.java:150) 
    at org.jboss.seam.persistence.EntityManagerInvocationHandler.handleGetDelegate(EntityManagerInvocationHandler.java:81) 
    at org.jboss.seam.persistence.EntityManagerInvocationHandler.invoke(EntityManagerInvocationHandler.java:40) 
    at $Proxy229.getDelegate(Unknown Source) 
    at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.getFullTextSession(FullTextEntityManagerImpl.java:32) 
    at org.hibernate.search.jpa.impl.FullTextEntityManagerImpl.index(FullTextEntityManagerImpl.java:65) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.jboss.seam.persistence.EntityManagerInvocationHandler.invoke(EntityManagerInvocationHandler.java:46) 
    at $Proxy230.index(Unknown Source) 
    at com.coolwebapp.search.util.IndexUtils.reindexWithoutModifyingLastUpdated(IndexUtils.java:85) 
    at com.coolwebapp.search.util.IndexUtils.handleCompanyTouched(IndexUtils.java:115) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) 
    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) 
    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) 
    at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) 
    at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) 
    at com.coolwebapp.search.util.IndexUtils_$$_javassist_seam_21.handleCompanyTouched(IndexUtils_$$_javassist_seam_21.java) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) 
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) 
    at org.jboss.seam.Component.callComponentMethod(Component.java:2279) 
    at org.jboss.seam.core.Events.raiseEvent(Events.java:85) 
    at com.coolwebapp.indexing.IndexBean.investigatePendingIndexings(IndexBean.java:68) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) 
    at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) 
    at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.bpm.BusinessProcessInterceptor.aroundInvoke(BusinessProcessInterceptor.java:51) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97) 
    at org.jboss.seam.util.Work.workInTransaction(Work.java:61) 
    at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.async.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:52) 
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 
    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) 
    at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185) 
    at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103) 
    at com.coolwebapp.indexing.IndexBean_$$_javassist_seam_2.investigatePendingIndexings(IndexBean_$$_javassist_seam_2.java) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 
    at java.lang.reflect.Method.invoke(Method.java:597) 
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22) 
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144) 
    at org.jboss.seam.async.AsynchronousInvocation$1.process(AsynchronousInvocation.java:62) 
    at org.jboss.seam.async.Asynchronous$ContextualAsynchronousRequest.run(Asynchronous.java:80) 
    at org.jboss.seam.async.AsynchronousInvocation.execute(AsynchronousInvocation.java:44) 
    at org.jboss.seam.async.QuartzDispatcher$QuartzJob.execute(QuartzDispatcher.java:243) 
    at org.quartz.core.JobRunShell.run(JobRunShell.java:203) 
    at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:520) 
Caused by: java.lang.IllegalArgumentException: interface org.jboss.seam.persistence.HibernateSessionProxy is not visible from class loader 
    at java.lang.reflect.Proxy.getProxyClass(Proxy.java:353) 
    at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581) 
    at org.jboss.seam.persistence.HibernatePersistenceProvider.proxySession(HibernatePersistenceProvider.java:125) 
    at org.jboss.seam.persistence.HibernatePersistenceProvider.proxyDelegate(HibernatePersistenceProvider.java:142) 
    ... 74 more 

的fulltextentitymanager來來自hibernatesearch-3.0.1.GA。

如果我刪除保存實體工作(em.persist(new CompanyInNeedOfIndexing(company,getNodeName()));)的行調用.index,但只有當我將範圍設置爲APPLICATION時。

你有什麼想法,爲什麼這不起作用?您有任何提示或需要更多信息嗎?

回答

6

簡短的回答:

檢查hibernatesearch.jarquartz.jar是在同一個庫目錄,即無論是在default/lib(或<yourserver>/lib)。

您可能有quartz.jar來自quartz-ra.rar,這也應該工作。但是,如果您不需要quart-ra.rar設施,我建議您將其刪除並將quartz.jar放入default/lib

龍答:

當您配置了Quartz調度管理的Seam異步工作,喬布斯在在啓動時創建的線程石英池中運行。 Java EE中有很多邏輯取決於Thread.currentThread().getContextClassLoader(),因此將池中的線程關聯到正確的類加載器至關重要。

你應該避免的是重用線程池,這個線程池通常由JBoss默認安裝的quartz-ra.rar模塊創建。

您有兩種選擇。要麼刪除quartz-ra.rar模塊(如果不需要)並將quartz.jar放入server/lib中,要麼爲應用程序配置自定義石英配置,在應用程序類路徑的根目錄中創建seam.quartz.properties文件。

seam.quartz.properties定義由默認的不同,一個實例名稱的定製,使您的應用程序中使用她的私人線程池不斷:

org.quartz.scheduler.instanceName = MyApplicationQuartzInstance 
org.quartz.scheduler.instanceId = 1 
org.quartz.scheduler.rmi.export = false 
org.quartz.scheduler.rmi.proxy = false 

org.quartz.threadPool.class = org.quartz.simpl.SimpleThreadPool 
org.quartz.threadPool.threadCount = 5 

創建seam.quartz.properties是一個好主意,無論如何,因爲你可以調整其他一些石英參數如threadCount

+0

Omg這個工作就像一個魅力。請你可以編輯你的文章並進一步解釋這一點?爲什麼將quartz.jar添加到我的jboss lib中解決了我的問題? – jakob 2011-03-26 16:49:26

+0

@jakob我對主題添加了更好的解釋 – 2011-03-28 07:11:57

+0

非常感謝! – jakob 2011-03-28 08:03:01

相關問題