On Jan 15, 2008, at 1:14 AM, wesley wrote:
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.
Caused by: java.lang.NoSuchMethodError:
com.mycompany.builders.ArticleListBuilder: method <init>()V not found
Can you try adding a protected or public zero-arg constructor for
ArticleListBuilder?
public class ArticleListBuilder {
protected ArticleListBuilder()
{
}
...
}
The scoped values are interesting in webbeans, and in some cases
require a generated proxy object, which then requires a protected or
public zero-arg constructor.
If you inject a @RequestScoped bean into an @ApplicationScoped
value, Resin gives you a proxy to the underlying bean. When your
code accesses the request-scoped bean, the proxy will lookup the
actual bean in the current request and invoke the proper methods on
the actual bean.
-- Scott
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