[EJB/JBoss] - EJB : Maintaining a context for each stateful session bean w
by olvin
Hello,
Our app.ear will be used by more than one database (so, there are more than one persistence unit).
So, we have a MAIN stateful session bean which receipts queries from clients to execute some procedures.
The procedures are stored in others stateless session beans or simple java classes.
We have recorded all the persistence units in the JNDI and we pass the name of the one to use to the MAIN stateful session bean which is the remote access for the clients. No problem to access to the database through the entitymanager directly from the MAIN stateful session bean :
InitialContext jndiContext = new InitialContext();
em = (EntityManager) jndiContext.lookup("java:/"+persistenceUnitName);
How can we know in the stateless session beans or in the simple java classes the persistence unit to use without propagating the name of the persistence unit to use to all the methods ?
=> A kind of a "context" for each MAIN stateful session bean instances which will be accessible for all beans and classes called from the instances.
But how to implement it ?
Thanks,
Olivier
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4007874#4007874
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4007874
19 years, 2 months
[JBoss Seam] - ResultList from EntityQuery raises OutOfBoundsException
by markfoerstein
Hello, I used seam gen (from 1.1.1.GA) to generate a simple application.
When I call my GenCidadeList.seam , I can see the search page containing the first results, and the links Next Page Right and Last Page Right.
But when I try to browse the result, clicking on the "Next Page" link I get:
javax.faces.el.EvaluationException: /GenCidadeList.xhtml @57,62 rendered="#{empty genCidadeList.resultList}": Exception getting value of property resultList of base of type : com.sphere.consultoria.entity.GenCidadeList$$EnhancerByCGLIB$$6ff1f45a
| at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:60)
| at javax.faces.component.UIComponentBase.isRendered(UIComponentBase.java:1075)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:241)
| at com.sun.facelets.tag.jsf.ComponentSupport.encodeRecursive(ComponentSupport.java:249)
| at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:573)
| at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:384)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:138)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:32)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:46)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:432)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: javax.faces.el.EvaluationException: Bean: com.sphere.consultoria.entity.GenCidadeList$$EnhancerByCGLIB$$6ff1f45a, property: resultList
| at org.apache.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:442)
| at org.apache.myfaces.el.PropertyResolverImpl.getValue(PropertyResolverImpl.java:82)
| at com.sun.facelets.el.LegacyELContext$LegacyELResolver.getValue(LegacyELContext.java:141)
| at com.sun.el.parser.AstValue.getValue(AstValue.java:117)
| at com.sun.el.parser.AstEmpty.getValue(AstEmpty.java:49)
| at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
| at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
| at com.sun.facelets.el.LegacyValueBinding.getValue(LegacyValueBinding.java:56)
| ... 32 more
| Caused by: java.lang.reflect.InvocationTargetException
| 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.myfaces.el.PropertyResolverImpl.getProperty(PropertyResolverImpl.java:438)
| ... 39 more
| Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not execute query
| at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:647)
| at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:73)
| at org.jboss.seam.framework.EntityQuery.getResultList(EntityQuery.java:37)
| at org.jboss.seam.framework.EntityQuery$$FastClassByCGLIB$$225925e6.invoke(<generated>)
| at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
| at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:45)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:55)
| at org.jboss.seam.interceptors.OutcomeInterceptor.interceptOutcome(OutcomeInterceptor.java:21)
| at sun.reflect.GeneratedMethodAccessor105.invoke(Unknown Source)
| 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:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.interceptors.RollbackInterceptor.rollbackIfNecessary(RollbackInterceptor.java:29)
| at sun.reflect.GeneratedMethodAccessor104.invoke(Unknown Source)
| 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:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:52)
| at sun.reflect.GeneratedMethodAccessor103.invoke(Unknown Source)
| 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:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.interceptors.TransactionInterceptor$1.work(TransactionInterceptor.java:28)
| at org.jboss.seam.util.Work.workInTransaction(Work.java:37)
| at org.jboss.seam.interceptors.TransactionInterceptor.doInTransactionIfNecessary(TransactionInterceptor.java:23)
| at sun.reflect.GeneratedMethodAccessor102.invoke(Unknown Source)
| 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:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
| at sun.reflect.GeneratedMethodAccessor101.invoke(Unknown Source)
| 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:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.interceptors.ExceptionInterceptor.handleExceptions(ExceptionInterceptor.java:39)
| at sun.reflect.GeneratedMethodAccessor100.invoke(Unknown Source)
| 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:18)
| at org.jboss.seam.intercept.Interceptor.aroundInvoke(Interceptor.java:169)
| at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:64)
| at org.jboss.seam.intercept.RootInterceptor.createSeamInvocationContext(RootInterceptor.java:144)
| at org.jboss.seam.intercept.RootInterceptor.invokeInContexts(RootInterceptor.java:129)
| at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:102)
| at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:145)
| at org.jboss.seam.intercept.JavaBeanInterceptor.intercept(JavaBeanInterceptor.java:80)
| at com.sphere.consultoria.entity.GenCidadeList$$EnhancerByCGLIB$$6ff1f45a.getResultList(<generated>)
| ... 44 more
| Caused by: org.hibernate.exception.GenericJDBCException: could not execute query
| at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
| at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
| at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
| at org.hibernate.loader.Loader.doList(Loader.java:2147)
| at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2028)
| at org.hibernate.loader.Loader.list(Loader.java:2023)
| at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:393)
| at org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
| at org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
| at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
| at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
| at org.hibernate.ejb.QueryImpl.getResultList(QueryImpl.java:64)
| ... 99 more
| Caused by: org.jboss.util.NestedSQLException: Error; - nested throwable: (java.lang.ArrayIndexOutOfBoundsException: -1)
| at org.jboss.resource.adapter.jdbc.WrappedConnection.checkException(WrappedConnection.java:557)
| at org.jboss.resource.adapter.jdbc.WrappedStatement.checkException(WrappedStatement.java:563)
| at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:241)
| at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:186)
| at org.hibernate.loader.Loader.getResultSet(Loader.java:1668)
| at org.hibernate.loader.Loader.doQuery(Loader.java:662)
| at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:224)
| at org.hibernate.loader.Loader.doList(Loader.java:2144)
| ... 107 more
| Caused by: java.lang.ArrayIndexOutOfBoundsException: -1
| at java.util.Vector.elementAt(Vector.java:435)
| at net.avenir.jdbc2.a.h(UnicodeCommunication.java)
| at net.avenir.jdbc2.a.a(UnicodeCommunication.java)
| at net.avenir.jdbc2.l.b(ParentStatement.java)
| at net.avenir.jdbc2.l.executeQuery(ParentStatement.java)
| at org.jboss.resource.adapter.jdbc.WrappedPreparedStatement.executeQuery(WrappedPreparedStatement.java:236)
| ... 112 more
|
This is the code:
@Name("genCidadeList")
| public class GenCidadeList extends EntityQuery {
|
| private static final String[] RESTRICTIONS = {
| "lower(genCidade.codCidade) like concat(lower(#{genCidadeList.genCidade.codCidade}),'%')",
| "lower(genCidade.descrCidade) like concat(lower(#{genCidadeList.genCidade.descrCidade}),'%')",
| "lower(genCidade.sigla) like concat(lower(#{genCidadeList.genCidade.sigla}),'%')",};
|
| private GenCidade genCidade = new GenCidade();
|
| @Override
| public String getEjbql() {
| return "select genCidade from GenCidade genCidade";
| }
|
| @Override
| public Integer getMaxResults() {
| return 25;
| }
|
| public GenCidade getGenCidade() {
| return genCidade;
| }
|
| @Override
| public List<String> getRestrictions() {
| return Arrays.asList(RESTRICTIONS);
| }
|
| }
|
and the portion of the list page that raises the error:
<h:outputText value="No genCidade exists"
| rendered="#{empty genCidadeList.resultList}"/>
|
Thanks for any help. ;-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4007868#4007868
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4007868
19 years, 2 months
[JBoss Seam] - Re: iText (PDF) support in Seam
by venkateshbr
hi norman,
had a look at the digital signature stuff in CVS. most of the basic features are covered. one thing i noticed is getting a keystore from external context.getResourceAsStream. This is good enough for certificates lying in the keystore and keystore itself present under externalcontext path.
The improvements around this could be to accept the private key as input. The private key can be obtained from browser keystore using an applet and passed to UISignature. So that the document would be signed by a real certificate lying on the browser.
i am not sure about the feasibility of this.. just a thought for improvement
i can think of one possible use case. A user input page for the user to enter some text which will be converted to pdf and will be signed by his certificate lying in the browser keystore.
thanks.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4007861#4007861
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4007861
19 years, 2 months