[JBoss Seam] - EntityQuery bug
by rmemoria
Hi all,
I'm using SEAM 2.0.0 from the CVS and it seems to have the same problem since version 1.2.1.
I have an EntityQuery object like that:
@Name("localities")
| public class LocalitiesQuery extends EntityQuery {
| private static final long serialVersionUID = -4255032277168197004L;
|
| private String[] restrictions = {"l.region = #{localities.region}"};
|
| private Region region;
|
| public Region getRegion() {
| return region;
| }
|
| public void setRegion(Region region) {
| this.region = region;
| }
|
| @Override
| public String getEjbql() {
| return "from Locality l join fetch l.region";
| }
|
| @Override
| public List<String> getRestrictions() {
| return Arrays.asList(restrictions);
| }
|
| @Override
| protected String getCountEjbql() {
| return "select count(*) from Locality l";
| }
|
| }
PROBLEM: If I try to read localities.resultCount with a restriction defined, I get the following error:
javax.faces.FacesException: javax.el.ELException: /admin/localities.xhtml @37,119 rendered="#{localities.resultCount == 0}": Error reading 'resultCount' on type com.rmemoria.drugman.LocalitiesQuery_$$_javassist_5
| at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:373)
| at javax.faces.component.UIComponent.encodeAll(UIComponent.java:880)
| at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
| at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:812)
| at javax.faces.component.UIComponent.encodeAll(UIComponent.java:886)
| at javax.faces.component.UIComponent.encodeAll(UIComponent.java:892)
| at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:577)
| at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
| at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
| at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
| at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
| 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.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
| 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.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
| 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 com.rmemoria.utils.NoCacheFilter.doFilter(NoCacheFilter.java:40)
| 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(Unknown Source)
| Caused by: javax.el.ELException: /admin/localities.xhtml @37,119 rendered="#{localities.resultCount == 0}": Error reading 'resultCount' on type com.rmemoria.drugman.LocalitiesQuery_$$_javassist_5
| at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:76)
| at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:370)
| ... 52 more
| Caused by: java.lang.IllegalArgumentException: org.hibernate.QueryParameterException: could not locate named parameter [el1]
| at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:176)
| at org.jboss.seam.framework.EntityQuery.setParameters(EntityQuery.java:180)
| at org.jboss.seam.framework.EntityQuery.createCountQuery(EntityQuery.java:169)
| at org.jboss.seam.framework.EntityQuery.initResultCount(EntityQuery.java:105)
| at org.jboss.seam.framework.EntityQuery.getResultCount(EntityQuery.java:97)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at org.jboss.seam.util.Reflections.invoke(Reflections.java:23)
| 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.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38)
| at org.jboss.seam.util.Work.workInTransaction(Work.java:39)
| at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32)
| 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 com.rmemoria.drugman.LocalitiesQuery_$$_javassist_5.getResultCount(LocalitiesQuery_$$_javassist_5.java)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
| at java.lang.reflect.Method.invoke(Unknown Source)
| at javax.el.BeanELResolver.getValue(BeanELResolver.java:62)
| at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
| at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:64)
| at org.jboss.el.parser.AstPropertySuffix.getValue(AstPropertySuffix.java:53)
| at org.jboss.el.parser.AstValue.getValue(AstValue.java:67)
| at org.jboss.el.parser.AstEqual.getValue(AstEqual.java:21)
| at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
| at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
| ... 53 more
| Caused by: org.hibernate.QueryParameterException: could not locate named parameter [el1]
| at org.hibernate.engine.query.ParameterMetadata.ge
| 11:05:29,328 ERROR [STDERR] tNamedParameterDescriptor(ParameterMetadata.java:75)
| at org.hibernate.engine.query.ParameterMetadata.getNamedParameterExpectedType(ParameterMetadata.java:81)
| at org.hibernate.impl.AbstractQueryImpl.determineType(AbstractQueryImpl.java:413)
| at org.hibernate.impl.AbstractQueryImpl.setParameter(AbstractQueryImpl.java:383)
| at org.hibernate.ejb.QueryImpl.setParameter(QueryImpl.java:171)
| ... 88 more
Watching the source code, it seems the resultCount construction is different from the resultList construction. It doesn't consider the restrictions at a first parser, but tries to pass the parameters during query executing.
Regards,
Ricardo Memoria
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083037#4083037
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083037
18 years, 7 months
[JBoss Seam] - Re: Security Problem
by Eethyo
if i leave the Principal(pName:name) away and put a
hardcoded pName in my equals it works fine.
so there must be a conflict between the pName:name and the
Role(name=='anyrole').
so and now i dont know what i am doing wrong.
do i miss some ( ) or something?
package Permissions;
|
| import java.security.Principal;
|
| import org.jboss.seam.security.PermissionCheck;
| import org.jboss.seam.security.Role;
| import com.mydomain.session.User;
|
| rule canUserEditProfile
| when
| c: PermissionCheck(name == 'userProfil', action=='editUserProfil');
| (User(username : username -> (username.equals("hardcodedUser")))
| or
| Role(name =='Admin' ))
| then
| c.grant();
| end;
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083036#4083036
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083036
18 years, 7 months
[JBoss Seam] - Two seam components with same name
by wise_guybg
Hi,
I'm running Seam 2.0.0.B1 and I have the following lines in the console:
anonymous wrote :
| 16:13:37,004 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.persistence.persistenceProvider
| 16:13:37,051 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.resourceLoader
| 16:13:37,067 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.expressions
| 16:13:37,067 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.web.parameters
| 16:13:37,067 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.bpm.businessProcess
| 16:13:37,082 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.manager
| 16:13:37,098 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.web.userPrincipal
| 16:13:37,098 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.web.ajax4jsfFilter
| 16:13:37,098 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.security.identity
| 16:13:37,098 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.web.isUserInRole
| 16:13:37,098 INFO [Initialization] two components with same name, higher precedence wins: org.jboss.seam.core.resourceBundle
Source code that is causing this:
org\jboss\seam\bpm\BusinessProcess
@Scope(ScopeType.CONVERSATION)
| @Name("org.jboss.seam.bpm.businessProcess")
| @BypassInterceptors
| @Install(dependencies="org.jboss.seam.bpm.jbpm", precedence=BUILT_IN)
org\jboss\seam\faces\BusinessProcess
@Scope(ScopeType.CONVERSATION)
| @Name("org.jboss.seam.bpm.businessProcess")
| @BypassInterceptors
| @Install(dependencies="org.jboss.seam.bpm.jbpm", precedence=FRAMEWORK, classDependencies="javax.faces.context.FacesContext")
Is this supposed to be like that? The latest repository version that I have has the same problem. There is a faces override that is causing the notice to appear. Shouldn't there be a more "clear" way to do the override?
PS Excuse me if this question was discussed in a previous thread...
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4083029#4083029
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4083029
18 years, 7 months