[JBoss Seam] - Re: How to authenticate user by department?
by Jack Yeh
I'm trying to extend org.jboss.seam.security.Identity class to append some fields as previous posts advice (many thanks for your help), but I get runtime exception in JBoss AS 4.0.5 GA when I "explode" my project from Eclipse by running ant script that provided by seam-gen.
The exception is java.lang.IllegalArgumentException: no such setter method: com.js.floody.adapter.seam.FloodyIdentity.securityRules which com.js.floody.adapter.seam.FloodyIdentity class is the subclass of the Identity class.
After study chapter 12 (security) of Seam documentation and trace the source code of Identity and it's precedence classes (namely the Selector and AbstractMutable), I can't find the securityRules() method too.
Thus I start to trace component initialization logic (namely the Component, Seam and Initialization classes), but I still can't figure it out what's happen.
What can I do next? Any suggestion is welcome.
Source code:
package com.js.floody.adapter.seam;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.security.Identity;
@Name("org.jboss.seam.security.identity")
public class FloodyIdentity extends Identity {
private static final long serialVersionUID = 2007050500L;
private String department = null;
public FloodyIdentity() {
super();
}
public String getDepartment() {
return department;
}
public void setDepartment(String department) {
this.department = department;
}
}
Exception stack trace:
11:13:43,523 INFO [Component] Component: org.jboss.seam.security.configuration, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.security.Configuration
11:13:43,536 INFO [Component] Component: org.jboss.seam.security.identity, scope: SESSION, type: JAVA_BEAN, class: com.js.floody.adapter.seam.FloodyIdentity
11:13:43,573 ERROR [[/Floody]] Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
java.lang.RuntimeException: Could not create Component: org.jboss.seam.security.identity
at org.jboss.seam.init.Initialization.addComponent(Initialization.java:865)
at org.jboss.seam.init.Initialization.installComponents(Initialization.java:796)
at org.jboss.seam.init.Initialization.init(Initialization.java:503)
at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3763)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4211)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:759)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:739)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:524)
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.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.apache.catalina.core.StandardContext.init(StandardContext.java:5052)
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.apache.commons.modeler.BaseModelMBean.invoke(BaseModelMBean.java:503)
at org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeployInternal(TomcatDeployer.java:297)
at org.jboss.web.tomcat.tc5.TomcatDeployer.performDeploy(TomcatDeployer.java:103)
at org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:371)
at org.jboss.web.WebModule.startModule(WebModule.java:83)
at org.jboss.web.WebModule.startService(WebModule.java:61)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy42.start(Unknown Source)
at org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
at org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
at org.jboss.ws.integration.jboss.DeployerInterceptor.start(DeployerInterceptor.java:92)
at org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
at org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy43.start(Unknown Source)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1015)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy8.deploy(Unknown Source)
at org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
at org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:634)
at org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
at org.jboss.deployment.scanner.AbstractDeploymentScanner.startService(AbstractDeploymentScanner.java:336)
at org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
at org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
at $Proxy0.start(Unknown Source)
at org.jboss.system.ServiceController.start(ServiceController.java:417)
at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy4.start(Unknown Source)
at org.jboss.deployment.SARDeployer.start(SARDeployer.java:302)
at org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:766)
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.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
at org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
at $Proxy5.deploy(Unknown Source)
at org.jboss.system.server.ServerImpl.doStart(ServerImpl.java:482)
at org.jboss.system.server.ServerImpl.start(ServerImpl.java:362)
at org.jboss.Main.boot(Main.java:200)
at org.jboss.Main$1.run(Main.java:490)
at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalArgumentException: no such setter method: com.js.floody.adapter.seam.FloodyIdentity.securityRules
at org.jboss.seam.util.Reflections.getSetterMethod(Reflections.java:219)
at org.jboss.seam.Component.initInitializers(Component.java:401)
at org.jboss.seam.Component.(Component.java:263)
at org.jboss.seam.Component.(Component.java:203)
at org.jboss.seam.init.Initialization.addComponent(Initialization.java:851)
... 139 more
11:13:44,002 INFO [FacesConfigurator] Reading standard config org/apache/myfaces/resource/standard-faces-config.xml
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044884#4044884
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044884
19 years, 1 month
[JBoss Seam] - Re: Parameter passing for page action
by milli
That's what even I thought but may be I'm doing something wrong.
Here is the simple code I'm trying to run but it does not seem to work with event scope. Both category and id are always null unless I change the scope of categoryAction to session. Could you spot anything wrong with this approach? Thanks
| @Name("home")
| Class Home
| {
| private String category;
|
| public getCategory()
| {
| if (null == category)
| category = new String("Testing Event Scope");
| return category;
| }
| }
home.xhtml:
| <h:commandLink action="#{categoryAction.action}" value="#{home.category}">
| <f:param name="category" value="#{home.category}" />
| </h:commandLink>
|
| @Name(categoryAction)
| @Scope(ScopeType.Event)
| Class CategoryAction
| {
| @RequestParameter("category")
| private String category;
|
| public String getId()
| {
| if (null == id)
| System.out.println("id is null");
| return Id;
| }
|
| public String getCategory()
| {
| if (null == category)
| System.out.println("category is null");
| return category;
| }
|
| public void setCategory(String category)
| {
| this.category = category;
| }
|
| public String action()
| {
| this.id = 1;
| return "category.xhtml"
| }
| }
category.xhtml:
|
| <h:outputText value="categoryAction.id" />
| <h:outputText value="categoryAction.category" />
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044881#4044881
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044881
19 years, 1 month
[JBoss Seam] - Conditional navigation in pages.xml
by gmarcus
I am trying to use navigation in pages.xml.
| <page view-id="/emailvalidate.xhtml" action="#{account.validateEmail}">
| <param name="tk" value="#{token.hash}"/>
| <navigation from-action="#{account.validateEmail}">
| <rule if-outcome="success">
| <render view-id="/login.xhtml"/>
| </rule>
| </navigation>
| </page>
|
if the action returns "success", seam renders /login.xhtml
This is what I expected.
What I would like to do, is if the outcome is null, render /validate.xhtml
I tried this:
| <page view-id="/emailvalidate.xhtml" action="#{account.validateEmail}">
| <param name="tk" value="#{token.hash}"/>
| <param name="src" value="email"/>
| <navigation from-action="#{account.validateEmail}">
| <rule if-outcome="success">
| <render view-id="/login.xhtml"/>
| </rule>
| <rule>
| <render view-id="/validate.xhtml"/>
| </rule>
| </navigation>
| </page>
|
For any outcome other than "success", I expected /validate.xhtml to be rendered, but instead, seam renders the original view-id which is /emailvalidate.xhtml
How can I render one page for a specific outcome from an action, and a different page for any other outcome including null?
Glenn
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044880#4044880
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044880
19 years, 1 month
[EJB 3.0] - Cannot create EntityManager from Springframework
by fatdragon
Not sure it is spring or jboss issue but i keep getting the following exception when starting up my standalone web module. I tried both the 4.20 RC2 and 4.05GA with ejb3 patch, same result.
The plan was using spring bean inject the entitymanger at some part of my code using
org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean
bean
I am confused by the error message, since when org.hibernate.ejb.HibernatePersistence not implements the javax.persistence.spi.PersistenceProvider
Is that becase i have some old jar file floating around?
Invocation of init method failed; nested exception is java.lang.IncompatibleClassChangeError: Class org.hibernate.ejb.HibernatePersistence does not implement the requested interface javax.persistence.spi.PersistenceProvider
Caused by:
java.lang.IncompatibleClassChangeError: Class org.hibernate.ejb.HibernatePersistence does not implement the requested interface javax.persistence.spi.PersistenceProvider
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:218)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:251)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1175)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1145)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:427)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:144)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4044872#4044872
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4044872
19 years, 1 month