Further test: When applied @Component & @SessionScoped to action class, no matter what scope was applied to those classes need to be injected, every component turned into session scoped.
code: ============================================= package com.mycompany.actions; @SessionScoped @Component public class ListArticleAction extends ActionSupport { ArticleListBuilder articleListbuilder; public ListArticleAction(@In ArticleListBuilder articleListbuilder) { this.articleListbuilder = articleListbuilder; } public String execute() { System.out.println(this); System.out.println(articleListbuilder); ... } } ============================================= package com.mycompany.blocks; @Component @RequestScoped public class ArticleListBuilder { ... } ============================================= output: [EMAIL PROTECTED] [EMAIL PROTECTED] // should be request scoped, but seems to be session scoped [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] ----- Original Message ----- From: wesley To: General Discussion for the Resin application server Sent: Tuesday, January 15, 2008 5:14 PM Subject: Re: [Resin-interest] ResinObjectFactory does not support scope The object is a normal bean, not an struts2 action. BTW, a struts2 action might not be a singleton according to XWork/Struts2 code, but a normal bean created every time when requested. These were the stacktrace: 2008-01-15 16:54:40,718 4970 ERROR [http--8080-4] ResinObjectFactory (51) - com.caucho.config.ConfigException: com.mycompany.actions.ListArticleAction.articleListbuilder: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.caucho.webbeans.inject.ComponentInject.inject(ComponentInject.java:69) at com.caucho.webbeans.component.ComponentImpl.init(ComponentImpl.java:461) at com.caucho.webbeans.component.ComponentImpl.create(ComponentImpl.java:413) at com.caucho.webbeans.component.ComponentImpl.get(ComponentImpl.java:365) at com.caucho.xwork2.ResinObjectFactory.buildBean(ResinObjectFactory.java:49) // return component.get(); at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:154) at com.opensymphony.xwork2.ObjectFactory.buildBean(ObjectFactory.java:143) at com.opensymphony.xwork2.ObjectFactory.buildAction(ObjectFactory.java:113) at com.opensymphony.xwork2.DefaultActionInvocation.createAction(DefaultActionInvocation.java:275) at com.opensymphony.xwork2.DefaultActionInvocation.init(DefaultActionInvocation.java:365) at com.opensymphony.xwork2.DefaultActionInvocation.access$000(DefaultActionInvocation.java:38) at com.opensymphony.xwork2.DefaultActionInvocation$1.doProfiling(DefaultActionInvocation.java:83) at com.opensymphony.xwork2.util.profiling.UtilTimerStack.profile(UtilTimerStack.java:455) at com.opensymphony.xwork2.DefaultActionInvocation.<init>(DefaultActionInvocation.java:74) at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:189) at org.apache.struts2.impl.StrutsActionProxyFactory.createActionProxy(StrutsActionProxyFactory.java:41) at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:494) at org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:419) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87) at com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119) at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87) at org.apache.struts2.dispatcher.ActionContextCleanUp.doFilter(ActionContextCleanUp.java:99) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87) at com.yaqu.servlet.filter.gzip.GZIPFilter.doFilter(GZIPFilter.java:36) at com.caucho.server.dispatch.FilterFilterChain.doFilter(FilterFilterChain.java:87) at com.caucho.server.webapp.WebAppFilterChain.doFilter(WebAppFilterChain.java:181) at com.caucho.server.dispatch.ServletInvocation.service(ServletInvocation.java:266) at com.caucho.server.http.HttpRequest.handleRequest(HttpRequest.java:268) at com.caucho.server.port.TcpConnection.run(TcpConnection.java:603) at com.caucho.util.ThreadPool$Item.runTasks(ThreadPool.java:721) at com.caucho.util.ThreadPool$Item.run(ThreadPool.java:643) at java.lang.Thread.run(Thread.java:619) Caused by: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException at com.caucho.webbeans.bytecode.ScopeAdapter.wrap(ScopeAdapter.java:73) at com.caucho.webbeans.component.ClassComponent.get(ClassComponent.java:267) at com.caucho.webbeans.inject.ComponentInject.inject(ComponentInject.java:63) ... 32 more Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27) at java.lang.reflect.Constructor.newInstance(Constructor.java:513) at com.caucho.webbeans.bytecode.ScopeAdapter.wrap(ScopeAdapter.java:68) ... 34 more Caused by: java.lang.NoSuchMethodError: com.mycompany.builders.ArticleListBuilder: method <init>()V not found at com.mycompany.builders.ArticleListBuilder$ScopeProxy.<init>(Unknown Source) ... 39 more [16:54:40.720] {http--8080-4} com.mycompany.actions.ListArticleAction.articleListbuilder: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException My source code: ============================================= package com.mycompany.actions; // no @Component public class ListArticleAction extends ActionSupport { @In ArticleListBuilder articleListbuilder; public String execute() { ... } } ============================================= package com.mycompany.builders; @Component @SessionScoped public class ArticleListBuilder { ... } ============================================= And then I change the inject method to constructor inject: ============================================= package com.mycompany.actions; // no @Component public class ListArticleAction extends ActionSupport { ArticleListBuilder articleListbuilder; public ListArticleAction(@In ArticleListBuilder articleListbuilder) { this.articleListbuilder = articleListbuilder; System.out.println(this); System.out.println(articleListbuilder); } public String execute() { ... } } ============================================= No exception occurred, but every time I refresh the web page, system output was like below [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] the @SessionScope does not applied. ----- Original Message ----- From: Scott Ferguson To: General Discussion for the Resin application server Sent: Tuesday, January 15, 2008 5:47 AM Subject: Re: [Resin-interest] ResinObjectFactory does not support scope On Jan 13, 2008, at 8:47 AM, wesley wrote: When annotated class with @Component combined with @SessionScoped (or @ConversationScoped/@ApplicationScoped), ResinObjectFactory throws java.lang.RuntimeException: java.lang.reflect.InvocationTargetException I'm using s080111 snapshot. I've filed this as http://bugs.caucho.com/view.php?id=2332 Is the object a normal bean or is it something like a struts2 action? If it's a struts action, then it really shouldn't have a @SessionScope (?), since it's a singleton. Also, do you have a full stack trace? thanks, (BTW, we've added a wiki page for the struts2 integration at http://wiki.caucho.com/Struts2) -- Scott _______________________________________________ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ---------------------------------------------------------------------------- _______________________________________________ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest ------------------------------------------------------------------------------ _______________________________________________ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest
_______________________________________________ resin-interest mailing list resin-interest@caucho.com http://maillist.caucho.com/mailman/listinfo/resin-interest