[JBoss Seam] - Injection of FacesContext fails
by tazly
I'm trying to inject the FacesContext because I need to log the user's IP address. Why doesn't the injection work?
package tazly.rogr.actions;
|
| import static org.jboss.seam.ScopeType.EVENT;
| import org.jboss.seam.annotations.In;
| import org.jboss.seam.annotations.Logger;
| import org.jboss.seam.annotations.Name;
| import org.jboss.seam.annotations.Scope;
| import org.jboss.seam.core.FacesContext;
| import org.jboss.seam.log.Log;
| import tazly.rogr.Provins;
| import tazly.rogr.Test;
|
| import javax.ejb.Stateless;
| import javax.naming.InitialContext;
| import javax.persistence.EntityManager;
| import javax.persistence.PersistenceContext;
| import javax.persistence.Query;
| import javax.transaction.UserTransaction;
| import java.util.List;
|
| @Stateless
| @Name("login")
| public class LoginAction implements Login {
|
| @In
| private FacesContext facesContext;
|
| @PersistenceContext
| private EntityManager em;
|
| @Logger
| private Log log;
|
| public String login() {
| System.out.println("Login ");
|
| ...
00:37:20,005 INFO [Component] Component: login, scope: STATELESS, type: STATELESS_SESSION_BEAN, class: tazly.rogr.actions.LoginAction, JNDI: rigeApp/LoginAction/local
| 00:37:20,033 WARN [Component] Component class should be serializable: bruger
| 00:37:20,033 INFO [Component] Component: bruger, scope: SESSION, type: ENTITY_BEAN, class: tazly.rogr.Bruger
| 00:37:20,034 WARN [Component] Component class should be serializable: provins
| 00:37:20,034 INFO [Component] Component: provins, scope: SESSION, type: ENTITY_BEAN, class: tazly.rogr.Provins
| 00:37:20,037 INFO [Component] Component: register, scope: STATELESS, type: STATELESS_SESSION_BEAN, class: tazly.rogr.actions.OpretBrugerAction, JNDI: rigeApp/OpretBrugerAction/local
| 00:37:20,044 INFO [Initialization] done initializing Seam
| 00:37:20,045 INFO [FacesConfigurator] Reading standard config org/apache/myfaces/resource/standard-faces-config.xml
| 00:37:20,085 INFO [FacesConfigurator] Reading config jar:file:/data/server/jboss-4.0.4_ejb3RC8.GA/server/default/tmp/deploy/tmp12356rigeApp.ear-contents/jboss-seam.jar!/META-INF/faces-config.xml
| 00:37:20,093 INFO [FacesConfigurator] Reading config jar:file:/data/server/jboss-4.0.4_ejb3RC8.GA/server/default/tmp/deploy/tmp12356rigeApp.ear-contents/rigeWeb-exp.war/WEB-INF/lib/jboss-seam-ui.jar!/META-INF/faces-config.xml
| 00:37:20,197 INFO [FacesConfigurator] Reading config /WEB-INF/faces-config.xml
| 00:37:20,217 ERROR [LocaleUtils] Locale name null or empty, ignoring
| 00:37:20,341 INFO [StartupServletContextListener] ServletContext '/data/server/jboss-4.0.4_ejb3RC8.GA/server/default/./tmp/deploy/tmp12356rigeApp.ear-contents/rigeWeb-exp.war/' initialized.
| 00:37:20,409 INFO [EARDeployer] Started J2EE application: file:/home/tazly/rige/deploy/rigeApp.ear
| [2006-10-11 12:37:20,438] Module rigeApp: Module is deployed successfully.
| 00:37:28,369 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
| javax.faces.FacesException: Error calling action method of component with id _id0:_id4
| at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:74)
| at javax.faces.component.UICommand.broadcast(UICommand.java:106)
| at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:90)
| at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:164)
| at org.apache.myfaces.lifecycle.LifecycleImpl.invokeApplication(LifecycleImpl.java:316)
| at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:86)
| at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| 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.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.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: Exception while invoking expression #{login.login}
| at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:153)
| at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:63)
| ... 24 more
| Caused by: javax.ejb.EJBException: java.lang.IllegalArgumentException: could not set field value: login.facesContext
| at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:69)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:83)
| at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:197)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:76)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:78)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:181)
| at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:79)
| at $Proxy212.login(Unknown Source)
| 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.MethodBindingImpl.invoke(MethodBindingImpl.java:129)
| ... 25 more
| Caused by: java.lang.IllegalArgumentException: could not set field value: login.facesContext
| at org.jboss.seam.Component.setFieldValue(Component.java:1214)
| at org.jboss.seam.Component.injectFields(Component.java:1024)
| at org.jboss.seam.Component.inject(Component.java:795)
| at org.jboss.seam.interceptors.BijectionInterceptor.bijectTargetComponent(BijectionInterceptor.java:30)
| 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.seam.util.Reflections.invoke(Reflections.java:13)
| at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
| at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
| at org.jboss.seam.interceptors.ConversationInterceptor.endOrBeginLongRunningConversation(ConversationInterceptor.java:82)
| 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.seam.util.Reflections.invoke(Reflections.java:13)
| at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
| at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
| at org.jboss.seam.interceptors.BusinessProcessInterceptor.manageBusinessProcessContext(BusinessProcessInterceptor.java:60)
| 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.seam.util.Reflections.invoke(Reflections.java:13)
| at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
| at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
| at org.jboss.seam.interceptors.RemoveInterceptor.removeIfNecessary(RemoveInterceptor.java:39)
| 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.seam.util.Reflections.invoke(Reflections.java:13)
| at org.jboss.seam.interceptors.Interceptor.aroundInvoke(Interceptor.java:90)
| at org.jboss.seam.interceptors.SeamInvocationContext.proceed(SeamInvocationContext.java:60)
| at org.jboss.seam.ejb.SeamInterceptor.aroundInvokeInContexts(SeamInterceptor.java:73)
| at org.jboss.seam.ejb.SeamInterceptor.aroundInvoke(SeamInterceptor.java:45)
| 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.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
| at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
| at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
| at org.jboss.aspects.tx.TxPolicy.invokeInOurTx(TxPolicy.java:79)
| ... 45 more
| Caused by: java.lang.IllegalArgumentException
| at sun.reflect.UnsafeObjectFieldAccessorImpl.set(UnsafeObjectFieldAccessorImpl.java:63)
| at java.lang.reflect.Field.set(Field.java:656)
| at org.jboss.seam.Component.setFieldValue(Component.java:1210)
| ... 93 more
|
|
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977385#3977385
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977385
19 years, 7 months
[Installation, Configuration & Deployment] - Getting error when migrating to JBoss-4.0.3 from JBoss.3.2.4
by subramaniam.venkat
Hello,
I have to migrate from the older version of Jboss-3.2.4 to the JBoss-4.0.3
But i am facing some extreme difficulties,
I am getting the Error message will JBoss is trying to deploy one of the ejb-jar files.
23:20:32,680 WARN [EJBDeployer] Verify failed; continuing
java.lang.NoClassDefFoundError: com/citi/commons/SubscriptionId
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:1647)
at java.lang.Class.privateGetPublicMethods(Class.java:1770)
at java.lang.Class.getMethods(Class.java:824)
at org.jboss.verifier.strategy.AbstractVerifier.hasEJBCreateMethod(AbstractVerifier.java:664)
at org.jboss.verifier.strategy.EJBVerifier20.verifySessionBean(EJBVerifier20.java:834)
at org.jboss.verifier.strategy.EJBVerifier20.checkSession(EJBVerifier20.java:64)
at org.jboss.verifier.BeanVerifier.verify(BeanVerifier.java:166)
at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:559)
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:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
But when i deploy in older version i am not getting error.
I just downloaded the Jboss-4.0.3 and then placed my ear file in the default 's deploy directory.
I have not changed any settings.
Can someone please him the matter is of very urgent importants.
Thanks in advance,
Subramaniam V
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977383#3977383
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977383
19 years, 7 months
[Beginners Corner] - Re: Migration from JBoss-3.2.4 to Jboss-4.0.3
by subramaniam.venkat
Thanks alot for your response.
I have one more question for use.
did you move the ear-deployer and ejb-deployer.xml to the conf directory or you removed them completely.
I am also getting one more error
when i am deploying
23:40:38,423 WARN [EJBDeployer] Verify failed; continuing
java.lang.NoClassDefFoundError: com/citi/commons/SubscriptionId
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:1647)
at java.lang.Class.privateGetPublicMethods(Class.java:1770)
at java.lang.Class.getMethods(Class.java:824)
at org.jboss.verifier.strategy.AbstractVerifier.hasEJBCreateMethod(AbstractVerifier.java:664)
at org.jboss.verifier.strategy.EJBVerifier20.verifySessionBean(EJBVerifier20.java:834)
at org.jboss.verifier.strategy.EJBVerifier20.checkSession(EJBVerifier20.java:64)
at org.jboss.verifier.BeanVerifier.verify(BeanVerifier.java:166)
at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:559)
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:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
Please can if you can tell me why i am getting this error.
Thanks in advance
Subramaniam V
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977382#3977382
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977382
19 years, 7 months
[JBossCache] - Re: Urgent- Socket error when adding object to DB using JDBC
by manik.surtani@jboss.com
Ah, here's a reason why - are you running your test within a transaction?
Non-tx-related calls call cf.close(), which results in:
| public void close(Connection con)
| {
| if(con != null && con != connection.get())
| {
| try
| {
| con.close();
| if(log.isTraceEnabled())
| {
| //log.trace("closed non tx connection: " + con);
| }
| }
| catch(SQLException e)
| {
| log.warn("Failed to close connection: " + e.getMessage());
| }
| }
| }
|
|
So the connection is only closed if it is NOT the one in ThreadLocal, otherwise it is kept open.
If you set the connection in ThreadLocal (and even in getConnection() for that matter, rather than prepare()) these connections will not get closed and you have some sort of a connection pool going, based on the number of processor threads. I presume this could exhaust your DB backend if these are high.
Could you confirm whether you're using txs in your test?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977381#3977381
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977381
19 years, 7 months
[Beginners Corner] - Getting Error while trying to migrate to JBoss-4.0.3 from Jb
by subramaniam.venkat
Hello,
I have to migrate from the older version of Jboss-3.2.4 to the JBoss-4.0.3
But i am facing some extreme difficulties,
I am getting the Error message will JBoss is trying to deploy one of the ejb-jar files.
23:20:32,680 WARN [EJBDeployer] Verify failed; continuing
java.lang.NoClassDefFoundError: com/citi/commons/SubscriptionId
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:1647)
at java.lang.Class.privateGetPublicMethods(Class.java:1770)
at java.lang.Class.getMethods(Class.java:824)
at org.jboss.verifier.strategy.AbstractVerifier.hasEJBCreateMethod(AbstractVerifier.java:664)
at org.jboss.verifier.strategy.EJBVerifier20.verifySessionBean(EJBVerifier20.java:834)
at org.jboss.verifier.strategy.EJBVerifier20.checkSession(EJBVerifier20.java:64)
at org.jboss.verifier.BeanVerifier.verify(BeanVerifier.java:166)
at org.jboss.ejb.EJBDeployer.create(EJBDeployer.java:559)
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:324)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:141)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:80)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:118)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:127)
at org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:80)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:74)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:245)
But when i deploy in older version i am not getting error.
I just downloaded the Jboss-4.0.3 and then placed my ear file in the default 's deploy directory.
I have not changed any settings.
Can someone please him the matter is of very urgent importants.
Thanks in advance,
Subramaniam V
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3977378#3977378
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3977378
19 years, 7 months