[JBoss Seam] - Re: How do I configure a Hibernate Interceptor in Seam?
by IGx89
I also needed access to the Configuration object (for a different reason), and I worked around it by extending HibernateSessionFactory, overriding its createSessionFactory method, and putting the original code of the method in there along with my modifications:
| @Scope(ScopeType.APPLICATION)
| @BypassInterceptors
| @Startup
| public class SmartHibernateSessionFactory extends HibernateSessionFactory {
|
| @SuppressWarnings("unchecked")
| protected SessionFactory createSessionFactory() throws ClassNotFoundException {
| ...
| configuration.setInterceptor(...)
| ...
| }
| }
|
Now, this is definitely a hack: there's code duplication involved, and if a new version of Seam changes anything in createSessionFactory you'll need to remember to carry over the changes. My suggestion to the Seam team would be to add an empty method (maybe called furtherConfiguration) into HibernateSessionFactory and then change the last line in createSessionFactory to
return furtherConfiguration(configuration.buildSessionFactory());. That way one could easily change the configuration object without all the maintenance headaches.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093722#4093722
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093722
18Â years, 8Â months
[JBossCache] - frequent deadlocks
by dustismo
Hello,
I am using jbosscache in a seam application (using the PojoCache). Here is my scenerio
I have a servlet which outputs graph images. The servlet looks in the pojoCache for the graph, if it is not there it creates it /puts it into the cache. But if I load a page that has multiple graphs on it (i.e. multiple threads generating and inserting graphs) -- I get frequent deadlocks.
This happens on both REPEATABLE_READ and READ_COMMITTED.
I am putting the graphs in the cache like so:
pojoCache.put(
| "/graphs/delegates/UserGraph/" + graph.getId() + "/",
| "graph",
| graph);
I thought that the lock should be on the branch graph.getId() but it seems to be on branch "UserGraph". Why is this?
Any help is appreciated,
Dustin
Here is the exception:
| 13:12:23,737 ERROR [ReadWriteLockWithUpgrade] upgradeLockAttempt(): more than one reader trying to simultaneously upgrade to write lock
| 13:12:23,737 ERROR [IdentityLock] acquireWriteLock(): lock upgrade failed for /graphs/delegates/UserGraph (caller=GlobalTransaction:<null>:9)
| org.jboss.cache.lock.UpgradeException: upgradeLockAttempt(): more than one reader trying to simultaneously upgrade to write lock
| at org.jboss.cache.lock.ReadWriteLockWithUpgrade.upgradeLockAttempt(ReadWriteLockWithUpgrade.java:106)
| at org.jboss.cache.lock.LockStrategyRepeatableRead.upgradeLockAttempt(LockStrategyRepeatableRead.java:43)
| at org.jboss.cache.lock.IdentityLock.acquireWriteLock(IdentityLock.java:175)
| at org.jboss.cache.Node.acquireWriteLock(Node.java:529)
| at org.jboss.cache.Node.acquire(Node.java:476)
| at org.jboss.cache.interceptors.PessimisticLockInterceptor.acquireNodeLock(PessimisticLockInterceptor.java:342)
| at org.jboss.cache.interceptors.PessimisticLockInterceptor.lock(PessimisticLockInterceptor.java:287)
| at org.jboss.cache.interceptors.PessimisticLockInterceptor.invoke(PessimisticLockInterceptor.java:172)
| at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
| at org.jboss.cache.interceptors.UnlockInterceptor.invoke(UnlockInterceptor.java:32)
| at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
| at org.jboss.cache.interceptors.TxInterceptor.handleNonTxMethod(TxInterceptor.java:364)
| at org.jboss.cache.interceptors.TxInterceptor.invoke(TxInterceptor.java:160)
| at org.jboss.cache.interceptors.Interceptor.invoke(Interceptor.java:68)
| at org.jboss.cache.interceptors.CacheMgmtInterceptor.invoke(CacheMgmtInterceptor.java:157)
| at org.jboss.cache.TreeCache.invokeMethod(TreeCache.java:5710)
| at org.jboss.cache.TreeCache.put(TreeCache.java:3782)
| at org.jboss.cache.TreeCache.put(TreeCache.java:3720)
| at net.infofilter.stats.graphing.delegate.DelegateCache.put(DelegateCache.java:22)
| at net.infofilter.stats.graphing.delegate.DelegateManager.getInstance(DelegateManager.java:38)
| at net.infofilter.stats.graphing.delegate.DelegateManager.getInstance(DelegateManager.java:61)
| at net.infofilter.servlet.media.PublicGraphs.handleRequest(PublicGraphs.java:44)
| at net.infofilter.util.IFFakeServlet.doIt(IFFakeServlet.java:41)
| 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:585)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:106)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:155)
| at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:91)
| at net.infofilter.servlet.media.PublicGraphs_$$_javassist_2.doIt(PublicGraphs_$$_javassist_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:585)
| at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:328)
| at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:273)
| at org.jboss.el.parser.AstMethodSuffix.getValue(AstMethodSuffix.java:59)
| at org.jboss.el.parser.AstMethodSuffix.invoke(AstMethodSuffix.java:65)
| at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
| at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
| at org.jboss.seam.core.Expressions$2.invoke(Expressions.java:174)
| at org.jboss.seam.navigation.Page.preRender(Page.java:275)
| at org.jboss.seam.navigation.Pages.preRender(Pages.java:309)
| at org.jboss.seam.jsf.SeamPhaseListener.preRenderPage(SeamPhaseListener.java:544)
| at org.jboss.seam.jsf.SeamPhaseListener.beforeRenderResponse(SeamPhaseListener.java:455)
| at org.jboss.seam.jsf.SeamPhaseListener.beforeServletPhase(SeamPhaseListener.java:146)
| at org.jboss.seam.jsf.SeamPhaseListener.beforePhase(SeamPhaseListener.java:116)
| at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:222)
| at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:687)
| at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:469)
| at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:403)
| at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
| at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:195)
| at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:159)
| at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:141)
| at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:90)
| at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:395)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:44)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
| at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
| at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
| at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:150)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:104)
| at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:241)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
| at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:580)
| at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
| at java.lang.Thread.run(Thread.java:595)
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093717#4093717
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093717
18Â years, 8Â months
[Tomcat, HTTPD, Servlets & JSP] - 404 page not working
by shanportal
I have set the follwoing properties in the *-object.xml.
| <!-- Control policy config -->
| <property>
| <name>control.portal.access_denied</name>
| <value>jsp</value>
| </property>
| <property>
| <name>control.portal.unavailable</name>
| <value>jsp</value>
| </property>
| <property>
| <name>control.portal.not_found</name>
| <value>jsp</value>
| </property>
| <property>
| <name>control.portal.internal_error</name>
| <value>jsp</value>
| </property>
| <property>
| <name>control.portal.error</name>
| <value>jsp</value>
| </property>
| <property>
| <name>control.portal.resource_uri</name>
| <value>/WEB-INF/jsp/error/portal.jsp</value>
| </property>
| <property>
| <name>control.page.access_denied</name>
| <value>jsp</value>
| </property>
| <property>
| <name>control.page.unavailable</name>
| <value>jsp</value>
| </property>
| <property>
| <name>control.page.not_found</name>
| <value>jsp</value>
| </property>
| <property>
| <name>control.page.internal_error</name>
| <value>jsp</value>
| </property>
| <property>
| <name>control.page.error</name>
| <value>jsp</value>
| </property>
| <property>
| <name>control.page.resource_uri</name>
| <value>/WEB-INF/jsp/error/page.jsp</value>
| </property>
| </properties>
|
When i was trying to access the non exsting page it is not showing the Page 404 Message. Instaed it shows the default page of my portal. Is there any setting i am missing so that i could get the 404 page get displayed.
Any help is highly appriciated. Thanks in advance.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093715#4093715
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093715
18Â years, 8Â months
[JBoss Seam] - How do I configure a Hibernate Interceptor in Seam?
by JakeC
I am trying to implement Hibernate db auditing like http://www.hibernate.org/48.html (but adding field, oldValue, and newValue), and I need to create the Session with my custom Hibernate Interceptor, which is given the User ID in the constructor.
The only place in Seam I see any version of SessionFactory.openSession() being used is in ManagedHibernateSession.initSession(), but I don't really see how to get my Interceptor in there. I could extend ManagedHibernateSession and inject currentUser, but how do I configure Seam to use my extended class? I see the Portal sample app pointing to ManagedHibernateSession in components.xml, but we are using EntityManager, with managed-persistence-context declared in components.xml, not Session.
How do I configure a Hibernate Interceptor in Seam?
Or, is there a better way to do Audit logging in Seam? At first I was looking at using the @EntityListeners annotation, but it would involve lots of Reflection, and there doesn't seem to be a way to get at the previous values of the Entity's properties anyway.
org.hibernate.Interceptor.onFlushDirty() gives me all that (too bad it doesn't also give me boolean isDirty[]), but I don't see how to get it configured within Seam.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4093712#4093712
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4093712
18Â years, 8Â months