I am new to Seam and trying to use it by manipulating the example using my own Oracle 10g.
I got this problem with "no persistent class found for query class". You would
be highly appreciated for any suggestion!
Here are my related files:
persistence.xml:
<?xml version="1.0" encoding="UTF-8"?>
| <persistence version="1.0"
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_1_0.xsd">
| <persistence-unit name="securitPU"><!--
transaction-type="JTA"-->
| <provider>org.hibernate.ejb.HibernatePersistence</provider>
| <jta-data-source>java:/securityDatasource</jta-data-source>
| <exclude-unlisted-classes>false</exclude-unlisted-classes>
| <properties>
| <property name="hibernate.dialect"
value="org.hibernate.dialect.Oracle10gDialect"/>
| <property name="hibernate.show_sql" value="true"/>
| <property name="hibernate.format_sql" value="true"/>
| <property name="jboss.entity.manager.factory.jndi.name"
value="java:/securityEntityManagerFactory"/>
| </properties>
| </persistence-unit>
| </persistence>
components.xml:
| <?xml version="1.0" encoding="UTF-8"?>
| <components
xmlns="http://jboss.com/products/seam/components"
|
xmlns:core="http://jboss.com/products/seam/core"
|
xmlns:persistence="http://jboss.com/products/seam/persistence"
|
xmlns:drools="http://jboss.com/products/seam/drools"
|
xmlns:bpm="http://jboss.com/products/seam/bpm"
|
xmlns:security="http://jboss.com/products/seam/security"
|
xmlns:mail="http://jboss.com/products/seam/mail"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
| xsi:schemaLocation=
| "http://jboss.com/products/seam/core
http://jboss.com/products/seam/core-2.0.xsd
|
http://jboss.com/products/seam/persistence
http://jboss.com/products/seam/persistence-2.0.xsd
|
http://jboss.com/products/seam/drools
http://jboss.com/products/seam/drools-2.0.xsd
|
http://jboss.com/products/seam/bpm
http://jboss.com/products/seam/bpm-2.0.xsd
|
http://jboss.com/products/seam/security
http://jboss.com/products/seam/security-2.0.xsd
|
http://jboss.com/products/seam/mail
http://jboss.com/products/seam/mail-2.0.xsd
|
http://jboss.com/products/seam/components
http://jboss.com/products/seam/components-2.0.xsd">
|
| <core:init jndi-pattern="securityApp/#{ejbName}/local"/>
|
| <core:manager concurrent-request-timeout="500"
| conversation-timeout="120000"
| conversation-id-parameter="cid"/>
|
| <persistence:managed-persistence-context name="entityManager"
| auto-create="true"
|
persistence-unit-jndi-name="java:/securityEntityManagerFactory"/>
|
| <security:identity authenticate-method="#{authenticator.authenticate}"
remember-me="true"/>
| <event type="org.jboss.seam.security.notLoggedIn">
| <action execute="#{redirect.captureCurrentView}"/>
| </event>
| <event type="org.jboss.seam.security.loginSuccessful">
| <action execute="#{redirect.returnToCapturedView}"/>
| </event>
| </components>
|
Java code:
| @Name("authenticator")
| public class Authenticator implements Serializable {
| @Out(required=false, scope=SESSION)
| private Users user;
|
| @In(value="#{entityManager}")
| EntityManager em;
|
| public boolean authenticate() {
| try {
| Query query= em.createQuery("from
com.fortna.wcs.security.entity.Users u where u.loginname = :username and u.passwd =
:password");
| query.setParameter("username",
Identity.instance().getUsername());
| query.setParameter("password",
Identity.instance().getPassword());
| user = (Users) query.getSingleResult();
| if (user == null) {
| return false;
| }
|
| if (user.getUserroles() != null) {
| for (Userroles role : user.getUserroles())
| Identity.instance().addRole(role.getRole().getRolename());
| }
| return true;
| } catch (NoResultException ex) {
| ex.printStackTrace();
| return false;
| } catch (Exception ex) {
| ex.printStackTrace();
| return false;
| }
| }
|
And the console info:
| 2008-04-29 16:13:04,059 DEBUG [org.jboss.seam.Component] done initializing:
org.jboss.seam.core.interpolator
| 2008-04-29 16:13:04,059 DEBUG
[org.jboss.seam.persistence.HibernatePersistenceProvider] Hibernate Search is available
:-)
| 2008-04-29 16:13:04,059 DEBUG [org.jboss.seam.Component] initializing new instance of:
org.jboss.seam.persistence.persistenceProvider
| 2008-04-29 16:13:04,059 DEBUG [org.jboss.seam.Component] done initializing:
org.jboss.seam.persistence.persistenceProvider
| 2008-04-29 16:13:04,060 DEBUG [org.jboss.mx.loading.RepositoryClassLoader]
setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3@15731
| 37, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader@1513f3{
url=null ,addedOrder=0}
| 2008-04-29 16:13:04,061 DEBUG [org.jboss.seam.contexts.Contexts] found in conversation
context: org.jboss.seam.persistence.persistenceContexts
| 2008-04-29 16:13:04,062 DEBUG [org.jboss.mx.loading.RepositoryClassLoader]
setRepository, repository=org.jboss.mx.loading.HeirarchicalLoaderRepository3@15731
| 37, cl=org.jboss.mx.loading.HeirarchicalLoaderRepository3$CacheClassLoader@1d0eefb{
url=null ,addedOrder=0}
| 2008-04-29 16:13:04,062 DEBUG [org.jboss.seam.persistence.ManagedPersistenceContext]
created seam managed persistence context for persistence unit: java:/sec
| urityEntityManagerFactory
| 2008-04-29 16:13:04,062 DEBUG [org.jboss.seam.util.Naming] JNDI InitialContext
properties:{java.naming.factory.initial=org.jnp.interfaces.NamingContextFactor
| y, java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces}
| 2008-04-29 16:13:04,063 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl] Looking
for a JTA transaction to join
| 2008-04-29 16:13:04,063 DEBUG [org.hibernate.ejb.AbstractEntityManagerImpl]
Transaction already joined
| 2008-04-29 16:13:04,063 DEBUG [org.jboss.seam.Component] instantiating Seam component:
org.jboss.seam.web.parameters
| 2008-04-29 16:13:04,063 DEBUG [org.jboss.seam.Component] initializing new instance of:
org.jboss.seam.web.parameters
| 2008-04-29 16:13:04,063 DEBUG [org.jboss.seam.Component] done initializing:
org.jboss.seam.web.parameters
| 2008-04-29 16:13:04,063 WARN [org.hibernate.hql.QuerySplitter] no persistent classes
found for query class: select u from com.fortna.wcs.security.entity.Use
| rs u
| 2008-04-29 16:13:04,064 ERROR [STDERR] javax.persistence.NoResultException: No entity
found for query
| 2008-04-29 16:13:04,064 ERROR [STDERR] at
org.hibernate.ejb.QueryImpl.getSingleResult(QueryImpl.java:83)
| 2008-04-29 16:13:04,064 ERROR [STDERR] at
com.fortna.wcs.security.Authenticator.authenticate(Authenticator.java:36)
| 2008-04-29 16:13:04,064 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 2008-04-29 16:13:04,064 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 2008-04-29 16:13:04,064 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 2008-04-29 16:13:04,064 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:597)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
com.fortna.wcs.security.Authenticator_$$_javassist_1.authenticate(Authenticator_$$_javassist_1.java)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 2008-04-29 16:13:04,065 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:597)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
org.jboss.seam.core.Expressions$2.invoke(Expressions.java:173)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:109)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:597)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
| 2008-04-29 16:13:04,066 ERROR [STDERR] at
javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
javax.security.auth.login.LoginContext$5.run(LoginContext.java:706)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
java.security.AccessController.doPrivileged(Native Method)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
javax.security.auth.login.LoginContext.invokeCreatorPriv(LoginContext.java:703)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
javax.security.auth.login.LoginContext.login(LoginContext.java:575)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
org.jboss.seam.security.Identity.authenticate(Identity.java:259)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
org.jboss.seam.security.Identity.authenticate(Identity.java:248)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
org.jboss.seam.security.Identity.login(Identity.java:205)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:597)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
javax.faces.component.UICommand.broadcast(UICommand.java:383)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:184)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:162)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:350)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
| 2008-04-29 16:13:04,067 ERROR [STDERR] at
javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
| 2008-04-29 16:13:04,068 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
| 2008-04-29 16:13:04,068 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
| 2008-04-29 16:13:04,068 ERROR [STDERR] at
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| 2008-04-29 16:13:04,068 ERROR [STDERR] at
org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
| 2008-04-29 16:13:04,068 ERROR [STDERR] at
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| 2008-04-29 16:13:04,068 ERROR [STDERR] at
org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
| 2008-04-29 16:13:04,068 ERROR [STDERR] at
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| 2008-04-29 16:13:04,068 ERROR [STDERR] at
org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
| 2008-04-29 16:13:04,068 ERROR [STDERR] at
org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
| 2008-04-29 16:13:04,068 ERROR [STDERR] at
org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
| ....
|
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4147993#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...