Seam EntityHomeサブクラスコールゲッターがTransactionRequiredExceptionで失敗する:joinTransactionコールでアクティブなJTAトランザクションがありません

私は最近webappを拡張しましたが、実際には機能を拡張しませんでした。 1つのページを除くすべてのページ。その1ページは正確にこれを示すはずです:

http://www.bbstats.net/team-home.seam?roster=10

JSFコードもDAO/RosterHomeクラスも変更されておらず、LAZYローディングをサポートするようにエンティティクラスのみが更新されました。しかし、私は次のスタックトレースを取得し続けます:

javax.faces.FacesException: javax.el.ELException: /team-home.xhtml @45,49 value="#{rosterHome.label}": javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call
    at javax.faces.component.UIOutput.getValue(UIOutput.java:187)
    at com.sun.faces.renderkit.html_basic.HtmlBasicInputRenderer.getValue(HtmlBasicInputRenderer.java:201)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.getCurrentValue(HtmlBasicRenderer.java:285)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeEnd(HtmlBasicRenderer.java:154)
    at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:861)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:242)
    at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:106)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
    at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:234)
    at com.sun.faces.renderkit.html_basic.GridRenderer.renderRow(GridRenderer.java:180)
    at com.sun.faces.renderkit.html_basic.GridRenderer.encodeChildren(GridRenderer.java:127)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
    at org.richfaces.renderkit.html.LayoutRenderer.renderLayout(LayoutRenderer.java:57)
    at org.richfaces.renderkit.html.LayoutRenderer.doEncodeChildren(LayoutRenderer.java:45)
    at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:120)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
    at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:277)
    at org.ajax4jsf.renderkit.RendererBase.renderChildren(RendererBase.java:258)
    at org.richfaces.renderkit.html.PageRenderer.doEncodeChildren(PageRenderer.java:265)
    at org.richfaces.renderkit.html.PageRenderer.doEncodeChildren(PageRenderer.java:254)
    at org.ajax4jsf.renderkit.RendererBase.encodeChildren(RendererBase.java:120)
    at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:837)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:930)
    at javax.faces.component.UIComponent.encodeAll(UIComponent.java:933)
    at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
    at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:100)
    at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:176)
    at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:110)
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
    at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:329)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
    at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
    at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
    at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:280)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:248)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:275)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:161)
    at org.jboss.as.web.NamingValve.invoke(NamingValve.java:57)
    at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:49)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:154)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:362)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877)
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667)
    at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951)
    at java.lang.Thread.run(Unknown Source)
Caused by: javax.el.ELException: /team-home.xhtml @45,49 value="#{rosterHome.label}": javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call
    at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
    at javax.faces.component.UIOutput.getValue(UIOutput.java:184)
    ... 52 more
Caused by: javax.persistence.TransactionRequiredException: No active JTA transaction on joinTransaction call
    at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1200)
    at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1150)
    at sun.reflect.GeneratedMethodAccessor60.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.jboss.seam.persistence.EntityManagerInvocationHandler.invoke(EntityManagerInvocationHandler.java:46)
    at $Proxy192.joinTransaction(Unknown Source)
    at org.jboss.seam.transaction.AbstractUserTransaction.enlist(AbstractUserTransaction.java:73)
    at org.jboss.seam.framework.EntityHome.joinTransaction(EntityHome.java:163)
    at org.jboss.seam.framework.Home.getInstance(Home.java:134)
*   at com.kawoolutions.bbstats.da.RosterHome.getLabel(RosterHome.java:22)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    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.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.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.kawoolutions.bbstats.da.RosterHome_$$_javassist_seam_11.getLabel(RosterHome_$$_javassist_seam_11.java)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at javax.el.BeanELResolver.getValue(BeanELResolver.java:302)
    at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:175)
    at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:72)
    at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
    at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
    at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
    at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
    ... 53 more

上の例では、RosterHome.getLabel()の呼び出し(*)が表示されています。ここにRosterHomeコードがあります:

@Name("rosterHome")
public class RosterHome extends PersistenceContextEntityHome
{
    @Override
    public String getLabel()
    {
        Roster ro = getInstance();//line 22 is this one!!
        Team te = ro.getTeam();
        TeamType tt = te.getTeamType();
        Club cl = te.getClub();

        String teamName = cl.getName() + " " + te.getOrdinalNbr();
        String fullTeamName = teamName + " (" + cl.getShorthand() + te.getOrdinalNbr() + ")";

        String teamTypeCode = tt.getCode().toUpperCase();
        String teamTypeLabel = tt.getLabel();
        String teamType = teamTypeLabel != null ? teamTypeLabel : teamTypeCode.toUpperCase();

        return fullTeamName + ", " + teamType;
    }

    ...
}

スーパークラスのPersistenceContextEntityHomeは次のようになります。

public abstract class PersistenceContextEntityHome extends EntityHome
{   
    @Override
    protected String getPersistenceContextName()
    {
        return "em";
    }

}

かなり基本的なもの、ただの永続コンテキスト名。

Eclipseコンソールでは、次の警告も表示されます。

18:05:27,693 WARN  [org.hibernate.ejb.AbstractEntityManagerImpl] (http--127.0.0.1-8080-6) HHH000326: Cannot join transaction: do not override hibernate.transaction.factory_class

私はpersistence.xmlをチェックしました:

<?xml version="1.0" encoding="UTF-8"?>

  

    org.hibernate.ejb.HibernatePersistence    
    java:jboss/datasources/BBStatsDS

    <!-- Lots of entity and ID classes .......... -->
    com.kawoolutions.bbstats.model.Arena
    ...

    false

    
      
      
    
  

編集:

com.kawoolutions.bbstats.util.CustomJBossAS7JtaPlatform.java:

public class CustomJBossAS7JtaPlatform extends JBossAppServerJtaPlatform
{
    @Override
    protected TransactionManager locateTransactionManager()
    {
        return (TransactionManager)jndiService().locate("java:jboss/TransactionManager");
    }
}

私はwebappのhibernate.transaction.factory_classをオーバーライドしていません - 少なくとも私が知っているわけではありません。

Why do I get this stack trace and the warning above? It's basically just a JSF page where I keep calling #{rosterHome.label} to construct a custom HTML label for page display.

私はJBoss AS 7を使用しています(相違点に気づかずに7.0.0.CR1を試しました)、Seam 2.2.2、JSF 1.2(+ Facelets)、RichFaces 3.3.3、およびHibernate 4を使用しています。

ヘルプは非常に高く評価されます。

ありがとう

0
実際には、オンライン版もJBoss AS 7に搭載されています。 JBoss AS 7.0.0.Finalですが、昨日、同じバージョンの例外/警告を完全に公開しました。回答は要求されたコードで更新されました。
追加された 著者 Kawu,
アプリケーションをjboss 7にいつ移行しましたか? com.kawoolutions.bbstats.util.CustomJBossAS7JtaPlatformのコードを投稿できますか?
追加された 著者 dcernahoschi,

1 答え

The answer is here: https://community.jboss.org/message/714893

ヤック

1
追加された