[JBoss Seam] - JAAS auth and accessing Principal in EJB
by davetron5000
My basic problem is that I've got Seam successfully using JAAS for authentication, however the logged-in principal is not showing up on the backend; instead I'm getting the "unauthenticatedIdentity" principal.
Jboss 4.0.5
Seam 1.2.1
I've configured JBoss to use the DatabaseServerLoginModule as such:
| <application-policy name = "tfdRealm">
| <authentication>
| <login-module code = "org.jboss.security.auth.spi.DatabaseServerLoginModule" flag = "required">
| <module-option name = "unauthenticatedIdentity">guest</module-option>
| <module-option name = "dsJndiName">java:/TFDDB</module-option>
| <module-option name = "principalsQuery">select password from user where username=?</module-option>
| <module-option name = "rolesQuery">select r.rolename,'Roles' from role r, user u, roleuser ru where r.roleid = ru.roleid and u.userid = ru.userid and u.username = ?</module-option>
| </login-module>
| </authentication>
| </application-policy>
|
My components.xml contains this:
| <component name="org.jboss.seam.security.identity" jaas-config-name="tfdRealm" />
|
My login.xhtml is:
| <body>
| <h:messages />
| <h:form>
| <table border="0">
| <tr><td>Username:</td><td><h:inputText value="#{identity.username}" /></td></tr>
| <tr><td>Password:</td><td><h:inputSecret value="#{identity.password}" /></td></tr>
| <tr><td><h:commandButton value="Login" action="#{identity.login}" /></td></tr>
| </table>
| </h:form>
| </body>
|
(extra XML declaration stuff omitted).
Note that I have no implemented an authenticator. Clicking the login button uses the configured policy in JBoss and everything's seems to work (valid user/pass logs in, invalid does not).
I have a session bean as follows:
| @Stateless
| @Name("todoManager")
| @SecurityDomain("tfdRealm")
| public class StatlessTodoAccess implements TodoAccess,TodoAccessRemote
| {
| @PersistenceContext(unitName="tfd")
| private EntityManager itsEntityManager;
|
| @Resource
| private SessionContext itsContext;
|
| @Factory("allTodos")
| public List<Todo> getAllTodos()
| {
| org.apache.log4j.Logger logger = org.apache.log4j.Logger.getLogger(getClass().getName());
|
| Principal caller = itsContext.getCallerPrincipal();
| String username = caller.getName();
| logger.info("caller was " + username);
|
| Query query = itsEntityManager.createQuery("select u from User u where u.username=:username");
| query.setParameter("username",username);
|
| try
| {
| User user = (User)query.getSingleResult();
| logger.info("user has " + user.getTodos().size() + " todos");
| return user.getTodos();
| }
| catch (NoResultException e)
| {
| logger.error("No results for " + username,e);
| return new ArrayList<Todo>();
| }
|
| }
| }
|
accessed via
| <body>
| <f:view>
| <f:verbatim>
| <h2>To F'n Do</h2>
| Add New: <input type="text" />
| </f:verbatim>
| <br />
| <f:subview id="allTodos">
| <h:dataTable value="#{allTodos}" var="todo">
| <h:column><b><h:outputText value="#{todo.description}" /></b></h:column>
| </h:dataTable>
| </f:subview>
| </f:view>
| </body>
|
The caller princpal returned by getCallerPrincipal() is "guest" and not the username I used to log in.
I'm a bit confused by this; how can I get the EJBs to see my login (and, where did the principal/subject created by my successful login go?)
I've read a previous thread on the subject and I was extremely confused. I downloaded two examples that claim to show JAAS working with seam, however one was out-dated and the other didn't contain any code. I couldn't find any info in either to help my problem.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061465#4061465
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061465
18Â years, 9Â months
[JBoss Seam] - Re: Trouble Deploying Seam App To Tomcat
by strickla
I've also noticed that I can't seem to have more than one Seam application deployed on Tomcat at once. It looks like including libs like jboss-seam.jar in each of your deployed applications causes problems.
The following exceptions are generated:
INFO: Deploying web application archive jboss-seam-booking.war
| ERROR 06-07 16:16:28,828 (DeployerWrapper.java:commitDeploy:177) -Error during
| deployment: vfsfile:/C:/apache/apache-tomcat-6.0.13/webapps/jboss-seam-booking/W
| EB-INF/lib/jboss-seam.jar
| org.jboss.deployers.spi.DeploymentException: java.lang.IllegalStateException: Co
| ntainer jboss.j2ee:jar=jboss-seam.jar,name=TimerServiceDispatcher,service=EJB3 i
| s already registered
| at org.jboss.ejb3.deployers.EJBRegistrationDeployer.deploy(EJBRegistrati
| onDeployer.java:167)
| at org.jboss.deployers.plugins.deployer.AbstractSimpleDeployer.commitDep
| loy(AbstractSimpleDeployer.java:52)
| at org.jboss.deployers.plugins.deployer.DeployerWrapper.commitDeploy(Dep
| loyerWrapper.java:170)
| at org.jboss.deployers.plugins.deployment.MainDeployerImpl.commitDeploy(
| MainDeployerImpl.java:592)
| at org.jboss.deployers.plugins.deployment.MainDeployerImpl.process(MainD
| eployerImpl.java:476)
| at org.jboss.deployers.plugins.deployment.MainDeployerImpl.process(MainD
| eployerImpl.java:406)
| at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:128)
| at org.jboss.embedded.tomcat.WebinfScanner.lifecycleEvent(WebinfScanner.
| java:88)
| at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
| eSupport.java:117)
| at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
| 236)
| at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
| .java:791)
| at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
| 1)
| at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
|
| at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
|
| at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714
| )
| at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490
| )
| at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1206)
| at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
| :293)
| at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
| eSupport.java:117)
| at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBas
| e.java:1337)
| at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.p
| rocessChildren(ContainerBase.java:1601)
| at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.p
| rocessChildren(ContainerBase.java:1610)
| at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.r
| un(ContainerBase.java:1590)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: java.lang.IllegalStateException: Container jboss.j2ee:jar=jboss-seam.
| jar,name=TimerServiceDispatcher,service=EJB3 is already registered
| at org.jboss.ejb3.Ejb3Registry.register(Ejb3Registry.java:80)
| at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:465)
| at org.jboss.ejb3.Ejb3Deployment.deployElement(Ejb3Deployment.java:410)
| at org.jboss.ejb3.Ejb3Deployment.deployUrl(Ejb3Deployment.java:392)
| at org.jboss.ejb3.Ejb3Deployment.deploy(Ejb3Deployment.java:358)
| at org.jboss.ejb3.Ejb3Deployment.create(Ejb3Deployment.java:313)
| at org.jboss.ejb3.deployers.EJBRegistrationDeployer.deploy(EJBRegistrati
| onDeployer.java:157)
| ... 23 more
| WARN 06-07 16:16:30,859 (JBossTimerServiceFactory.java:restoreTimerService:112)
| -TIMER SERVICE IS NOT INSTALLED
| Jul 6, 2007 4:16:31 PM org.apache.tomcat.util.modeler.Registry registerComponent
|
| SEVERE: Null component Catalina:type=JspMonitor,name=jsp,WebModule=//localhost/j
| boss-seam-booking,J2EEApplication=none,J2EEServer=none
| Jul 6, 2007 4:16:31 PM org.apache.catalina.startup.HostConfig deployWAR
| SEVERE: Error deploying web application archive jboss-seam-booking.war
| java.lang.RuntimeException: org.jboss.deployers.spi.IncompleteDeploymentExceptio
| n: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
|
| *** DEPLOYMENTS IN ERROR: Name -> Error
|
| vfsfile:/C:/apache/apache-tomcat-6.0.13/webapps/jboss-seam-booking/WEB-INF/lib/j
| boss-seam.jar -> java.lang.IllegalStateException: Container jboss.j2ee:jar=jboss
| -seam.jar,name=TimerServiceDispatcher,service=EJB3 is already registered
|
|
| at org.jboss.embedded.tomcat.WebinfScanner.lifecycleEvent(WebinfScanner.
| java:92)
| at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
| eSupport.java:117)
| at org.apache.catalina.core.StandardContext.start(StandardContext.java:4
| 236)
| at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase
| .java:791)
| at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:77
| 1)
| at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
|
| at org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:825)
|
| at org.apache.catalina.startup.HostConfig.deployWARs(HostConfig.java:714
| )
| at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:490
| )
| at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1206)
| at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java
| :293)
| at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(Lifecycl
| eSupport.java:117)
| at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBas
| e.java:1337)
| at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.p
| rocessChildren(ContainerBase.java:1601)
| at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.p
| rocessChildren(ContainerBase.java:1610)
| at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.r
| un(ContainerBase.java:1590)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: org.jboss.deployers.spi.IncompleteDeploymentException: Summary of inc
| omplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
|
| *** DEPLOYMENTS IN ERROR: Name -> Error
|
| vfsfile:/C:/apache/apache-tomcat-6.0.13/webapps/jboss-seam-booking/WEB-INF/lib/j
| boss-seam.jar -> java.lang.IllegalStateException: Container jboss.j2ee:jar=jboss
| -seam.jar,name=TimerServiceDispatcher,service=EJB3 is already registered
|
|
| at org.jboss.embedded.DeploymentGroup.checkIncomplete(DeploymentGroup.ja
| va:151)
| at org.jboss.embedded.DeploymentGroup.process(DeploymentGroup.java:129)
| at org.jboss.embedded.tomcat.WebinfScanner.lifecycleEvent(WebinfScanner.
| java:88)
| ... 16 more
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061464#4061464
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061464
18Â years, 9Â months
[JBoss Portal] - Re: JBOSS Portal 2.6 + MyFaces within my application not wor
by egandt
I looked at the suggested reading and tried a number of suggested options,
The best options seems to be adding
| <context-param>
| <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
| <param-value>true</param-value>
| </context-param>
|
I assume that since my application includes a portlet.xml file (and also includes portlets), this is the cause of the problem, I'm guessing that something to do with deploying portlets requires access to JSFaces, but this is just a guess on my part.
A google search did not return anything usefull on this issue.
| 23:43:04,817 INFO [TomcatDeployer] deploy, ctxPath=/xx, warUrl=.../deploy/xx.war/
| 23:43:08,891 ERROR [STDERR] java.lang.IllegalArgumentException: Class org.jboss.portal.faces.portlet.JSFMetaBridgeViewHandlerImpl is no javax.faces.application.ViewHandler
| 23:43:08,892 ERROR [STDERR] at org.apache.myfaces.config.FacesConfigurator.getApplicationObject(FacesConfigurator.java:665)
| 23:43:08,892 ERROR [STDERR] at org.apache.myfaces.config.FacesConfigurator.configureApplication(FacesConfigurator.java:602)
| 23:43:08,892 ERROR [STDERR] at org.apache.myfaces.config.FacesConfigurator.configure(FacesConfigurator.java:148)
| 23:43:08,892 ERROR [STDERR] at org.apache.myfaces.webapp.StartupServletContextListener.initFaces(StartupServletContextListener.java:68)
| 23:43:08,892 ERROR [STDERR] at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:51)
| 23:43:08,893 ERROR [STDERR] at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3854)
| 23:43:08,893 ERROR [STDERR] at org.apache.catalina.core.StandardContext.start(StandardContext.java:4359)
| 23:43:08,893 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:761)
| 23:43:08,893 ERROR [STDERR] at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:741)
| 23:43:08,893 ERROR [STDERR] at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
| 23:43:08,893 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 23:43:08,893 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 23:43:08,893 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 23:43:08,893 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 23:43:08,894 ERROR [STDERR] at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
| 23:43:08,894 ERROR [STDERR] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
| 23:43:08,894 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 23:43:08,894 ERROR [STDERR] at org.apache.catalina.core.StandardContext.init(StandardContext.java:5310)
| 23:43:08,894 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 23:43:08,894 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 23:43:08,894 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 23:43:08,894 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 23:43:08,894 ERROR [STDERR] at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:297)
| 23:43:08,895 ERROR [STDERR] at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
| 23:43:08,895 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 23:43:08,895 ERROR [STDERR] at org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
| 23:43:08,895 ERROR [STDERR] at org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
| 23:43:08,895 ERROR [STDERR] at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
| 23:43:08,895 ERROR [STDERR] at org.jboss.web.WebModule.startModule(WebModule.java:83)
| 23:43:08,895 ERROR [STDERR] at org.jboss.web.WebModule.startService(WebModule.java:61)
| 23:43:08,895 ERROR [STDERR] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
| 23:43:08,896 ERROR [STDERR] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
| 23:43:08,896 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
| 23:43:08,896 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 23:43:08,896 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 23:43:08,896 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 23:43:08,896 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 23:43:08,897 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| 23:43:08,897 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 23:43:08,897 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 23:43:08,897 ERROR [STDERR] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| 23:43:08,897 ERROR [STDERR] at $Proxy0.start(Unknown Source)
| 23:43:08,897 ERROR [STDERR] at org.jboss.system.ServiceController.start(ServiceController.java:417)
| 23:43:08,897 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
| 23:43:08,897 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 23:43:08,897 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 23:43:08,898 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 23:43:08,898 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 23:43:08,898 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| 23:43:08,898 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 23:43:08,898 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 23:43:08,898 ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| 23:43:08,898 ERROR [STDERR] at $Proxy182.start(Unknown Source)
| 23:43:08,898 ERROR [STDERR] at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
| 23:43:08,898 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 23:43:08,899 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 23:43:08,899 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 23:43:08,899 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 23:43:08,899 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 23:43:08,899 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 23:43:08,899 ERROR [STDERR] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| 23:43:08,899 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 23:43:08,900 ERROR [STDERR] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| 23:43:08,900 ERROR [STDERR] at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
| 23:43:08,901 ERROR [STDERR] at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
| 23:43:08,901 ERROR [STDERR] at org.jboss.ws.integration.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:93)
| 23:43:08,901 ERROR [STDERR] at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
| 23:43:08,901 ERROR [STDERR] at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
| 23:43:08,901 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 23:43:08,901 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 23:43:08,902 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 23:43:08,902 ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| 23:43:08,902 ERROR [STDERR] at $Proxy183.start(Unknown Source)
| 23:43:08,902 ERROR [STDERR] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
| 23:43:08,902 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
| 23:43:08,902 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| 23:43:08,902 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor25.invoke(Unknown Source)
| 23:43:08,902 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 23:43:08,902 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 23:43:08,902 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 23:43:08,903 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 23:43:08,903 ERROR [STDERR] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| 23:43:08,903 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 23:43:08,903 ERROR [STDERR] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| 23:43:08,903 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 23:43:08,903 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 23:43:08,903 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 23:43:08,903 ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| 23:43:08,904 ERROR [STDERR] at $Proxy9.deploy(Unknown Source)
| 23:43:08,904 ERROR [STDERR] at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
| 23:43:08,904 ERROR [STDERR] at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
| 23:43:08,904 ERROR [STDERR] at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
| 23:43:08,904 ERROR [STDERR] at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
| 23:43:08,904 ERROR [STDERR] at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
| 23:43:08,904 ERROR [STDERR] at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
| 23:43:08,904 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
| 23:43:08,904 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 23:43:08,905 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 23:43:08,905 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 23:43:08,905 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 23:43:08,905 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| 23:43:08,905 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 23:43:08,905 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 23:43:08,905 ERROR [STDERR] at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
| 23:43:08,905 ERROR [STDERR] at $Proxy0.start(Unknown Source)
| 23:43:08,905 ERROR [STDERR] at org.jboss.system.ServiceController.start(ServiceController.java:417)
| 23:43:08,908 ERROR [STDERR] at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
| 23:43:08,908 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 23:43:08,908 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 23:43:08,908 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 23:43:08,908 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 23:43:08,908 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
| 23:43:08,908 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 23:43:08,909 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 23:43:08,909 ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| 23:43:08,909 ERROR [STDERR] at $Proxy4.start(Unknown Source)
| 23:43:08,909 ERROR [STDERR] at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
| 23:43:08,909 ERROR [STDERR] at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
| 23:43:08,909 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
| 23:43:08,909 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
| 23:43:08,909 ERROR [STDERR] at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
| 23:43:08,910 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 23:43:08,910 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 23:43:08,910 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 23:43:08,910 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:597)
| 23:43:08,910 ERROR [STDERR] at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
| 23:43:08,910 ERROR [STDERR] at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
| 23:43:08,910 ERROR [STDERR] at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
| 23:43:08,910 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 23:43:08,911 ERROR [STDERR] at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
| 23:43:08,911 ERROR [STDERR] at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
| 23:43:08,911 ERROR [STDERR] at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
| 23:43:08,911 ERROR [STDERR] at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
| 23:43:08,911 ERROR [STDERR] at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
| 23:43:08,911 ERROR [STDERR] at $Proxy5.deploy(Unknown Source)
| 23:43:08,911 ERROR [STDERR] at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
| 23:43:08,911 ERROR [STDERR] at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
| 23:43:08,911 ERROR [STDERR] at org.jboss.Main.boot(Main.java:200)
| 23:43:08,912 ERROR [STDERR] at org.jboss.Main$1.run(Main.java:508)
| 23:43:08,912 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
| 23:43:11,644 INFO [STDOUT] Initializing InheritingLoggingContext
|
Thanks for your continuing help,
ERIC
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061459#4061459
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061459
18Â years, 9Â months
[JBossCache] - A timebomb in the UnlockInterceptor?
by girafy
Hello,
We are using the JBossCache v.1.4.1.SP3. Recently we started experiencing a locking problem: lots of TimeoutExceptions: read/write lock for ... could not be acquired after a timeout. After analyzing the source coude we have noticed the following:
In the UnlockInterceptor there is a trace output:
if (trace) log.trace("Attempting to release locks on current thread. Lock table is " + lock_table);
The trace variable (log.isTraceEnabled()) is true when you use the log4j logging and configure your thresholds on appenders level (our case). So, the concatenation in the above code line does happen although the console shows no output.
The concatenation causes the toString() method to be called on all IdentityLock objects that are contained in the lock_table. The toString() logic there is quite heavy: it gets all reader owners (there can be lots of them), adds them one by one to an ArrayList, and then adds this list into a StringBuffer which in turn causes the toString() to be invoked on every reader. So this takes time.
Now, all of this happens before releasing a lock, so if another thread tries to acquire a lock, it'll have to wait until the current thread finishes its concatenation. And there is a snowball effect: the more threads are performing this, the less chances each individual thread (including the write lock owner) has to release its lock. And since the logic is in the finally block, even those threads that were unsuccessful in obtaining a lock, have to do this concatenation before exiting which provokes more and more threads to be slower and slower passing this bottleneck.
We've performed a little test: 300 threads, 1 node, each thread randomly puts or reads the data from this node 30 times. Without a concatenation (when the overall debug level is set to INFO) this finishes in less than a minute and all operations are successful. When the debug level is set to DEBUG, the test can be running several hours or even produce an out of memory error, and almost all of the read/write attempts fail because of the TimeoutException.
So we suggest to remove the above debug code from the future versions of the cache. Also, maybe it's a good idea to remove the heavy code from the toString() method to prevent such situations from occuring.
Thank you.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4061445#4061445
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4061445
18Â years, 9Â months