[EJB 3.0] - HibernateException: this instance does not yet exist as a ro
by wmax
I have a stateful session bean that uses other stateless session beans via their remote interfaces. The stateless session beans use EJB3 persistence. Now I have this scenario:
Application bean (stateful):
Resource resource = securityManager_.createResource(admin);
| return folderManager_.createRootFolder(resource);
Security Manager bean (stateless):
@PersistenceContext private EntityManager em_;
|
| public Resource createResource(User owner) throws SecurityException {
| Resource resource = new Resource(owner);
| em_.persist(resource);
| return resource;
| }
Folder Manager bean (stateless):
@PersistenceContext private EntityManager em_;
|
| public Folder createRootFolder(Resource resource) throws FolderException {
|
| // this instruction causes the exception
| em_.refresh(resource);
|
| // code omitted
| }
The em_.refresh(resource); causes a HibernateException to be throws:
anonymous wrote : Stack Trace:
| * org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:567)
| * org.hibernate.ejb.AbstractEntityManagerImpl.refresh(AbstractEntityManagerImpl.java:239)
| * org.jboss.ejb3.entity.TransactionScopedEntityManager.refresh(TransactionScopedEntityManager.java:193)
| * net.sf.adigres.foldermanager.FolderManagerBean.createRootFolder(FolderManagerBean.java:88)
| * ....
| Caused by: org.hibernate.HibernateException: this instance does not yet exist as a row in the database
| * org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:90)
| * org.hibernate.event.def.DefaultRefreshEventListener.onRefresh(DefaultRefreshEventListener.java:39)
| * org.hibernate.impl.SessionImpl.fireRefresh(SessionImpl.java:895)
| * org.hibernate.impl.SessionImpl.refresh(SessionImpl.java:879)
| * org.hibernate.ejb.AbstractEntityManagerImpl.refresh(AbstractEntityManagerImpl.java:233)
| * ... 106 more
This happens only in conjunction with the stateful Application bean. Stand alone tests of the two stateless beans involved work without problems.
I guess it has something to do with transactions but I don't use @TransactionAttribute annotations anywhere so the default value (REQUIRED) should apply (and be appropriate).
Can anyone help me with this, please?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004544#4004544
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004544
19 years, 3 months
[JBoss Seam] - PropertyNotFoundException with basic call to method
by christian_zeidler
Hello,
I'm quite new to Seam and am encountering a problem that must be rather easy to solve ... I think, or hope...
I'm trying to show/ hide elements on the navigation menu based on whether the user is logged in or not (as in the dvd-store example).
Here is the code from the nav-menu:
| <f:subview rendered="#{login.test}">
| <li id="page_hidden"><s:link view="/hidden.xhtml" value="Hidden" propagation="none"/></li>
| </f:subview>
|
Now for all simplicity, my LoginBean class contains the method test() wich simply returns true:
| public boolean test(){
| return true;
| }
|
and the interface defines that method:
| @Local
| public interface Login {
|
| public String login();
| public String getUserName();
| public void setUserName(String username);
| public boolean test();
| }
|
OK, so now here is the exception that I get when calling any page that uses tha menu:
| javax.faces.el.PropertyNotFoundException: /layout/nav.xhtml @9,45 rendered="#{login.test}": Bean: christian.navtest.Login$$EnhancerByCGLIB$$9bac42c3, property: test
| at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:58)
| at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1075)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:231)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:239)
| at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:580)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
|
Thank you for your help!
(If you need more information please let me know)
- Christian
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4004542#4004542
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4004542
19 years, 3 months