최근에 webapp를 확장했지만 기능을 실제로 확장하지 않았습니다. 하나의 작업을 제외한 모든 페이지. 그 한 페이지가 정확히 표시하도록되어 :Seam EntityHome 하위 클래스 호출 getter가 TransactionRequiredException과 함께 실패합니다. joinTransaction 호출에서 활성 JTA 트랜잭션이 없습니다.
http://www.bbstats.net/team-home.seam?roster=10
은 JSF 코드 나 DAO 어느/RosterHome 클래스가 변경 만 엔티티 클래스가 지연로드를 지원하도록 업데이트되었습니다. 그러나 계속해서 다음 스택 추적을 얻습니다.
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<Roster>
{
@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<E> extends EntityHome<E>
{
@Override
protected String getPersistenceContextName()
{
return "em";
}
}
아주 기본적인 것들, 단지 영속 컨텍스트 이름입니다. 이클립스 콘솔에서
나는 이러한 경고를 얻을 :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"?>
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="BBStatsPU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:jboss/datasources/BBStatsDS</jta-data-source>
<!-- Lots of entity and ID classes .......... -->
<class>com.kawoolutions.bbstats.model.Arena</class>
...
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
<property name="hibernate.transaction.jta.platform" value="com.kawoolutions.bbstats.util.CustomJBossAS7JtaPlatform" />
</properties>
</persistence-unit>
</persistence>
편집 :
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를 오버라이드하지 않을 것입니다.
왜이 스택 추적과 위의 경고 메시지가 표시됩니까? 기본적으로 페이지 표시를 위해 사용자 정의 HTML 레이블을 구성하려면 #{rosterHome.label}
을 계속 호출하는 JSF 페이지 일뿐입니다.
JBoss AS 7 (차이점이없는 7.1.0.CR1의 최대 7.0.0 시도), Seam 2.2.2, JSF 1.2 (+ Facelets), RichFaces 3.3.3 및 Hibernate 4.
도움을 주셔서 감사합니다.
감사
언제 응용 프로그램을 jboss 7로 마이그레이션 했습니까? com.kawoolutions.bbstats.util.CustomJBossAS7JtaPlatform에 대한 코드를 게시 할 수 있습니까? – dcernahoschi
실제로 온라인 버전은 JBoss AS 7에도 있습니다. JBoss AS 7.0.0.Final이지만 어제 로컬 버전을 사용해 동일한 예외/경고를 노출했습니다. 요청 된 코드로 답변이 업데이트되었습니다. – Kawu