|
From: Fábio S. <fab...@ya...> - 2008-08-08 14:12:34
|
Hi,
We have a problem integrating RestEasy and Spring. It seems like when two users access the same resource at the same time, the SpringContextLoaderListener is not injecting after the first instance.
After that all the resource instances aren't injected by Spring causing NullPointerException at the spring injected objects.
My web.xml is the same as the examples of this integration.
Here is my resource class:
@Service("locating")
@Path("/")
public class LocatingResource {
public LocatingResource() {
System.out.println("Instanciando....");
}
@GET
@Path("locating")
public String getLocating() {
System.out.println("Class: "+ this);
System.out.println("LOCATING...("+getSpringTest()+")");
return getSeci().toString();
}
@Resource
private Seci seci;
public void setSeci( Seci seci ) {
System.out.println("Classe1: " +this);
System.out.println("SACI2: "+ seci);
this.seci = seci;
}
public Seci getSeci() {
return this.seci;
}
}
My ApplicationContext.xml :
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
default-autowire="byName"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd"
>
<context:annotation-config/>
<context:spring-configured/>
<context:component-scan base-package="padauan" annotation-config="true"/>
</bean>
Thanks,
Fabio Serra
Novos endereços, o Yahoo! que você conhece. Crie um email novo com a sua cara @ymail.com ou @rocketmail.com.
http://br.new.mail.yahoo.com/addresses |
|
From: Bill B. <bb...@re...> - 2008-08-08 15:16:55
|
So you want a instance per request model?
I'm not that familiar with spring and the RestEasy code expects a
singleton model.
I'll try out your code and see if I can figure things out.
Fábio Serra wrote:
> Hi,
>
> We have a problem integrating RestEasy and Spring. It seems like when
> two users access the same resource at the same time, the
> SpringContextLoaderListener is not injecting after the first instance.
> After that all the resource instances aren't injected by Spring causing
> NullPointerException at the spring injected objects.
>
> My web.xml is the same as the examples of this integration.
>
> Here is my resource class:
> @Service("locating")
> @Path("/")
> public class LocatingResource {
> public LocatingResource() {
> System.out.println("Instanciando....");
> }
>
> @GET
> @Path("locating")
> public String getLocating() {
> System.out.println("Class: "+ this);
> System.out.println("LOCATING...("+getSpringTest()+")");
> return getSeci().toString();
> }
>
> @Resource
> private Seci seci;
> public void setSeci( Seci seci ) {
> System.out.println("Classe1: " +this);
> System.out.println("SACI2: "+ seci);
> this.seci = seci;
> }
> public Seci getSeci() {
> return this.seci;
> }
> }
>
> My ApplicationContext.xml :
> <beans xmlns="http://www.springframework.org/schema/beans"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xmlns:context="http://www.springframework.org/schema/context"
> default-autowire="byName"
> xsi:schemaLocation="http://www.springframework.org/schema/beans
>
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> http://www.springframework.org/schema/context
>
> http://www.springframework.org/schema/context/spring-context-2.5.xsd"
>
> >
> <context:annotation-config/>
> <context:spring-configured/>
> <context:component-scan base-package="padauan"
> annotation-config="true"/>
> </bean>
>
>
> Thanks,
>
> Fabio Serra
>
> ------------------------------------------------------------------------
> Novos endereços, o Yahoo! que você conhece. Crie um email novo
> <http://br.rd.yahoo.com/mail/taglines/mail/*http://br.new.mail.yahoo.com/addresses>
> com a sua cara @ymail.com ou @rocketmail.com.
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Paulo S. <pau...@gm...> - 2008-08-08 18:20:38
|
Sorry, I forgot to check the mailing list address in the CC...
---------- Forwarded message ----------
From: Paulo Siqueira <pau...@gm...>
Date: Fri, Aug 8, 2008 at 3:12 PM
Subject: Re: [Resteasy-developers] Problem with Spring and RestEasy
integration
To: Bill Burke <bb...@re...>
Hi Bill,
We don't want an instance per request. It doesn't matter at moment actually.
The problem is that it isn't working even with everything singleton (which
is the default scope in singleton). Do we have to do anything special to
flag the RESTful beans as singleton?
The main problem is the a dependency of the RESTful bean is not being
injected sometimes, although the bean itself is always there, thus giving us
NullPointers. In the example Fabio sent it would be the field "Seci" that
would end up being null.
[]s,
On Fri, Aug 8, 2008 at 12:16 PM, Bill Burke <bb...@re...> wrote:
> So you want a instance per request model?
>
> I'm not that familiar with spring and the RestEasy code expects a
> singleton model.
>
> I'll try out your code and see if I can figure things out.
>
> Fábio Serra wrote:
> > Hi,
> >
> > We have a problem integrating RestEasy and Spring. It seems like when
> > two users access the same resource at the same time, the
> > SpringContextLoaderListener is not injecting after the first instance.
> > After that all the resource instances aren't injected by Spring causing
> > NullPointerException at the spring injected objects.
> >
> > My web.xml is the same as the examples of this integration.
> >
> > Here is my resource class:
> > @Service("locating")
> > @Path("/")
> > public class LocatingResource {
> > public LocatingResource() {
> > System.out.println("Instanciando....");
> > }
> >
> > @GET
> > @Path("locating")
> > public String getLocating() {
> > System.out.println("Class: "+ this);
> > System.out.println("LOCATING...("+getSpringTest()+")");
> > return getSeci().toString();
> > }
> >
> > @Resource
> > private Seci seci;
> > public void setSeci( Seci seci ) {
> > System.out.println("Classe1: " +this);
> > System.out.println("SACI2: "+ seci);
> > this.seci = seci;
> > }
> > public Seci getSeci() {
> > return this.seci;
> > }
> > }
> >
> > My ApplicationContext.xml :
> > <beans xmlns="http://www.springframework.org/schema/beans"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:context="http://www.springframework.org/schema/context"
> > default-autowire="byName"
> > xsi:schemaLocation="http://www.springframework.org/schema/beans
> >
> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> >
> http://www.springframework.org/schema/context
> >
> > http://www.springframework.org/schema/context/spring-context-2.5.xsd"
> >
> > >
> > <context:annotation-config/>
> > <context:spring-configured/>
> > <context:component-scan base-package="padauan"
> > annotation-config="true"/>
> > </bean>
> >
> >
> > Thanks,
> >
> > Fabio Serra
> >
> > ------------------------------------------------------------------------
> > Novos endereços, o Yahoo! que você conhece. Crie um email novo
> > <
> http://br.rd.yahoo.com/mail/taglines/mail/*http://br.new.mail.yahoo.com/addresses
> >
> > com a sua cara @ymail.com ou @rocketmail.com.
> >
> >
> > ------------------------------------------------------------------------
> >
> > -------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> > Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> > Grand prize is a trip for two to an Open Source event anywhere in the
> world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> >
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Resteasy-developers mailing list
> > Res...@li...
> > https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
--
Paulo R C Siqueira
SCJP / SCWCD
http://www.ipti.org.br
Contato: (11) 8149-5046
--
Paulo R C Siqueira
SCJP / SCWCD
http://www.ipti.org.br
Contato: (11) 8149-5046
|
|
From: Bill B. <bb...@re...> - 2008-08-08 22:20:45
|
I cannot reproduce this problem. Do you have resteasy's scanning turned
on? That would screw things up.
(I sent you the code I tested with. If you didn't get it ping me
privately).
Paulo Siqueira wrote:
> Sorry, I forgot to check the mailing list address in the CC...
>
> ---------- Forwarded message ----------
> From: *Paulo Siqueira* <pau...@gm...
> <mailto:pau...@gm...>>
> Date: Fri, Aug 8, 2008 at 3:12 PM
> Subject: Re: [Resteasy-developers] Problem with Spring and RestEasy
> integration
> To: Bill Burke <bb...@re... <mailto:bb...@re...>>
>
>
> Hi Bill,
>
> We don't want an instance per request. It doesn't matter at moment
> actually. The problem is that it isn't working even with everything
> singleton (which is the default scope in singleton). Do we have to do
> anything special to flag the RESTful beans as singleton?
>
> The main problem is the a dependency of the RESTful bean is not being
> injected sometimes, although the bean itself is always there, thus
> giving us NullPointers. In the example Fabio sent it would be the field
> "Seci" that would end up being null.
>
> []s,
>
>
> On Fri, Aug 8, 2008 at 12:16 PM, Bill Burke <bb...@re...
> <mailto:bb...@re...>> wrote:
>
> So you want a instance per request model?
>
> I'm not that familiar with spring and the RestEasy code expects a
> singleton model.
>
> I'll try out your code and see if I can figure things out.
>
> Fábio Serra wrote:
> > Hi,
> >
> > We have a problem integrating RestEasy and Spring. It seems like when
> > two users access the same resource at the same time, the
> > SpringContextLoaderListener is not injecting after the first
> instance.
> > After that all the resource instances aren't injected by Spring
> causing
> > NullPointerException at the spring injected objects.
> >
> > My web.xml is the same as the examples of this integration.
> >
> > Here is my resource class:
> > @Service("locating")
> > @Path("/")
> > public class LocatingResource {
> > public LocatingResource() {
> > System.out.println("Instanciando....");
> > }
> >
> > @GET
> > @Path("locating")
> > public String getLocating() {
> > System.out.println("Class: "+ this);
> > System.out.println("LOCATING...("+getSpringTest()+")");
> > return getSeci().toString();
> > }
> >
> > @Resource
> > private Seci seci;
> > public void setSeci( Seci seci ) {
> > System.out.println("Classe1: " +this);
> > System.out.println("SACI2: "+ seci);
> > this.seci = seci;
> > }
> > public Seci getSeci() {
> > return this.seci;
> > }
> > }
> >
> > My ApplicationContext.xml :
> > <beans xmlns="http://www.springframework.org/schema/beans"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:context="http://www.springframework.org/schema/context"
> > default-autowire="byName"
> > xsi:schemaLocation="http://www.springframework.org/schema/beans
> >
> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> >
> http://www.springframework.org/schema/context
> >
> > http://www.springframework.org/schema/context/spring-context-2.5.xsd"
> >
> > >
> > <context:annotation-config/>
> > <context:spring-configured/>
> > <context:component-scan base-package="padauan"
> > annotation-config="true"/>
> > </bean>
> >
> >
> > Thanks,
> >
> > Fabio Serra
> >
> >
> ------------------------------------------------------------------------
> > Novos endereços, o Yahoo! que você conhece. Crie um email novo
> >
> <http://br.rd.yahoo.com/mail/taglines/mail/*http://br.new.mail.yahoo.com/addresses>
> > com a sua cara @ymail.com <http://ymail.com> ou @rocketmail.com
> <http://rocketmail.com>.
> >
> >
> >
> ------------------------------------------------------------------------
> >
> >
> -------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> > Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> > Grand prize is a trip for two to an Open Source event anywhere in
> the world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
> >
> >
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Resteasy-developers mailing list
> > Res...@li...
> <mailto:Res...@li...>
> > https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> <mailto:Res...@li...>
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Paulo S. <pau...@gm...> - 2008-08-11 14:03:20
|
I'm having trouble making the problem easy to reproduce... it happens
sometimes, but not always.
One thing I noted that is different in your tests from ours is that you
don't have a method answering a URL directly (without sub-resources) and
using a spring injected bean, which is our case. I changed our local test to
use a sub-resource and the problem seemed to vanished, although I cannot be
100% sure yet.
I could not make your environment run here, but I'll write down what I think
could be a test case for my scenario, that could be inserted in the
SmokeTest.
This is the new block test:
GetMethod method = new GetMethod("
http://localhost:8080/spring-integration-test/direct/direct-call");
int status = client.executeMethod(method);
Assert.assertEquals(HttpResponseCodes.SC_OK, status);
Assert.assertEquals("DIRECT OK", method.getResponseBodyAsString());
method.releaseConnection();
To implement this, we could use the following bean:
@Path("/direct")
@Service("direct")
public class DirectBean {
@GET
@Path("direct-call")
public String directCall() {
return directSpring.getDirectResult();
}
@Resource(name="directSpring")
private DirectSpring directSpring;
}
and the spring bean:
@Service("directSpring")
public class DirectSpring {
public String getDirectResult() {
return "DIRECT OK";
}
}
does this make sense? Does it make the problem easier to understand?
PS.: If this really reproduces our problem, you may have to run the test
some times before the error appears, since it works sometimes.
[]s,
On Fri, Aug 8, 2008 at 7:20 PM, Bill Burke <bb...@re...> wrote:
> I cannot reproduce this problem. Do you have resteasy's scanning turned
> on? That would screw things up.
>
> (I sent you the code I tested with. If you didn't get it ping me
> privately).
>
> Paulo Siqueira wrote:
>
>> Sorry, I forgot to check the mailing list address in the CC...
>>
>> ---------- Forwarded message ----------
>> From: *Paulo Siqueira* <pau...@gm... <mailto:
>> pau...@gm...>>
>> Date: Fri, Aug 8, 2008 at 3:12 PM
>> Subject: Re: [Resteasy-developers] Problem with Spring and RestEasy
>> integration
>> To: Bill Burke <bb...@re... <mailto:bb...@re...>>
>>
>>
>> Hi Bill,
>>
>> We don't want an instance per request. It doesn't matter at moment
>> actually. The problem is that it isn't working even with everything
>> singleton (which is the default scope in singleton). Do we have to do
>> anything special to flag the RESTful beans as singleton?
>>
>> The main problem is the a dependency of the RESTful bean is not being
>> injected sometimes, although the bean itself is always there, thus giving us
>> NullPointers. In the example Fabio sent it would be the field "Seci" that
>> would end up being null.
>>
>> []s,
>>
>>
>> On Fri, Aug 8, 2008 at 12:16 PM, Bill Burke <bb...@re... <mailto:
>> bb...@re...>> wrote:
>>
>> So you want a instance per request model?
>>
>> I'm not that familiar with spring and the RestEasy code expects a
>> singleton model.
>>
>> I'll try out your code and see if I can figure things out.
>>
>> Fábio Serra wrote:
>> > Hi,
>> >
>> > We have a problem integrating RestEasy and Spring. It seems like
>> when
>> > two users access the same resource at the same time, the
>> > SpringContextLoaderListener is not injecting after the first
>> instance.
>> > After that all the resource instances aren't injected by Spring
>> causing
>> > NullPointerException at the spring injected objects.
>> >
>> > My web.xml is the same as the examples of this integration.
>> >
>> > Here is my resource class:
>> > @Service("locating")
>> > @Path("/")
>> > public class LocatingResource {
>> > public LocatingResource() {
>> > System.out.println("Instanciando....");
>> > }
>> >
>> > @GET
>> > @Path("locating")
>> > public String getLocating() {
>> > System.out.println("Class: "+ this);
>> > System.out.println("LOCATING...("+getSpringTest()+")");
>> > return getSeci().toString();
>> > }
>> >
>> > @Resource
>> > private Seci seci;
>> > public void setSeci( Seci seci ) {
>> > System.out.println("Classe1: " +this);
>> > System.out.println("SACI2: "+ seci);
>> > this.seci = seci;
>> > }
>> > public Seci getSeci() {
>> > return this.seci;
>> > }
>> > }
>> >
>> > My ApplicationContext.xml :
>> > <beans xmlns="http://www.springframework.org/schema/beans"
>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>> > xmlns:context="
>> http://www.springframework.org/schema/context"
>> > default-autowire="byName"
>> > xsi:schemaLocation="http://www.springframework.org/schema/beans
>> >
>> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>> >
>> http://www.springframework.org/schema/context
>> >
>> >
>> http://www.springframework.org/schema/context/spring-context-2.5.xsd"
>> >
>> > >
>> > <context:annotation-config/>
>> > <context:spring-configured/>
>> > <context:component-scan base-package="padauan"
>> > annotation-config="true"/>
>> > </bean>
>> >
>> >
>> > Thanks,
>> >
>> > Fabio Serra
>> >
>> >
>>
>> ------------------------------------------------------------------------
>> > Novos endereços, o Yahoo! que você conhece. Crie um email novo
>> >
>> <
>> http://br.rd.yahoo.com/mail/taglines/mail/*http://br.new.mail.yahoo.com/addresses
>> >
>> > com a sua cara @ymail.com <http://ymail.com> ou @rocketmail.com
>> <http://rocketmail.com>.
>> >
>> >
>> >
>>
>> ------------------------------------------------------------------------
>> >
>> >
>>
>> -------------------------------------------------------------------------
>> > This SF.Net email is sponsored by the Moblin Your Move
>> Developer's challenge
>> > Build the coolest Linux based applications with Moblin SDK & win
>> great prizes
>> > Grand prize is a trip for two to an Open Source event anywhere in
>> the world
>> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>> >
>> >
>> >
>>
>> ------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > Resteasy-developers mailing list
>> > Res...@li...
>> <mailto:Res...@li...>
>> > https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>>
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win
>> great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in
>> the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>> _______________________________________________
>> Resteasy-developers mailing list
>> Res...@li...
>> <mailto:Res...@li...>
>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>
>>
>>
>>
>> --
>> Paulo R C Siqueira
>> SCJP / SCWCD
>> http://www.ipti.org.br
>> Contato: (11) 8149-5046
>>
>>
>>
>> --
>> Paulo R C Siqueira
>> SCJP / SCWCD
>> http://www.ipti.org.br
>> Contato: (11) 8149-5046
>>
>>
>> ------------------------------------------------------------------------
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Resteasy-developers mailing list
>> Res...@li...
>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
--
Paulo R C Siqueira
SCJP / SCWCD
http://www.ipti.org.br
Contato: (11) 8149-5046
|
|
From: Paulo S. <pau...@gm...> - 2008-08-20 18:29:23
|
Hello,
When will we have a "beta 6" realease, with the recent big commit? I'm
hoping to test it to see if anything regarding this problem changes... Or
should we just test it against the CVS version?
[]s,
On Mon, Aug 11, 2008 at 11:03 AM, Paulo Siqueira
<pau...@gm...>wrote:
> I'm having trouble making the problem easy to reproduce... it happens
> sometimes, but not always.
>
> One thing I noted that is different in your tests from ours is that you
> don't have a method answering a URL directly (without sub-resources) and
> using a spring injected bean, which is our case. I changed our local test to
> use a sub-resource and the problem seemed to vanished, although I cannot be
> 100% sure yet.
>
> I could not make your environment run here, but I'll write down what I
> think could be a test case for my scenario, that could be inserted in the
> SmokeTest.
>
> This is the new block test:
>
> GetMethod method = new GetMethod("
> http://localhost:8080/spring-integration-test/direct/direct-call");
> int status = client.executeMethod(method);
> Assert.assertEquals(HttpResponseCodes.SC_OK, status);
> Assert.assertEquals("DIRECT OK", method.getResponseBodyAsString());
> method.releaseConnection();
>
> To implement this, we could use the following bean:
>
> @Path("/direct")
> @Service("direct")
> public class DirectBean {
> @GET
> @Path("direct-call")
> public String directCall() {
> return directSpring.getDirectResult();
> }
>
> @Resource(name="directSpring")
> private DirectSpring directSpring;
> }
>
> and the spring bean:
>
> @Service("directSpring")
> public class DirectSpring {
> public String getDirectResult() {
> return "DIRECT OK";
> }
> }
>
> does this make sense? Does it make the problem easier to understand?
>
> PS.: If this really reproduces our problem, you may have to run the test
> some times before the error appears, since it works sometimes.
>
> []s,
>
>
> On Fri, Aug 8, 2008 at 7:20 PM, Bill Burke <bb...@re...> wrote:
>
>> I cannot reproduce this problem. Do you have resteasy's scanning turned
>> on? That would screw things up.
>>
>> (I sent you the code I tested with. If you didn't get it ping me
>> privately).
>>
>> Paulo Siqueira wrote:
>>
>>> Sorry, I forgot to check the mailing list address in the CC...
>>>
>>> ---------- Forwarded message ----------
>>> From: *Paulo Siqueira* <pau...@gm... <mailto:
>>> pau...@gm...>>
>>> Date: Fri, Aug 8, 2008 at 3:12 PM
>>> Subject: Re: [Resteasy-developers] Problem with Spring and RestEasy
>>> integration
>>> To: Bill Burke <bb...@re... <mailto:bb...@re...>>
>>>
>>>
>>> Hi Bill,
>>>
>>> We don't want an instance per request. It doesn't matter at moment
>>> actually. The problem is that it isn't working even with everything
>>> singleton (which is the default scope in singleton). Do we have to do
>>> anything special to flag the RESTful beans as singleton?
>>>
>>> The main problem is the a dependency of the RESTful bean is not being
>>> injected sometimes, although the bean itself is always there, thus giving us
>>> NullPointers. In the example Fabio sent it would be the field "Seci" that
>>> would end up being null.
>>>
>>> []s,
>>>
>>>
>>> On Fri, Aug 8, 2008 at 12:16 PM, Bill Burke <bb...@re... <mailto:
>>> bb...@re...>> wrote:
>>>
>>> So you want a instance per request model?
>>>
>>> I'm not that familiar with spring and the RestEasy code expects a
>>> singleton model.
>>>
>>> I'll try out your code and see if I can figure things out.
>>>
>>> Fábio Serra wrote:
>>> > Hi,
>>> >
>>> > We have a problem integrating RestEasy and Spring. It seems like
>>> when
>>> > two users access the same resource at the same time, the
>>> > SpringContextLoaderListener is not injecting after the first
>>> instance.
>>> > After that all the resource instances aren't injected by Spring
>>> causing
>>> > NullPointerException at the spring injected objects.
>>> >
>>> > My web.xml is the same as the examples of this integration.
>>> >
>>> > Here is my resource class:
>>> > @Service("locating")
>>> > @Path("/")
>>> > public class LocatingResource {
>>> > public LocatingResource() {
>>> > System.out.println("Instanciando....");
>>> > }
>>> >
>>> > @GET
>>> > @Path("locating")
>>> > public String getLocating() {
>>> > System.out.println("Class: "+ this);
>>> > System.out.println("LOCATING...("+getSpringTest()+")");
>>> > return getSeci().toString();
>>> > }
>>> >
>>> > @Resource
>>> > private Seci seci;
>>> > public void setSeci( Seci seci ) {
>>> > System.out.println("Classe1: " +this);
>>> > System.out.println("SACI2: "+ seci);
>>> > this.seci = seci;
>>> > }
>>> > public Seci getSeci() {
>>> > return this.seci;
>>> > }
>>> > }
>>> >
>>> > My ApplicationContext.xml :
>>> > <beans xmlns="http://www.springframework.org/schema/beans"
>>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> > xmlns:context="
>>> http://www.springframework.org/schema/context"
>>> > default-autowire="byName"
>>> > xsi:schemaLocation="
>>> http://www.springframework.org/schema/beans
>>> >
>>> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>> >
>>> http://www.springframework.org/schema/context
>>> >
>>> >
>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd"
>>> >
>>> > >
>>> > <context:annotation-config/>
>>> > <context:spring-configured/>
>>> > <context:component-scan base-package="padauan"
>>> > annotation-config="true"/>
>>> > </bean>
>>> >
>>> >
>>> > Thanks,
>>> >
>>> > Fabio Serra
>>> >
>>> >
>>>
>>> ------------------------------------------------------------------------
>>> > Novos endereços, o Yahoo! que você conhece. Crie um email novo
>>> >
>>> <
>>> http://br.rd.yahoo.com/mail/taglines/mail/*http://br.new.mail.yahoo.com/addresses
>>> >
>>> > com a sua cara @ymail.com <http://ymail.com> ou @rocketmail.com
>>> <http://rocketmail.com>.
>>> >
>>> >
>>> >
>>>
>>> ------------------------------------------------------------------------
>>> >
>>> >
>>>
>>> -------------------------------------------------------------------------
>>> > This SF.Net email is sponsored by the Moblin Your Move
>>> Developer's challenge
>>> > Build the coolest Linux based applications with Moblin SDK & win
>>> great prizes
>>> > Grand prize is a trip for two to an Open Source event anywhere in
>>> the world
>>> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>>> >
>>> >
>>> >
>>>
>>> ------------------------------------------------------------------------
>>> >
>>> > _______________________________________________
>>> > Resteasy-developers mailing list
>>> > Res...@li...
>>> <mailto:Res...@li...>
>>> > https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>>
>>> --
>>> Bill Burke
>>> JBoss, a division of Red Hat
>>> http://bill.burkecentral.com
>>>
>>>
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win
>>> great prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in
>>> the world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>>> _______________________________________________
>>> Resteasy-developers mailing list
>>> Res...@li...
>>> <mailto:Res...@li...>
>>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>>
>>>
>>>
>>>
>>> --
>>> Paulo R C Siqueira
>>> SCJP / SCWCD
>>> http://www.ipti.org.br
>>> Contato: (11) 8149-5046
>>>
>>>
>>>
>>> --
>>> Paulo R C Siqueira
>>> SCJP / SCWCD
>>> http://www.ipti.org.br
>>> Contato: (11) 8149-5046
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great
>>> prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>> world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Resteasy-developers mailing list
>>> Res...@li...
>>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>>
>>
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>>
>>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
--
Paulo R C Siqueira
SCJP / SCWCD
http://www.ipti.org.br
Contato: (11) 8149-5046
|
|
From: Martin A. <sp...@ma...> - 2008-08-22 14:00:41
|
Paulo,
One thing that tripped me up was that subresources are never injected
(stated by the spec).
Example:
@Path("/")
public class MyResourceA {
@Resource
Context ctx; // this is injected
@Path("foo")
public MyResourceB produceB() {
return new MyResourceB();
}
}
public class MyResourceB {
@Resource
Context ctx; // this is NOT injected
}
Could that be the problem?
Martin
On 11 Aug 2008, at 16:03, Paulo Siqueira wrote:
> I'm having trouble making the problem easy to reproduce... it
> happens sometimes, but not always.
>
> One thing I noted that is different in your tests from ours is that
> you don't have a method answering a URL directly (without sub-
> resources) and using a spring injected bean, which is our case. I
> changed our local test to use a sub-resource and the problem seemed
> to vanished, although I cannot be 100% sure yet.
>
> I could not make your environment run here, but I'll write down what
> I think could be a test case for my scenario, that could be inserted
> in the SmokeTest.
>
> This is the new block test:
>
> GetMethod method = new GetMethod("http://localhost:8080/spring-integration-test/direct/direct-call
> ");
> int status = client.executeMethod(method);
> Assert.assertEquals(HttpResponseCodes.SC_OK, status);
> Assert.assertEquals("DIRECT OK", method.getResponseBodyAsString());
> method.releaseConnection();
>
> To implement this, we could use the following bean:
>
> @Path("/direct")
> @Service("direct")
> public class DirectBean {
> @GET
> @Path("direct-call")
> public String directCall() {
> return directSpring.getDirectResult();
> }
>
> @Resource(name="directSpring")
> private DirectSpring directSpring;
> }
>
> and the spring bean:
>
> @Service("directSpring")
> public class DirectSpring {
> public String getDirectResult() {
> return "DIRECT OK";
> }
> }
>
> does this make sense? Does it make the problem easier to understand?
>
> PS.: If this really reproduces our problem, you may have to run the
> test some times before the error appears, since it works sometimes.
>
> []s,
>
> On Fri, Aug 8, 2008 at 7:20 PM, Bill Burke <bb...@re...> wrote:
> I cannot reproduce this problem. Do you have resteasy's scanning
> turned on? That would screw things up.
>
> (I sent you the code I tested with. If you didn't get it ping me
> privately).
>
> Paulo Siqueira wrote:
> Sorry, I forgot to check the mailing list address in the CC...
>
> ---------- Forwarded message ----------
> From: *Paulo Siqueira* <pau...@gm... <mailto:pau...@gm...
> >>
> Date: Fri, Aug 8, 2008 at 3:12 PM
> Subject: Re: [Resteasy-developers] Problem with Spring and RestEasy
> integration
> To: Bill Burke <bb...@re... <mailto:bb...@re...>>
>
>
> Hi Bill,
>
> We don't want an instance per request. It doesn't matter at moment
> actually. The problem is that it isn't working even with everything
> singleton (which is the default scope in singleton). Do we have to
> do anything special to flag the RESTful beans as singleton?
>
> The main problem is the a dependency of the RESTful bean is not
> being injected sometimes, although the bean itself is always there,
> thus giving us NullPointers. In the example Fabio sent it would be
> the field "Seci" that would end up being null.
>
> []s,
>
>
> On Fri, Aug 8, 2008 at 12:16 PM, Bill Burke <bb...@re... <mailto:bb...@re...
> >> wrote:
>
> So you want a instance per request model?
>
> I'm not that familiar with spring and the RestEasy code expects a
> singleton model.
>
> I'll try out your code and see if I can figure things out.
>
> Fábio Serra wrote:
> > Hi,
> >
> > We have a problem integrating RestEasy and Spring. It seems
> like when
> > two users access the same resource at the same time, the
> > SpringContextLoaderListener is not injecting after the first
> instance.
> > After that all the resource instances aren't injected by Spring
> causing
> > NullPointerException at the spring injected objects.
> >
> > My web.xml is the same as the examples of this integration.
> >
> > Here is my resource class:
> > @Service("locating")
> > @Path("/")
> > public class LocatingResource {
> > public LocatingResource() {
> > System.out.println("Instanciando....");
> > }
> >
> > @GET
> > @Path("locating")
> > public String getLocating() {
> > System.out.println("Class: "+ this);
> > System.out.println("LOCATING...("+getSpringTest()+")");
> > return getSeci().toString();
> > }
> >
> > @Resource
> > private Seci seci;
> > public void setSeci( Seci seci ) {
> > System.out.println("Classe1: " +this);
> > System.out.println("SACI2: "+ seci);
> > this.seci = seci;
> > }
> > public Seci getSeci() {
> > return this.seci;
> > }
> > }
> >
> > My ApplicationContext.xml :
> > <beans xmlns="http://www.springframework.org/schema/beans"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:context="http://www.springframework.org/schema/context
> "
> > default-autowire="byName"
> > xsi:schemaLocation="http://www.springframework.org/schema/beans
> >
> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> > http://www.springframework.org/schema/context
> >
> > http://www.springframework.org/schema/context/spring-context-2.5.xsd
> "
> >
> > >
> > <context:annotation-config/>
> > <context:spring-configured/>
> > <context:component-scan base-package="padauan"
> > annotation-config="true"/>
> > </bean>
> >
> >
> > Thanks,
> >
> > Fabio Serra
> >
> >
>
> ------------------------------------------------------------------------
> > Novos endereços, o Yahoo! que você conhece. Crie um email novo
> >
> <http://br.rd.yahoo.com/mail/taglines/mail/*http://br.new.mail.yahoo.com/addresses
> >
> > com a sua cara @ymail.com <http://ymail.com> ou @rocketmail.com
> <http://rocketmail.com>.
>
> >
> >
> >
>
> ------------------------------------------------------------------------
> >
> >
>
> -------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> > Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> > Grand prize is a trip for two to an Open Source event anywhere
> in
> the world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
> >
> >
> >
>
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Resteasy-developers mailing list
> > Res...@li...
> <mailto:Res...@li...>
>
> > https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> <mailto:Res...@li...>
>
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
|
|
From: Paulo S. <pau...@gm...> - 2008-08-22 14:34:10
|
Hi Martin,
Almost like that, but the problem is that the resource is SOMETIMES injected
(which I couldn't take any sense out of it yet).
So, it would be like this:
@Path("/")
public class MyResourceA {
@Resource
Context ctx; // this is SOMETIMES injected
@Path("foo")
public MyResourceB produceB() {
return new MyResourceB();
}
}
If I print the ctx field inside produceB, it will sometimes be null, and
sometimes be a valid object.
[]s,
On Fri, Aug 22, 2008 at 11:00 AM, Martin Algesten <sp...@ma...> wrote:
>
> Paulo,
>
> One thing that tripped me up was that subresources are never injected
> (stated by the spec).
>
> Example:
>
> @Path("/")
> public class MyResourceA {
>
> @Resource
> Context ctx; // this is injected
>
> @Path("foo")
> public MyResourceB produceB() {
> return new MyResourceB();
> }
>
> }
>
> public class MyResourceB {
>
> @Resource
> Context ctx; // this is NOT injected
>
> }
>
> Could that be the problem?
>
> Martin
>
>
> On 11 Aug 2008, at 16:03, Paulo Siqueira wrote:
>
> I'm having trouble making the problem easy to reproduce... it happens
> sometimes, but not always.
>
> One thing I noted that is different in your tests from ours is that you
> don't have a method answering a URL directly (without sub-resources) and
> using a spring injected bean, which is our case. I changed our local test to
> use a sub-resource and the problem seemed to vanished, although I cannot be
> 100% sure yet.
>
> I could not make your environment run here, but I'll write down what I
> think could be a test case for my scenario, that could be inserted in the
> SmokeTest.
>
> This is the new block test:
>
> GetMethod method = new GetMethod("
> http://localhost:8080/spring-integration-test/direct/direct-call");
> int status = client.executeMethod(method);
> Assert.assertEquals(HttpResponseCodes.SC_OK, status);
> Assert.assertEquals("DIRECT OK", method.getResponseBodyAsString());
> method.releaseConnection();
>
> To implement this, we could use the following bean:
>
> @Path("/direct")
> @Service("direct")
> public class DirectBean {
> @GET
> @Path("direct-call")
> public String directCall() {
> return directSpring.getDirectResult();
> }
>
> @Resource(name="directSpring")
> private DirectSpring directSpring;
> }
>
> and the spring bean:
>
> @Service("directSpring")
> public class DirectSpring {
> public String getDirectResult() {
> return "DIRECT OK";
> }
> }
>
> does this make sense? Does it make the problem easier to understand?
>
> PS.: If this really reproduces our problem, you may have to run the test
> some times before the error appears, since it works sometimes.
>
> []s,
>
> On Fri, Aug 8, 2008 at 7:20 PM, Bill Burke <bb...@re...> wrote:
>
>> I cannot reproduce this problem. Do you have resteasy's scanning turned
>> on? That would screw things up.
>>
>> (I sent you the code I tested with. If you didn't get it ping me
>> privately).
>>
>> Paulo Siqueira wrote:
>>
>>> Sorry, I forgot to check the mailing list address in the CC...
>>>
>>> ---------- Forwarded message ----------
>>> From: *Paulo Siqueira* <pau...@gm... <mailto:
>>> pau...@gm...>>
>>> Date: Fri, Aug 8, 2008 at 3:12 PM
>>> Subject: Re: [Resteasy-developers] Problem with Spring and RestEasy
>>> integration
>>> To: Bill Burke <bb...@re... <mailto:bb...@re...>>
>>>
>>>
>>> Hi Bill,
>>>
>>> We don't want an instance per request. It doesn't matter at moment
>>> actually. The problem is that it isn't working even with everything
>>> singleton (which is the default scope in singleton). Do we have to do
>>> anything special to flag the RESTful beans as singleton?
>>>
>>> The main problem is the a dependency of the RESTful bean is not being
>>> injected sometimes, although the bean itself is always there, thus giving us
>>> NullPointers. In the example Fabio sent it would be the field "Seci" that
>>> would end up being null.
>>>
>>> []s,
>>>
>>>
>>> On Fri, Aug 8, 2008 at 12:16 PM, Bill Burke <bb...@re... <mailto:
>>> bb...@re...>> wrote:
>>>
>>> So you want a instance per request model?
>>>
>>> I'm not that familiar with spring and the RestEasy code expects a
>>> singleton model.
>>>
>>> I'll try out your code and see if I can figure things out.
>>>
>>> Fábio Serra wrote:
>>> > Hi,
>>> >
>>> > We have a problem integrating RestEasy and Spring. It seems like
>>> when
>>> > two users access the same resource at the same time, the
>>> > SpringContextLoaderListener is not injecting after the first
>>> instance.
>>> > After that all the resource instances aren't injected by Spring
>>> causing
>>> > NullPointerException at the spring injected objects.
>>> >
>>> > My web.xml is the same as the examples of this integration.
>>> >
>>> > Here is my resource class:
>>> > @Service("locating")
>>> > @Path("/")
>>> > public class LocatingResource {
>>> > public LocatingResource() {
>>> > System.out.println("Instanciando....");
>>> > }
>>> >
>>> > @GET
>>> > @Path("locating")
>>> > public String getLocating() {
>>> > System.out.println("Class: "+ this);
>>> > System.out.println("LOCATING...("+getSpringTest()+")");
>>> > return getSeci().toString();
>>> > }
>>> >
>>> > @Resource
>>> > private Seci seci;
>>> > public void setSeci( Seci seci ) {
>>> > System.out.println("Classe1: " +this);
>>> > System.out.println("SACI2: "+ seci);
>>> > this.seci = seci;
>>> > }
>>> > public Seci getSeci() {
>>> > return this.seci;
>>> > }
>>> > }
>>> >
>>> > My ApplicationContext.xml :
>>> > <beans xmlns="http://www.springframework.org/schema/beans"
>>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>>> > xmlns:context="
>>> http://www.springframework.org/schema/context"
>>> > default-autowire="byName"
>>> > xsi:schemaLocation="
>>> http://www.springframework.org/schema/beans
>>> >
>>> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>>> >
>>> http://www.springframework.org/schema/context
>>> >
>>> >
>>> http://www.springframework.org/schema/context/spring-context-2.5.xsd"
>>> >
>>> > >
>>> > <context:annotation-config/>
>>> > <context:spring-configured/>
>>> > <context:component-scan base-package="padauan"
>>> > annotation-config="true"/>
>>> > </bean>
>>> >
>>> >
>>> > Thanks,
>>> >
>>> > Fabio Serra
>>> >
>>> >
>>>
>>> ------------------------------------------------------------------------
>>> > Novos endereços, o Yahoo! que você conhece. Crie um email novo
>>> >
>>> <
>>> http://br.rd.yahoo.com/mail/taglines/mail/*http://br.new.mail.yahoo.com/addresses
>>> >
>>> > com a sua cara @ymail.com <http://ymail.com> ou @rocketmail.com
>>> <http://rocketmail.com>.
>>> >
>>> >
>>> >
>>>
>>> ------------------------------------------------------------------------
>>> >
>>> >
>>>
>>> -------------------------------------------------------------------------
>>> > This SF.Net email is sponsored by the Moblin Your Move
>>> Developer's challenge
>>> > Build the coolest Linux based applications with Moblin SDK & win
>>> great prizes
>>> > Grand prize is a trip for two to an Open Source event anywhere in
>>> the world
>>> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>>> >
>>> >
>>> >
>>>
>>> ------------------------------------------------------------------------
>>> >
>>> > _______________________________________________
>>> > Resteasy-developers mailing list
>>> > Res...@li...
>>> <mailto:Res...@li...>
>>> > https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>>
>>> --
>>> Bill Burke
>>> JBoss, a division of Red Hat
>>> http://bill.burkecentral.com
>>>
>>>
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win
>>> great prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in
>>> the world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>>> _______________________________________________
>>> Resteasy-developers mailing list
>>> Res...@li...
>>> <mailto:Res...@li...>
>>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>>
>>>
>>>
>>>
>>> --
>>> Paulo R C Siqueira
>>> SCJP / SCWCD
>>> http://www.ipti.org.br
>>> Contato: (11) 8149-5046
>>>
>>>
>>>
>>> --
>>> Paulo R C Siqueira
>>> SCJP / SCWCD
>>> http://www.ipti.org.br
>>> Contato: (11) 8149-5046
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> -------------------------------------------------------------------------
>>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>>> challenge
>>> Build the coolest Linux based applications with Moblin SDK & win great
>>> prizes
>>> Grand prize is a trip for two to an Open Source event anywhere in the
>>> world
>>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> Resteasy-developers mailing list
>>> Res...@li...
>>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>>
>>
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>>
>>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win great
> prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
>
> http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
>
>
--
Paulo R C Siqueira
SCJP / SCWCD
http://www.ipti.org.br
Contato: (11) 8149-5046
|
|
From: Bill B. <bb...@re...> - 2008-08-08 21:07:47
Attachments:
springtest.jar
|
I cannot reproduce this problem. Please see attached jar for the
sourcecode example I made to test this. Do you have resteasy's scanning
turned on? That would screw things up.
Paulo Siqueira wrote:
> Sorry, I forgot to check the mailing list address in the CC...
>
> ---------- Forwarded message ----------
> From: *Paulo Siqueira* <pau...@gm...
> <mailto:pau...@gm...>>
> Date: Fri, Aug 8, 2008 at 3:12 PM
> Subject: Re: [Resteasy-developers] Problem with Spring and RestEasy
> integration
> To: Bill Burke <bb...@re... <mailto:bb...@re...>>
>
>
> Hi Bill,
>
> We don't want an instance per request. It doesn't matter at moment
> actually. The problem is that it isn't working even with everything
> singleton (which is the default scope in singleton). Do we have to do
> anything special to flag the RESTful beans as singleton?
>
> The main problem is the a dependency of the RESTful bean is not being
> injected sometimes, although the bean itself is always there, thus
> giving us NullPointers. In the example Fabio sent it would be the field
> "Seci" that would end up being null.
>
> []s,
>
>
> On Fri, Aug 8, 2008 at 12:16 PM, Bill Burke <bb...@re...
> <mailto:bb...@re...>> wrote:
>
> So you want a instance per request model?
>
> I'm not that familiar with spring and the RestEasy code expects a
> singleton model.
>
> I'll try out your code and see if I can figure things out.
>
> Fábio Serra wrote:
> > Hi,
> >
> > We have a problem integrating RestEasy and Spring. It seems like when
> > two users access the same resource at the same time, the
> > SpringContextLoaderListener is not injecting after the first
> instance.
> > After that all the resource instances aren't injected by Spring
> causing
> > NullPointerException at the spring injected objects.
> >
> > My web.xml is the same as the examples of this integration.
> >
> > Here is my resource class:
> > @Service("locating")
> > @Path("/")
> > public class LocatingResource {
> > public LocatingResource() {
> > System.out.println("Instanciando....");
> > }
> >
> > @GET
> > @Path("locating")
> > public String getLocating() {
> > System.out.println("Class: "+ this);
> > System.out.println("LOCATING...("+getSpringTest()+")");
> > return getSeci().toString();
> > }
> >
> > @Resource
> > private Seci seci;
> > public void setSeci( Seci seci ) {
> > System.out.println("Classe1: " +this);
> > System.out.println("SACI2: "+ seci);
> > this.seci = seci;
> > }
> > public Seci getSeci() {
> > return this.seci;
> > }
> > }
> >
> > My ApplicationContext.xml :
> > <beans xmlns="http://www.springframework.org/schema/beans"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> > xmlns:context="http://www.springframework.org/schema/context"
> > default-autowire="byName"
> > xsi:schemaLocation="http://www.springframework.org/schema/beans
> >
> > http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> >
> http://www.springframework.org/schema/context
> >
> > http://www.springframework.org/schema/context/spring-context-2.5.xsd"
> >
> > >
> > <context:annotation-config/>
> > <context:spring-configured/>
> > <context:component-scan base-package="padauan"
> > annotation-config="true"/>
> > </bean>
> >
> >
> > Thanks,
> >
> > Fabio Serra
> >
> >
> ------------------------------------------------------------------------
> > Novos endereços, o Yahoo! que você conhece. Crie um email novo
> >
> <http://br.rd.yahoo.com/mail/taglines/mail/*http://br.new.mail.yahoo.com/addresses>
> > com a sua cara @ymail.com <http://ymail.com> ou @rocketmail.com
> <http://rocketmail.com>.
> >
> >
> >
> ------------------------------------------------------------------------
> >
> >
> -------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> > Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> > Grand prize is a trip for two to an Open Source event anywhere in
> the world
> > http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
> >
> >
> >
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Resteasy-developers mailing list
> > Res...@li...
> <mailto:Res...@li...>
> > https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> <mailto:Res...@li...>
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Bill B. <bb...@re...> - 2008-08-20 18:42:04
|
You can test against SVN version. Trunk should build.
BTW, again, I was able to get this to work against beta 5. Were u?
Paulo Siqueira wrote:
> Hello,
>
> When will we have a "beta 6" realease, with the recent big commit? I'm
> hoping to test it to see if anything regarding this problem changes...
> Or should we just test it against the CVS version?
>
> []s,
>
> On Mon, Aug 11, 2008 at 11:03 AM, Paulo Siqueira
> <pau...@gm... <mailto:pau...@gm...>> wrote:
>
> I'm having trouble making the problem easy to reproduce... it
> happens sometimes, but not always.
>
> One thing I noted that is different in your tests from ours is that
> you don't have a method answering a URL directly (without
> sub-resources) and using a spring injected bean, which is our case.
> I changed our local test to use a sub-resource and the problem
> seemed to vanished, although I cannot be 100% sure yet.
>
> I could not make your environment run here, but I'll write down what
> I think could be a test case for my scenario, that could be inserted
> in the SmokeTest.
>
> This is the new block test:
>
> GetMethod method = new
> GetMethod("http://localhost:8080/spring-integration-test/direct/direct-call");
> int status = client.executeMethod(method);
> Assert.assertEquals(HttpResponseCodes.SC_OK, status);
> Assert.assertEquals("DIRECT OK", method.getResponseBodyAsString());
> method.releaseConnection();
>
> To implement this, we could use the following bean:
>
> @Path("/direct")
> @Service("direct")
> public class DirectBean {
> @GET
> @Path("direct-call")
> public String directCall() {
> return directSpring.getDirectResult();
> }
>
> @Resource(name="directSpring")
> private DirectSpring directSpring;
> }
>
> and the spring bean:
>
> @Service("directSpring")
> public class DirectSpring {
> public String getDirectResult() {
> return "DIRECT OK";
> }
> }
>
> does this make sense? Does it make the problem easier to understand?
>
> PS.: If this really reproduces our problem, you may have to run the
> test some times before the error appears, since it works sometimes.
>
> []s,
>
>
> On Fri, Aug 8, 2008 at 7:20 PM, Bill Burke <bb...@re...
> <mailto:bb...@re...>> wrote:
>
> I cannot reproduce this problem. Do you have resteasy's
> scanning turned on? That would screw things up.
>
> (I sent you the code I tested with. If you didn't get it ping
> me privately).
>
> Paulo Siqueira wrote:
>
> Sorry, I forgot to check the mailing list address in the CC...
>
> ---------- Forwarded message ----------
> From: *Paulo Siqueira* <pau...@gm...
> <mailto:pau...@gm...>
> <mailto:pau...@gm...
> <mailto:pau...@gm...>>>
> Date: Fri, Aug 8, 2008 at 3:12 PM
> Subject: Re: [Resteasy-developers] Problem with Spring and
> RestEasy integration
> To: Bill Burke <bb...@re... <mailto:bb...@re...>
> <mailto:bb...@re... <mailto:bb...@re...>>>
>
>
> Hi Bill,
>
> We don't want an instance per request. It doesn't matter at
> moment actually. The problem is that it isn't working even
> with everything singleton (which is the default scope in
> singleton). Do we have to do anything special to flag the
> RESTful beans as singleton?
>
> The main problem is the a dependency of the RESTful bean is
> not being injected sometimes, although the bean itself is
> always there, thus giving us NullPointers. In the example
> Fabio sent it would be the field "Seci" that would end up
> being null.
>
> []s,
>
>
> On Fri, Aug 8, 2008 at 12:16 PM, Bill Burke
> <bb...@re... <mailto:bb...@re...>
> <mailto:bb...@re... <mailto:bb...@re...>>> wrote:
>
> So you want a instance per request model?
>
> I'm not that familiar with spring and the RestEasy code
> expects a
> singleton model.
>
> I'll try out your code and see if I can figure things out.
>
> Fábio Serra wrote:
> > Hi,
> >
> > We have a problem integrating RestEasy and Spring. It
> seems like when
> > two users access the same resource at the same time, the
> > SpringContextLoaderListener is not injecting after the
> first
> instance.
> > After that all the resource instances aren't injected
> by Spring
> causing
> > NullPointerException at the spring injected objects.
> >
> > My web.xml is the same as the examples of this
> integration.
> >
> > Here is my resource class:
> > @Service("locating")
> > @Path("/")
> > public class LocatingResource {
> > public LocatingResource() {
> > System.out.println("Instanciando....");
> > }
> >
> > @GET
> > @Path("locating")
> > public String getLocating() {
> > System.out.println("Class: "+ this);
> >
> System.out.println("LOCATING...("+getSpringTest()+")");
> > return getSeci().toString();
> > }
> >
> > @Resource
> > private Seci seci;
> > public void setSeci( Seci seci ) {
> > System.out.println("Classe1: " +this);
> > System.out.println("SACI2: "+ seci);
> > this.seci = seci;
> > }
> > public Seci getSeci() {
> > return this.seci;
> > }
> > }
> >
> > My ApplicationContext.xml :
> > <beans xmlns="http://www.springframework.org/schema/beans"
> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >
> xmlns:context="http://www.springframework.org/schema/context"
> > default-autowire="byName"
> >
> xsi:schemaLocation="http://www.springframework.org/schema/beans
> >
> >
> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
> >
> http://www.springframework.org/schema/context
> >
> >
> http://www.springframework.org/schema/context/spring-context-2.5.xsd"
> >
> > >
> > <context:annotation-config/>
> > <context:spring-configured/>
> > <context:component-scan base-package="padauan"
> > annotation-config="true"/>
> > </bean>
> >
> >
> > Thanks,
> >
> > Fabio Serra
> >
> >
>
> ------------------------------------------------------------------------
> > Novos endereços, o Yahoo! que você conhece. Crie um
> email novo
> >
>
> <http://br.rd.yahoo.com/mail/taglines/mail/*http://br.new.mail.yahoo.com/addresses>
> > com a sua cara @ymail.com <http://ymail.com>
> <http://ymail.com> ou @rocketmail.com <http://rocketmail.com>
> <http://rocketmail.com>.
>
> >
> >
> >
>
> ------------------------------------------------------------------------
> >
> >
>
> -------------------------------------------------------------------------
> > This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> > Build the coolest Linux based applications with Moblin
> SDK & win
> great prizes
> > Grand prize is a trip for two to an Open Source event
> anywhere in
> the world
> >
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>>
> >
> >
> >
>
> ------------------------------------------------------------------------
> >
> > _______________________________________________
> > Resteasy-developers mailing list
> > Res...@li...
> <mailto:Res...@li...>
> <mailto:Res...@li...
> <mailto:Res...@li...>>
>
> >
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's
> challenge
> Build the coolest Linux based applications with Moblin
> SDK & win
> great prizes
> Grand prize is a trip for two to an Open Source event
> anywhere in
> the world
>
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> <mailto:Res...@li...>
> <mailto:Res...@li...
> <mailto:Res...@li...>>
>
>
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> Build the coolest Linux based applications with Moblin SDK &
> win great prizes
> Grand prize is a trip for two to an Open Source event
> anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> <mailto:Res...@li...>
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Resteasy-developers mailing list
> Res...@li...
> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Paulo S. <pau...@gm...> - 2008-08-21 17:49:53
|
Hi Bill,
Not really...
I'll send you a complete test project so that you can take a look.
In this example, what happens is this:
Calling
http://localhost:8080/SpringTest/fabiopqp
or
http://localhost:8080/SpringTest/fabiopqp-json
The result sometimes prints the injected field as null, and sometimes prints
it correctly. The state of correct changes between deploys, so if it works
once, it will probably work always until a redeploy (which means you might
have to redeploy a few times until you get the error)
In these two cases, a spring injected field is used directly.
A third test is the one at the URL:
http://localhost:8080/SpringTest/locating/test
Which uses an injected field in the return statement and thus is used as a
subresource. In this case, the code seems to always work.
[]s,
On Wed, Aug 20, 2008 at 3:41 PM, Bill Burke <bb...@re...> wrote:
> You can test against SVN version. Trunk should build.
>
> BTW, again, I was able to get this to work against beta 5. Were u?
>
> Paulo Siqueira wrote:
>
>> Hello,
>>
>> When will we have a "beta 6" realease, with the recent big commit? I'm
>> hoping to test it to see if anything regarding this problem changes... Or
>> should we just test it against the CVS version?
>>
>> []s,
>>
>> On Mon, Aug 11, 2008 at 11:03 AM, Paulo Siqueira <
>> pau...@gm... <mailto:pau...@gm...>> wrote:
>>
>> I'm having trouble making the problem easy to reproduce... it
>> happens sometimes, but not always.
>>
>> One thing I noted that is different in your tests from ours is that
>> you don't have a method answering a URL directly (without
>> sub-resources) and using a spring injected bean, which is our case.
>> I changed our local test to use a sub-resource and the problem
>> seemed to vanished, although I cannot be 100% sure yet.
>>
>> I could not make your environment run here, but I'll write down what
>> I think could be a test case for my scenario, that could be inserted
>> in the SmokeTest.
>>
>> This is the new block test:
>>
>> GetMethod method = new
>> GetMethod("
>> http://localhost:8080/spring-integration-test/direct/direct-call");
>> int status = client.executeMethod(method);
>> Assert.assertEquals(HttpResponseCodes.SC_OK, status);
>> Assert.assertEquals("DIRECT OK", method.getResponseBodyAsString());
>> method.releaseConnection();
>>
>> To implement this, we could use the following bean:
>>
>> @Path("/direct")
>> @Service("direct")
>> public class DirectBean {
>> @GET
>> @Path("direct-call")
>> public String directCall() {
>> return directSpring.getDirectResult();
>> }
>> @Resource(name="directSpring")
>> private DirectSpring directSpring;
>> }
>>
>> and the spring bean:
>>
>> @Service("directSpring")
>> public class DirectSpring {
>> public String getDirectResult() {
>> return "DIRECT OK";
>> }
>> }
>>
>> does this make sense? Does it make the problem easier to understand?
>>
>> PS.: If this really reproduces our problem, you may have to run the
>> test some times before the error appears, since it works sometimes.
>>
>> []s,
>>
>>
>> On Fri, Aug 8, 2008 at 7:20 PM, Bill Burke <bb...@re...
>> <mailto:bb...@re...>> wrote:
>>
>> I cannot reproduce this problem. Do you have resteasy's
>> scanning turned on? That would screw things up.
>>
>> (I sent you the code I tested with. If you didn't get it ping
>> me privately).
>>
>> Paulo Siqueira wrote:
>>
>> Sorry, I forgot to check the mailing list address in the CC...
>>
>> ---------- Forwarded message ----------
>> From: *Paulo Siqueira* <pau...@gm...
>> <mailto:pau...@gm...>
>> <mailto:pau...@gm...
>> <mailto:pau...@gm...>>>
>> Date: Fri, Aug 8, 2008 at 3:12 PM
>> Subject: Re: [Resteasy-developers] Problem with Spring and
>> RestEasy integration
>> To: Bill Burke <bb...@re... <mailto:bb...@re...>
>> <mailto:bb...@re... <mailto:bb...@re...>>>
>>
>>
>> Hi Bill,
>>
>> We don't want an instance per request. It doesn't matter at
>> moment actually. The problem is that it isn't working even
>> with everything singleton (which is the default scope in
>> singleton). Do we have to do anything special to flag the
>> RESTful beans as singleton?
>>
>> The main problem is the a dependency of the RESTful bean is
>> not being injected sometimes, although the bean itself is
>> always there, thus giving us NullPointers. In the example
>> Fabio sent it would be the field "Seci" that would end up
>> being null.
>>
>> []s,
>>
>>
>> On Fri, Aug 8, 2008 at 12:16 PM, Bill Burke
>> <bb...@re... <mailto:bb...@re...>
>> <mailto:bb...@re... <mailto:bb...@re...>>> wrote:
>>
>> So you want a instance per request model?
>>
>> I'm not that familiar with spring and the RestEasy code
>> expects a
>> singleton model.
>>
>> I'll try out your code and see if I can figure things out.
>>
>> Fábio Serra wrote:
>> > Hi,
>> >
>> > We have a problem integrating RestEasy and Spring. It
>> seems like when
>> > two users access the same resource at the same time, the
>> > SpringContextLoaderListener is not injecting after the
>> first
>> instance.
>> > After that all the resource instances aren't injected
>> by Spring
>> causing
>> > NullPointerException at the spring injected objects.
>> >
>> > My web.xml is the same as the examples of this
>> integration.
>> >
>> > Here is my resource class:
>> > @Service("locating")
>> > @Path("/")
>> > public class LocatingResource {
>> > public LocatingResource() {
>> > System.out.println("Instanciando....");
>> > }
>> >
>> > @GET
>> > @Path("locating")
>> > public String getLocating() {
>> > System.out.println("Class: "+ this);
>> >
>> System.out.println("LOCATING...("+getSpringTest()+")");
>> > return getSeci().toString();
>> > }
>> >
>> > @Resource
>> > private Seci seci;
>> > public void setSeci( Seci seci ) {
>> > System.out.println("Classe1: " +this);
>> > System.out.println("SACI2: "+ seci);
>> > this.seci = seci;
>> > }
>> > public Seci getSeci() {
>> > return this.seci;
>> > }
>> > }
>> >
>> > My ApplicationContext.xml :
>> > <beans xmlns="
>> http://www.springframework.org/schema/beans"
>> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance
>> "
>> > xmlns:context="
>> http://www.springframework.org/schema/context"
>> > default-autowire="byName"
>> > xsi:schemaLocation="
>> http://www.springframework.org/schema/beans
>> >
>> >
>>
>> http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
>> >
>> http://www.springframework.org/schema/context
>> >
>> >
>>
>> http://www.springframework.org/schema/context/spring-context-2.5.xsd"
>> >
>> > >
>> > <context:annotation-config/>
>> > <context:spring-configured/>
>> > <context:component-scan base-package="padauan"
>> > annotation-config="true"/>
>> > </bean>
>> >
>> >
>> > Thanks,
>> >
>> > Fabio Serra
>> >
>> >
>>
>> ------------------------------------------------------------------------
>> > Novos endereços, o Yahoo! que você conhece. Crie um
>> email novo
>> >
>> <
>> http://br.rd.yahoo.com/mail/taglines/mail/*http://br.new.mail.yahoo.com/addresses
>> >
>> > com a sua cara @ymail.com <http://ymail.com>
>> <http://ymail.com> ou @rocketmail.com <http://rocketmail.com>
>> <http://rocketmail.com>.
>>
>> >
>> >
>> >
>>
>> ------------------------------------------------------------------------
>> >
>> >
>>
>> -------------------------------------------------------------------------
>> > This SF.Net email is sponsored by the Moblin Your Move
>> Developer's challenge
>> > Build the coolest Linux based applications with Moblin
>> SDK & win
>> great prizes
>> > Grand prize is a trip for two to an Open Source event
>> anywhere in
>> the world
>> >
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>> <
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>>
>> >
>> >
>> >
>>
>> ------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > Resteasy-developers mailing list
>> > Res...@li...
>> <mailto:Res...@li...>
>> <mailto:Res...@li...
>> <mailto:Res...@li...>>
>>
>> >
>>
>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>
>> --
>> Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>>
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move
>> Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin
>> SDK & win
>> great prizes
>> Grand prize is a trip for two to an Open Source event
>> anywhere in
>> the world
>>
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>> <
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>>
>> _______________________________________________
>> Resteasy-developers mailing list
>> Res...@li...
>> <mailto:Res...@li...>
>> <mailto:Res...@li...
>> <mailto:Res...@li...>>
>>
>>
>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>
>>
>>
>>
>> -- Paulo R C Siqueira
>> SCJP / SCWCD
>> http://www.ipti.org.br
>> Contato: (11) 8149-5046
>>
>>
>>
>> -- Paulo R C Siqueira
>> SCJP / SCWCD
>> http://www.ipti.org.br
>> Contato: (11) 8149-5046
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move
>> Developer's challenge
>> Build the coolest Linux based applications with Moblin SDK &
>> win great prizes
>> Grand prize is a trip for two to an Open Source event
>> anywhere in the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Resteasy-developers mailing list
>> Res...@li...
>> <mailto:Res...@li...>
>>
>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>
>>
>> -- Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>>
>>
>>
>>
>> -- Paulo R C Siqueira
>> SCJP / SCWCD
>> http://www.ipti.org.br
>> Contato: (11) 8149-5046
>>
>>
>>
>>
>> --
>> Paulo R C Siqueira
>> SCJP / SCWCD
>> http://www.ipti.org.br
>> Contato: (11) 8149-5046
>>
>>
>> ------------------------------------------------------------------------
>>
>> -------------------------------------------------------------------------
>> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win great
>> prizes
>> Grand prize is a trip for two to an Open Source event anywhere in the
>> world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> Resteasy-developers mailing list
>> Res...@li...
>> https://lists.sourceforge.net/lists/listinfo/resteasy-developers
>>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
--
Paulo R C Siqueira
SCJP / SCWCD
http://www.ipti.org.br
Contato: (11) 8149-5046
|
|
From: Bill B. <bb...@re...> - 2008-08-22 17:57:19
|
Paulo Siqueira wrote:
> Hi Martin,
>
> Almost like that, but the problem is that the resource is SOMETIMES
> injected (which I couldn't take any sense out of it yet).
>
> So, it would be like this:
>
> @Path("/")
> public class MyResourceA {
>
> @Resource
> Context ctx; // this is SOMETIMES injected
>
> @Path("foo")
> public MyResourceB produceB() {
> return new MyResourceB();
> }
>
> }
>
> If I print the ctx field inside produceB, it will sometimes be null, and
> sometimes be a valid object.
>
MyResourceA should be a singleton right? Only instantiated once? I
just can't see this as a Resteasy problem. Can you put in a default
constructor and see how many times an instance of MyResourceA is
instantiated? Another thing maybe could be to use setter injection and
log there to see how many times the setter is call. A final thing,
create some random ID per instance and print it out to see if you have
different instances.
i.e.
@Path("/")
@Service
public class MyResourceA {
private long id = System.currentTimeMillis();
public MyResourceA() {
System.out.println("Instantiated: " + id);
}
@Resource
public void setCtx(Context ctx) {
System.out.pritln("setCtx called on: " + id);
this.ctx = ctx;
}
@Path("foo")
public MyResourceB produceB() {
System.out.pritln("produceB called on: " + id);
return new MyResourceB();
}
}
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Paulo S. <pau...@gm...> - 2008-08-22 18:45:31
|
> > MyResourceA should be a singleton right? Only instantiated once? Yes and yes. > I just can't see this as a Resteasy problem. Can you put in a default > constructor and see how many times an instance of MyResourceA is > instantiated? Another thing maybe could be to use setter injection and log > there to see how many times the setter is call. A final thing, create some > random ID per instance and print it out to see if you have different > instances. Following your suggestions, here is an output we got: 15:33:34,597 INFO [STDOUT] Instantiating LocatingResource: 1219430014597 15:33:34,616 INFO [STDOUT] new Seci being injected at LocatingResource: 1219430014597 15:33:34,619 INFO [ContextLoader] Root WebApplicationContext: initialization completed in 506 ms 15:34:12,010 INFO [STDOUT] Instantiating LocatingResource: 1219430052010 15:34:12,013 INFO [STDOUT] 'fabiopqp' URL begin called at LocatingResource: 1219430052010 15:34:12,013 INFO [STDOUT] Injected Seci for this call: null "LocatingResource" is the name of the Resteasy bean. Notice that it is instantiated twice: one in the startup (first three outputs), and another when a URL mapped to a method is called (last three outputs). Also, in the second time, the injector method is not called, and thus the correspondent field is null. []s, -- Paulo R C Siqueira SCJP / SCWCD http://www.ipti.org.br Contato: (11) 8149-5046 |
|
From: Bill B. <bb...@re...> - 2008-08-22 19:05:35
|
Ok, that helps.
Now, in the constructor add this:
public MyResourceA()
{
new Exception.printStackTrace();
...the id printing...
}
This will tell us exactly who is instantiating the resource.
Paulo Siqueira wrote:
> MyResourceA should be a singleton right? Only instantiated once?
>
>
> Yes and yes.
>
>
> I just can't see this as a Resteasy problem. Can you put in a
> default constructor and see how many times an instance of
> MyResourceA is instantiated? Another thing maybe could be to use
> setter injection and log there to see how many times the setter is
> call. A final thing, create some random ID per instance and print
> it out to see if you have different instances.
>
>
> Following your suggestions, here is an output we got:
>
> 15:33:34,597 INFO [STDOUT] Instantiating LocatingResource: 1219430014597
> 15:33:34,616 INFO [STDOUT] new Seci being injected at LocatingResource:
> 1219430014597
> 15:33:34,619 INFO [ContextLoader] Root WebApplicationContext:
> initialization completed in 506 ms
>
> 15:34:12,010 INFO [STDOUT] Instantiating LocatingResource: 1219430052010
> 15:34:12,013 INFO [STDOUT] 'fabiopqp' URL begin called at
> LocatingResource: 1219430052010
> 15:34:12,013 INFO [STDOUT] Injected Seci for this call: null
>
> "LocatingResource" is the name of the Resteasy bean. Notice that it is
> instantiated twice: one in the startup (first three outputs), and
> another when a URL mapped to a method is called (last three outputs).
>
> Also, in the second time, the injector method is not called, and thus
> the correspondent field is null.
>
> []s,
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Paulo S. <pau...@gm...> - 2008-08-22 19:26:20
|
Ok, the result is bellow (I added blank lines to help find the second part).
If I understood, the first time, the injection is made by spring, and the
second time resteasy try to do something...
Also, a bizzarre thing is that it worked once, and then the second time
didn't print any exception (which makes sense since there were no new
instances being created).
16:16:16,053 INFO [STDOUT] Instantiating LocatingResource: 1219432576053
16:16:16,053 ERROR [STDERR] java.lang.Exception
16:16:16,054 ERROR [STDERR] at
padauan.LocatingResource.<init>(LocatingResource.java:30)
16:16:16,054 ERROR [STDERR] at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
16:16:16,054 ERROR [STDERR] at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
16:16:16,054 ERROR [STDERR] at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
16:16:16,054 ERROR [STDERR] at
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
16:16:16,054 ERROR [STDERR] at
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:96)
16:16:16,054 ERROR [STDERR] at
org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
16:16:16,054 ERROR [STDERR] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:875)
16:16:16,054 ERROR [STDERR] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:837)
16:16:16,054 ERROR [STDERR] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
16:16:16,054 ERROR [STDERR] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
16:16:16,054 ERROR [STDERR] at
java.security.AccessController.doPrivileged(Native Method)
16:16:16,055 ERROR [STDERR] at
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
16:16:16,055 ERROR [STDERR] at
org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
16:16:16,055 ERROR [STDERR] at
org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
16:16:16,055 ERROR [STDERR] at
org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
16:16:16,055 ERROR [STDERR] at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
16:16:16,055 ERROR [STDERR] at
org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
16:16:16,055 ERROR [STDERR] at
org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
16:16:16,055 ERROR [STDERR] at
org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
16:16:16,055 ERROR [STDERR] at
org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
16:16:16,055 ERROR [STDERR] at
org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
16:16:16,055 ERROR [STDERR] at
org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
16:16:16,055 ERROR [STDERR] at
org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
16:16:16,055 ERROR [STDERR] at
org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3856)
16:16:16,055 ERROR [STDERR] at
org.apache.catalina.core.StandardContext.start(StandardContext.java:4361)
16:16:16,055 ERROR [STDERR] at
org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:790)
16:16:16,056 ERROR [STDERR] at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:770)
16:16:16,056 ERROR [STDERR] at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
16:16:16,056 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:16:16,056 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
16:16:16,056 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
16:16:16,056 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:597)
16:16:16,056 ERROR [STDERR] at
org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
16:16:16,056 ERROR [STDERR] at
org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
16:16:16,056 ERROR [STDERR] at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
16:16:16,056 ERROR [STDERR] at
org.apache.catalina.core.StandardContext.init(StandardContext.java:5312)
16:16:16,056 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:16:16,056 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
16:16:16,056 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
16:16:16,056 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:597)
16:16:16,056 ERROR [STDERR] at
org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
16:16:16,056 ERROR [STDERR] at
org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
16:16:16,057 ERROR [STDERR] at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
16:16:16,057 ERROR [STDERR] at
org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
16:16:16,057 ERROR [STDERR] at
org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
16:16:16,057 ERROR [STDERR] at
org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
16:16:16,057 ERROR [STDERR] at
org.jboss.web.WebModule.startModule(WebModule.java:83)
16:16:16,057 ERROR [STDERR] at
org.jboss.web.WebModule.startService(WebModule.java:61)
16:16:16,057 ERROR [STDERR] at
org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
16:16:16,057 ERROR [STDERR] at
org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
16:16:16,057 ERROR [STDERR] at
sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
16:16:16,057 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
16:16:16,057 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:597)
16:16:16,057 ERROR [STDERR] at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
16:16:16,057 ERROR [STDERR] at
org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
16:16:16,057 ERROR [STDERR] at
org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
16:16:16,057 ERROR [STDERR] at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
16:16:16,057 ERROR [STDERR] at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
16:16:16,058 ERROR [STDERR] at
org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
16:16:16,058 ERROR [STDERR] at $Proxy0.start(Unknown Source)
16:16:16,058 ERROR [STDERR] at
org.jboss.system.ServiceController.start(ServiceController.java:417)
16:16:16,058 ERROR [STDERR] at
sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
16:16:16,058 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
16:16:16,058 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:597)
16:16:16,058 ERROR [STDERR] at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
16:16:16,058 ERROR [STDERR] at
org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
16:16:16,058 ERROR [STDERR] at
org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
16:16:16,058 ERROR [STDERR] at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
16:16:16,058 ERROR [STDERR] at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
16:16:16,058 ERROR [STDERR] at
org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
16:16:16,069 ERROR [STDERR] at $Proxy44.start(Unknown Source)
16:16:16,069 ERROR [STDERR] at
org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
16:16:16,069 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
16:16:16,070 ERROR [STDERR] at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
16:16:16,070 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
16:16:16,070 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:597)
16:16:16,070 ERROR [STDERR] at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
16:16:16,070 ERROR [STDERR] at
org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
16:16:16,070 ERROR [STDERR] at
org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
16:16:16,070 ERROR [STDERR] at
org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
16:16:16,070 ERROR [STDERR] at
org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
16:16:16,070 ERROR [STDERR] at
org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
16:16:16,070 ERROR [STDERR] at
org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
16:16:16,070 ERROR [STDERR] at
org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
16:16:16,071 ERROR [STDERR] at
org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
16:16:16,071 ERROR [STDERR] at
org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
16:16:16,071 ERROR [STDERR] at
org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
16:16:16,071 ERROR [STDERR] at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
16:16:16,071 ERROR [STDERR] at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
16:16:16,071 ERROR [STDERR] at
org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
16:16:16,071 ERROR [STDERR] at $Proxy45.start(Unknown Source)
16:16:16,071 ERROR [STDERR] at
org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
16:16:16,071 ERROR [STDERR] at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
16:16:16,071 ERROR [STDERR] at
org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
16:16:16,072 ERROR [STDERR] at
sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
16:16:16,072 ERROR [STDERR] at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
16:16:16,072 ERROR [STDERR] at
java.lang.reflect.Method.invoke(Method.java:597)
16:16:16,072 ERROR [STDERR] at
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
16:16:16,072 ERROR [STDERR] at
org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
16:16:16,072 ERROR [STDERR] at
org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
16:16:16,072 ERROR [STDERR] at
org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
16:16:16,072 ERROR [STDERR] at
org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
16:16:16,072 ERROR [STDERR] at
org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
16:16:16,072 ERROR [STDERR] at
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
16:16:16,072 ERROR [STDERR] at
org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
16:16:16,073 ERROR [STDERR] at
org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
16:16:16,073 ERROR [STDERR] at $Proxy9.deploy(Unknown Source)
16:16:16,073 ERROR [STDERR] at
org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
16:16:16,073 ERROR [STDERR] at
org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
16:16:16,073 ERROR [STDERR] at
org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
16:16:16,073 ERROR [STDERR] at
org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
16:16:16,073 ERROR [STDERR] at
org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
16:16:16,093 INFO [STDOUT] new Seci being injected at LocatingResource:
1219432576053
16:16:16,097 INFO [ContextLoader] Root WebApplicationContext:
initialization completed in 533 ms
16:16:21,089 INFO [STDOUT] Instantiating LocatingResource: 1219432581089
16:16:21,098 ERROR [STDERR] java.lang.Exception
16:16:21,098 ERROR [STDERR] at
padauan.LocatingResource.<init>(LocatingResource.java:30)
16:16:21,098 ERROR [STDERR] at
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
16:16:21,098 ERROR [STDERR] at
sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
16:16:21,098 ERROR [STDERR] at
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
16:16:21,098 ERROR [STDERR] at
java.lang.reflect.Constructor.newInstance(Constructor.java:513)
16:16:21,098 ERROR [STDERR] at
org.resteasy.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:82)
16:16:21,099 ERROR [STDERR] at
org.resteasy.plugins.server.resourcefactory.POJOResourceFactory.createResource(POJOResourceFactory.java:38)
16:16:21,099 ERROR [STDERR] at
org.resteasy.ResourceMethod.invoke(ResourceMethod.java:133)
16:16:21,099 ERROR [STDERR] at
org.resteasy.Dispatcher.invoke(Dispatcher.java:161)
16:16:21,099 ERROR [STDERR] at
org.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:138)
16:16:21,099 ERROR [STDERR] at
org.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:77)
16:16:21,099 ERROR [STDERR] at
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
16:16:21,099 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
16:16:21,099 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
16:16:21,099 ERROR [STDERR] at
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
16:16:21,100 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
16:16:21,100 ERROR [STDERR] at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
16:16:21,100 ERROR [STDERR] at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
16:16:21,100 ERROR [STDERR] at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
16:16:21,100 ERROR [STDERR] at
org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
16:16:21,100 ERROR [STDERR] at
org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
16:16:21,100 ERROR [STDERR] at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
16:16:21,100 ERROR [STDERR] at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
16:16:21,100 ERROR [STDERR] at
org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
16:16:21,101 ERROR [STDERR] at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
16:16:21,101 ERROR [STDERR] at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
16:16:21,101 ERROR [STDERR] at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
16:16:21,101 ERROR [STDERR] at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
16:16:21,101 ERROR [STDERR] at
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
16:16:21,101 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
16:16:21,101 INFO [STDOUT] 'fabiopqp' URL begin called at
LocatingResource: 1219432581089
16:16:21,102 INFO [STDOUT] Injected Seci for this call: null
[]s,
On Fri, Aug 22, 2008 at 4:05 PM, Bill Burke <bb...@re...> wrote:
> Ok, that helps.
>
> Now, in the constructor add this:
>
> public MyResourceA()
> {
> new Exception.printStackTrace();
> ...the id printing...
> }
>
> This will tell us exactly who is instantiating the resource.
>
>
>
>
> Paulo Siqueira wrote:
>
>> MyResourceA should be a singleton right? Only instantiated once?
>>
>>
>> Yes and yes.
>>
>> I just can't see this as a Resteasy problem. Can you put in a
>> default constructor and see how many times an instance of
>> MyResourceA is instantiated? Another thing maybe could be to use
>> setter injection and log there to see how many times the setter is
>> call. A final thing, create some random ID per instance and print
>> it out to see if you have different instances.
>>
>>
>> Following your suggestions, here is an output we got:
>>
>> 15:33:34,597 INFO [STDOUT] Instantiating LocatingResource: 1219430014597
>> 15:33:34,616 INFO [STDOUT] new Seci being injected at LocatingResource:
>> 1219430014597
>> 15:33:34,619 INFO [ContextLoader] Root WebApplicationContext:
>> initialization completed in 506 ms
>>
>> 15:34:12,010 INFO [STDOUT] Instantiating LocatingResource: 1219430052010
>> 15:34:12,013 INFO [STDOUT] 'fabiopqp' URL begin called at
>> LocatingResource: 1219430052010
>> 15:34:12,013 INFO [STDOUT] Injected Seci for this call: null
>>
>> "LocatingResource" is the name of the Resteasy bean. Notice that it is
>> instantiated twice: one in the startup (first three outputs), and another
>> when a URL mapped to a method is called (last three outputs).
>>
>> Also, in the second time, the injector method is not called, and thus the
>> correspondent field is null.
>>
>> []s,
>>
>> --
>> Paulo R C Siqueira
>> SCJP / SCWCD
>> http://www.ipti.org.br
>> Contato: (11) 8149-5046
>>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
--
Paulo R C Siqueira
SCJP / SCWCD
http://www.ipti.org.br
Contato: (11) 8149-5046
|
|
From: Bill B. <bb...@re...> - 2008-08-22 20:02:55
|
I already asked this once, but I'll ask it again....
Do you have Restasy scanning turned OFF in web.xml? If you don't turn
it off. I think this is what your problem is.
Paulo Siqueira wrote:
> Ok, the result is bellow (I added blank lines to help find the second
> part). If I understood, the first time, the injection is made by spring,
> and the second time resteasy try to do something...
>
> Also, a bizzarre thing is that it worked once, and then the second time
> didn't print any exception (which makes sense since there were no new
> instances being created).
>
>
> 16:16:16,053 INFO [STDOUT] Instantiating LocatingResource: 1219432576053
> 16:16:16,053 ERROR [STDERR] java.lang.Exception
> 16:16:16,054 ERROR [STDERR] at
> padauan.LocatingResource.<init>(LocatingResource.java:30)
> 16:16:16,054 ERROR [STDERR] at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 16:16:16,054 ERROR [STDERR] at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> 16:16:16,054 ERROR [STDERR] at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> 16:16:16,054 ERROR [STDERR] at
> java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> 16:16:16,054 ERROR [STDERR] at
> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:96)
> 16:16:16,054 ERROR [STDERR] at
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
> 16:16:16,054 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:875)
> 16:16:16,054 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:837)
> 16:16:16,054 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
> 16:16:16,054 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> 16:16:16,054 ERROR [STDERR] at
> java.security.AccessController.doPrivileged(Native Method)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
> 16:16:16,055 ERROR [STDERR] at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3856)
> 16:16:16,055 ERROR [STDERR] at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4361)
> 16:16:16,055 ERROR [STDERR] at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:790)
> 16:16:16,056 ERROR [STDERR] at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:770)
> 16:16:16,056 ERROR [STDERR] at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
> 16:16:16,056 ERROR [STDERR] at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 16:16:16,056 ERROR [STDERR] at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 16:16:16,056 ERROR [STDERR] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 16:16:16,056 ERROR [STDERR] at
> java.lang.reflect.Method.invoke(Method.java:597)
> 16:16:16,056 ERROR [STDERR] at
> org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
> 16:16:16,056 ERROR [STDERR] at
> org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
> 16:16:16,056 ERROR [STDERR] at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
> 16:16:16,056 ERROR [STDERR] at
> org.apache.catalina.core.StandardContext.init(StandardContext.java:5312)
> 16:16:16,056 ERROR [STDERR] at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 16:16:16,056 ERROR [STDERR] at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 16:16:16,056 ERROR [STDERR] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 16:16:16,056 ERROR [STDERR] at
> java.lang.reflect.Method.invoke(Method.java:597)
> 16:16:16,056 ERROR [STDERR] at
> org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
> 16:16:16,056 ERROR [STDERR] at
> org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.web.WebModule.startModule(WebModule.java:83)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.web.WebModule.startService(WebModule.java:61)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
> 16:16:16,057 ERROR [STDERR] at
> sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
> 16:16:16,057 ERROR [STDERR] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 16:16:16,057 ERROR [STDERR] at
> java.lang.reflect.Method.invoke(Method.java:597)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
> 16:16:16,058 ERROR [STDERR] at $Proxy0.start(Unknown Source)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.system.ServiceController.start(ServiceController.java:417)
> 16:16:16,058 ERROR [STDERR] at
> sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
> 16:16:16,058 ERROR [STDERR] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 16:16:16,058 ERROR [STDERR] at
> java.lang.reflect.Method.invoke(Method.java:597)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
> 16:16:16,069 ERROR [STDERR] at $Proxy44.start(Unknown Source)
> 16:16:16,069 ERROR [STDERR] at
> org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
> 16:16:16,069 ERROR [STDERR] at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 16:16:16,070 ERROR [STDERR] at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 16:16:16,070 ERROR [STDERR] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 16:16:16,070 ERROR [STDERR] at
> java.lang.reflect.Method.invoke(Method.java:597)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
> 16:16:16,071 ERROR [STDERR] at $Proxy45.start(Unknown Source)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
> 16:16:16,072 ERROR [STDERR] at
> sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
> 16:16:16,072 ERROR [STDERR] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 16:16:16,072 ERROR [STDERR] at
> java.lang.reflect.Method.invoke(Method.java:597)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
> 16:16:16,073 ERROR [STDERR] at
> org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
> 16:16:16,073 ERROR [STDERR] at $Proxy9.deploy(Unknown Source)
> 16:16:16,073 ERROR [STDERR] at
> org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
> 16:16:16,073 ERROR [STDERR] at
> org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
> 16:16:16,073 ERROR [STDERR] at
> org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
> 16:16:16,073 ERROR [STDERR] at
> org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
> 16:16:16,073 ERROR [STDERR] at
> org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
> 16:16:16,093 INFO [STDOUT] new Seci being injected at LocatingResource:
> 1219432576053
> 16:16:16,097 INFO [ContextLoader] Root WebApplicationContext:
> initialization completed in 533 ms
>
>
>
> 16:16:21,089 INFO [STDOUT] Instantiating LocatingResource: 1219432581089
> 16:16:21,098 ERROR [STDERR] java.lang.Exception
> 16:16:21,098 ERROR [STDERR] at
> padauan.LocatingResource.<init>(LocatingResource.java:30)
> 16:16:21,098 ERROR [STDERR] at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
> 16:16:21,098 ERROR [STDERR] at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> 16:16:21,098 ERROR [STDERR] at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> 16:16:21,098 ERROR [STDERR] at
> java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> 16:16:21,098 ERROR [STDERR] at
> org.resteasy.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:82)
> 16:16:21,099 ERROR [STDERR] at
> org.resteasy.plugins.server.resourcefactory.POJOResourceFactory.createResource(POJOResourceFactory.java:38)
> 16:16:21,099 ERROR [STDERR] at
> org.resteasy.ResourceMethod.invoke(ResourceMethod.java:133)
> 16:16:21,099 ERROR [STDERR] at
> org.resteasy.Dispatcher.invoke(Dispatcher.java:161)
> 16:16:21,099 ERROR [STDERR] at
> org.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:138)
> 16:16:21,099 ERROR [STDERR] at
> org.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:77)
> 16:16:21,099 ERROR [STDERR] at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> 16:16:21,099 ERROR [STDERR] at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> 16:16:21,099 ERROR [STDERR] at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 16:16:21,099 ERROR [STDERR] at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> 16:16:21,100 ERROR [STDERR] at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 16:16:21,100 ERROR [STDERR] at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 16:16:21,100 ERROR [STDERR] at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
> 16:16:21,100 ERROR [STDERR] at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> 16:16:21,100 ERROR [STDERR] at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
> 16:16:21,100 ERROR [STDERR] at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
> 16:16:21,100 ERROR [STDERR] at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> 16:16:21,100 ERROR [STDERR] at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> 16:16:21,100 ERROR [STDERR] at
> org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
> 16:16:21,101 ERROR [STDERR] at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 16:16:21,101 ERROR [STDERR] at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
> 16:16:21,101 ERROR [STDERR] at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> 16:16:21,101 ERROR [STDERR] at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> 16:16:21,101 ERROR [STDERR] at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
> 16:16:21,101 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
> 16:16:21,101 INFO [STDOUT] 'fabiopqp' URL begin called at
> LocatingResource: 1219432581089
> 16:16:21,102 INFO [STDOUT] Injected Seci for this call: null
>
>
> []s,
>
>
> On Fri, Aug 22, 2008 at 4:05 PM, Bill Burke <bb...@re...
> <mailto:bb...@re...>> wrote:
>
> Ok, that helps.
>
> Now, in the constructor add this:
>
> public MyResourceA()
> {
> new Exception.printStackTrace();
> ...the id printing...
> }
>
> This will tell us exactly who is instantiating the resource.
>
>
>
>
> Paulo Siqueira wrote:
>
> MyResourceA should be a singleton right? Only instantiated once?
>
>
> Yes and yes.
>
> I just can't see this as a Resteasy problem. Can you put in a
> default constructor and see how many times an instance of
> MyResourceA is instantiated? Another thing maybe could be to use
> setter injection and log there to see how many times the
> setter is
> call. A final thing, create some random ID per instance and
> print
> it out to see if you have different instances.
>
>
> Following your suggestions, here is an output we got:
>
> 15:33:34,597 INFO [STDOUT] Instantiating LocatingResource:
> 1219430014597
> 15:33:34,616 INFO [STDOUT] new Seci being injected at
> LocatingResource: 1219430014597
> 15:33:34,619 INFO [ContextLoader] Root WebApplicationContext:
> initialization completed in 506 ms
>
> 15:34:12,010 INFO [STDOUT] Instantiating LocatingResource:
> 1219430052010
> 15:34:12,013 INFO [STDOUT] 'fabiopqp' URL begin called at
> LocatingResource: 1219430052010
> 15:34:12,013 INFO [STDOUT] Injected Seci for this call: null
>
> "LocatingResource" is the name of the Resteasy bean. Notice that
> it is instantiated twice: one in the startup (first three
> outputs), and another when a URL mapped to a method is called
> (last three outputs).
>
> Also, in the second time, the injector method is not called, and
> thus the correspondent field is null.
>
> []s,
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Paulo S. <pau...@gm...> - 2008-08-22 20:56:37
|
Yep, that seemed to be the problem... We will test more but now it looks
like it won't cause more headaches...
But what does it mean? That there were some kind of race between RestEasy
and Spring to inject the resource?
Also, if the scan is false, how are the resources detected? Is everything
left to Spring to handle?
anyway, thank you very much for your help!
[]s,
On Fri, Aug 22, 2008 at 5:02 PM, Bill Burke <bb...@re...> wrote:
> I already asked this once, but I'll ask it again....
>
> Do you have Restasy scanning turned OFF in web.xml? If you don't turn it
> off. I think this is what your problem is.
>
> Paulo Siqueira wrote:
>
>> Ok, the result is bellow (I added blank lines to help find the second
>> part). If I understood, the first time, the injection is made by spring, and
>> the second time resteasy try to do something...
>>
>> Also, a bizzarre thing is that it worked once, and then the second time
>> didn't print any exception (which makes sense since there were no new
>> instances being created).
>>
>>
>> 16:16:16,053 INFO [STDOUT] Instantiating LocatingResource: 1219432576053
>> 16:16:16,053 ERROR [STDERR] java.lang.Exception
>> 16:16:16,054 ERROR [STDERR] at
>> padauan.LocatingResource.<init>(LocatingResource.java:30)
>> 16:16:16,054 ERROR [STDERR] at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>> 16:16:16,054 ERROR [STDERR] at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>> 16:16:16,054 ERROR [STDERR] at
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>> 16:16:16,054 ERROR [STDERR] at
>> java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>> 16:16:16,054 ERROR [STDERR] at
>> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:96)
>> 16:16:16,054 ERROR [STDERR] at
>> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
>> 16:16:16,054 ERROR [STDERR] at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:875)
>> 16:16:16,054 ERROR [STDERR] at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:837)
>> 16:16:16,054 ERROR [STDERR] at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
>> 16:16:16,054 ERROR [STDERR] at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
>> 16:16:16,054 ERROR [STDERR] at
>> java.security.AccessController.doPrivileged(Native Method)
>> 16:16:16,055 ERROR [STDERR] at
>> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
>> 16:16:16,055 ERROR [STDERR] at
>> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
>> 16:16:16,055 ERROR [STDERR] at
>> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
>> 16:16:16,055 ERROR [STDERR] at
>> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
>> 16:16:16,055 ERROR [STDERR] at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
>> 16:16:16,055 ERROR [STDERR] at
>> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
>> 16:16:16,055 ERROR [STDERR] at
>> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
>> 16:16:16,055 ERROR [STDERR] at
>> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
>> 16:16:16,055 ERROR [STDERR] at
>> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
>> 16:16:16,055 ERROR [STDERR] at
>> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
>> 16:16:16,055 ERROR [STDERR] at
>> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
>> 16:16:16,055 ERROR [STDERR] at
>> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
>> 16:16:16,055 ERROR [STDERR] at
>> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3856)
>> 16:16:16,055 ERROR [STDERR] at
>> org.apache.catalina.core.StandardContext.start(StandardContext.java:4361)
>> 16:16:16,055 ERROR [STDERR] at
>> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:790)
>> 16:16:16,056 ERROR [STDERR] at
>> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:770)
>> 16:16:16,056 ERROR [STDERR] at
>> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
>> 16:16:16,056 ERROR [STDERR] at
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 16:16:16,056 ERROR [STDERR] at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> 16:16:16,056 ERROR [STDERR] at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> 16:16:16,056 ERROR [STDERR] at
>> java.lang.reflect.Method.invoke(Method.java:597)
>> 16:16:16,056 ERROR [STDERR] at
>> org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
>> 16:16:16,056 ERROR [STDERR] at
>> org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
>> 16:16:16,056 ERROR [STDERR] at
>> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>> 16:16:16,056 ERROR [STDERR] at
>> org.apache.catalina.core.StandardContext.init(StandardContext.java:5312)
>> 16:16:16,056 ERROR [STDERR] at
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 16:16:16,056 ERROR [STDERR] at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> 16:16:16,056 ERROR [STDERR] at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> 16:16:16,056 ERROR [STDERR] at
>> java.lang.reflect.Method.invoke(Method.java:597)
>> 16:16:16,056 ERROR [STDERR] at
>> org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
>> 16:16:16,056 ERROR [STDERR] at
>> org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
>> 16:16:16,057 ERROR [STDERR] at
>> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>> 16:16:16,057 ERROR [STDERR] at
>> org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
>> 16:16:16,057 ERROR [STDERR] at
>> org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
>> 16:16:16,057 ERROR [STDERR] at
>> org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
>> 16:16:16,057 ERROR [STDERR] at
>> org.jboss.web.WebModule.startModule(WebModule.java:83)
>> 16:16:16,057 ERROR [STDERR] at
>> org.jboss.web.WebModule.startService(WebModule.java:61)
>> 16:16:16,057 ERROR [STDERR] at
>> org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
>> 16:16:16,057 ERROR [STDERR] at
>> org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
>> 16:16:16,057 ERROR [STDERR] at
>> sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
>> 16:16:16,057 ERROR [STDERR] at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> 16:16:16,057 ERROR [STDERR] at
>> java.lang.reflect.Method.invoke(Method.java:597)
>> 16:16:16,057 ERROR [STDERR] at
>> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>> 16:16:16,057 ERROR [STDERR] at
>> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>> 16:16:16,057 ERROR [STDERR] at
>> org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
>> 16:16:16,057 ERROR [STDERR] at
>> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>> 16:16:16,057 ERROR [STDERR] at
>> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>> 16:16:16,058 ERROR [STDERR] at
>> org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
>> 16:16:16,058 ERROR [STDERR] at $Proxy0.start(Unknown Source)
>> 16:16:16,058 ERROR [STDERR] at
>> org.jboss.system.ServiceController.start(ServiceController.java:417)
>> 16:16:16,058 ERROR [STDERR] at
>> sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
>> 16:16:16,058 ERROR [STDERR] at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> 16:16:16,058 ERROR [STDERR] at
>> java.lang.reflect.Method.invoke(Method.java:597)
>> 16:16:16,058 ERROR [STDERR] at
>> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>> 16:16:16,058 ERROR [STDERR] at
>> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>> 16:16:16,058 ERROR [STDERR] at
>> org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
>> 16:16:16,058 ERROR [STDERR] at
>> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>> 16:16:16,058 ERROR [STDERR] at
>> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>> 16:16:16,058 ERROR [STDERR] at
>> org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
>> 16:16:16,069 ERROR [STDERR] at $Proxy44.start(Unknown Source)
>> 16:16:16,069 ERROR [STDERR] at
>> org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
>> 16:16:16,069 ERROR [STDERR] at
>> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> 16:16:16,070 ERROR [STDERR] at
>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
>> 16:16:16,070 ERROR [STDERR] at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> 16:16:16,070 ERROR [STDERR] at
>> java.lang.reflect.Method.invoke(Method.java:597)
>> 16:16:16,070 ERROR [STDERR] at
>> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>> 16:16:16,070 ERROR [STDERR] at
>> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>> 16:16:16,070 ERROR [STDERR] at
>> org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
>> 16:16:16,070 ERROR [STDERR] at
>> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>> 16:16:16,070 ERROR [STDERR] at
>> org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
>> 16:16:16,070 ERROR [STDERR] at
>> org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
>> 16:16:16,070 ERROR [STDERR] at
>> org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
>> 16:16:16,070 ERROR [STDERR] at
>> org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
>> 16:16:16,071 ERROR [STDERR] at
>> org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
>> 16:16:16,071 ERROR [STDERR] at
>> org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
>> 16:16:16,071 ERROR [STDERR] at
>> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>> 16:16:16,071 ERROR [STDERR] at
>> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>> 16:16:16,071 ERROR [STDERR] at
>> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>> 16:16:16,071 ERROR [STDERR] at
>> org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
>> 16:16:16,071 ERROR [STDERR] at $Proxy45.start(Unknown Source)
>> 16:16:16,071 ERROR [STDERR] at
>> org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
>> 16:16:16,071 ERROR [STDERR] at
>> org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
>> 16:16:16,071 ERROR [STDERR] at
>> org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
>> 16:16:16,072 ERROR [STDERR] at
>> sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
>> 16:16:16,072 ERROR [STDERR] at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
>> 16:16:16,072 ERROR [STDERR] at
>> java.lang.reflect.Method.invoke(Method.java:597)
>> 16:16:16,072 ERROR [STDERR] at
>> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
>> 16:16:16,072 ERROR [STDERR] at
>> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
>> 16:16:16,072 ERROR [STDERR] at
>> org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
>> 16:16:16,072 ERROR [STDERR] at
>> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>> 16:16:16,072 ERROR [STDERR] at
>> org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
>> 16:16:16,072 ERROR [STDERR] at
>> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
>> 16:16:16,072 ERROR [STDERR] at
>> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
>> 16:16:16,072 ERROR [STDERR] at
>> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
>> 16:16:16,073 ERROR [STDERR] at
>> org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
>> 16:16:16,073 ERROR [STDERR] at $Proxy9.deploy(Unknown Source)
>> 16:16:16,073 ERROR [STDERR] at
>> org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
>> 16:16:16,073 ERROR [STDERR] at
>> org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
>> 16:16:16,073 ERROR [STDERR] at
>> org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
>> 16:16:16,073 ERROR [STDERR] at
>> org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
>> 16:16:16,073 ERROR [STDERR] at
>> org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
>> 16:16:16,093 INFO [STDOUT] new Seci being injected at LocatingResource:
>> 1219432576053
>> 16:16:16,097 INFO [ContextLoader] Root WebApplicationContext:
>> initialization completed in 533 ms
>>
>>
>>
>> 16:16:21,089 INFO [STDOUT] Instantiating LocatingResource: 1219432581089
>> 16:16:21,098 ERROR [STDERR] java.lang.Exception
>> 16:16:21,098 ERROR [STDERR] at
>> padauan.LocatingResource.<init>(LocatingResource.java:30)
>> 16:16:21,098 ERROR [STDERR] at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>> 16:16:21,098 ERROR [STDERR] at
>> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
>> 16:16:21,098 ERROR [STDERR] at
>> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
>> 16:16:21,098 ERROR [STDERR] at
>> java.lang.reflect.Constructor.newInstance(Constructor.java:513)
>> 16:16:21,098 ERROR [STDERR] at
>> org.resteasy.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:82)
>> 16:16:21,099 ERROR [STDERR] at
>> org.resteasy.plugins.server.resourcefactory.POJOResourceFactory.createResource(POJOResourceFactory.java:38)
>> 16:16:21,099 ERROR [STDERR] at
>> org.resteasy.ResourceMethod.invoke(ResourceMethod.java:133)
>> 16:16:21,099 ERROR [STDERR] at
>> org.resteasy.Dispatcher.invoke(Dispatcher.java:161)
>> 16:16:21,099 ERROR [STDERR] at
>> org.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:138)
>> 16:16:21,099 ERROR [STDERR] at
>> org.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:77)
>> 16:16:21,099 ERROR [STDERR] at
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
>> 16:16:21,099 ERROR [STDERR] at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
>> 16:16:21,099 ERROR [STDERR] at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> 16:16:21,099 ERROR [STDERR] at
>> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
>> 16:16:21,100 ERROR [STDERR] at
>> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
>> 16:16:21,100 ERROR [STDERR] at
>> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
>> 16:16:21,100 ERROR [STDERR] at
>> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
>> 16:16:21,100 ERROR [STDERR] at
>> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
>> 16:16:21,100 ERROR [STDERR] at
>> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
>> 16:16:21,100 ERROR [STDERR] at
>> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
>> 16:16:21,100 ERROR [STDERR] at
>> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
>> 16:16:21,100 ERROR [STDERR] at
>> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
>> 16:16:21,100 ERROR [STDERR] at
>> org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
>> 16:16:21,101 ERROR [STDERR] at
>> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
>> 16:16:21,101 ERROR [STDERR] at
>> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
>> 16:16:21,101 ERROR [STDERR] at
>> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
>> 16:16:21,101 ERROR [STDERR] at
>> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
>> 16:16:21,101 ERROR [STDERR] at
>> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
>> 16:16:21,101 ERROR [STDERR] at java.lang.Thread.run(Thread.java:619)
>> 16:16:21,101 INFO [STDOUT] 'fabiopqp' URL begin called at
>> LocatingResource: 1219432581089
>> 16:16:21,102 INFO [STDOUT] Injected Seci for this call: null
>>
>>
>> []s,
>>
>>
>> On Fri, Aug 22, 2008 at 4:05 PM, Bill Burke <bb...@re... <mailto:
>> bb...@re...>> wrote:
>>
>> Ok, that helps.
>>
>> Now, in the constructor add this:
>>
>> public MyResourceA()
>> {
>> new Exception.printStackTrace();
>> ...the id printing...
>> }
>>
>> This will tell us exactly who is instantiating the resource.
>>
>>
>>
>>
>> Paulo Siqueira wrote:
>>
>> MyResourceA should be a singleton right? Only instantiated
>> once?
>>
>>
>> Yes and yes.
>> I just can't see this as a Resteasy problem. Can you
>> put in a
>> default constructor and see how many times an instance of
>> MyResourceA is instantiated? Another thing maybe could be to
>> use
>> setter injection and log there to see how many times the
>> setter is
>> call. A final thing, create some random ID per instance and
>> print
>> it out to see if you have different instances.
>>
>>
>> Following your suggestions, here is an output we got:
>>
>> 15:33:34,597 INFO [STDOUT] Instantiating LocatingResource:
>> 1219430014597
>> 15:33:34,616 INFO [STDOUT] new Seci being injected at
>> LocatingResource: 1219430014597
>> 15:33:34,619 INFO [ContextLoader] Root WebApplicationContext:
>> initialization completed in 506 ms
>>
>> 15:34:12,010 INFO [STDOUT] Instantiating LocatingResource:
>> 1219430052010
>> 15:34:12,013 INFO [STDOUT] 'fabiopqp' URL begin called at
>> LocatingResource: 1219430052010
>> 15:34:12,013 INFO [STDOUT] Injected Seci for this call: null
>>
>> "LocatingResource" is the name of the Resteasy bean. Notice that
>> it is instantiated twice: one in the startup (first three
>> outputs), and another when a URL mapped to a method is called
>> (last three outputs).
>>
>> Also, in the second time, the injector method is not called, and
>> thus the correspondent field is null.
>>
>> []s,
>>
>> -- Paulo R C Siqueira
>> SCJP / SCWCD
>> http://www.ipti.org.br
>> Contato: (11) 8149-5046
>>
>>
>> -- Bill Burke
>> JBoss, a division of Red Hat
>> http://bill.burkecentral.com
>>
>>
>>
>>
>> --
>> Paulo R C Siqueira
>> SCJP / SCWCD
>> http://www.ipti.org.br
>> Contato: (11) 8149-5046
>>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
--
Paulo R C Siqueira
SCJP / SCWCD
http://www.ipti.org.br
Contato: (11) 8149-5046
|
|
From: Bill B. <bb...@re...> - 2008-08-23 19:03:16
|
Paulo Siqueira wrote:
> Yep, that seemed to be the problem... We will test more but now it looks
> like it won't cause more headaches...
>
> But what does it mean? That there were some kind of race between
> RestEasy and Spring to inject the resource?
>
Since scanning is done first, that's the resource factory that is
registered first and picked first.
> Also, if the scan is false, how are the resources detected? Is
> everything left to Spring to handle?
>
Yes, everything is left to spring to handle. You can configure both
@Provider and @Path beans within spring too.
Also, if you just want to scan for @Providers, there's also
resteasy.scan.providers switch.
> anyway, thank you very much for your help!
>
> []s,
>
> On Fri, Aug 22, 2008 at 5:02 PM, Bill Burke <bb...@re...
> <mailto:bb...@re...>> wrote:
>
> I already asked this once, but I'll ask it again....
>
> Do you have Restasy scanning turned OFF in web.xml? If you don't
> turn it off. I think this is what your problem is.
>
> Paulo Siqueira wrote:
>
> Ok, the result is bellow (I added blank lines to help find the
> second part). If I understood, the first time, the injection is
> made by spring, and the second time resteasy try to do something...
>
> Also, a bizzarre thing is that it worked once, and then the
> second time didn't print any exception (which makes sense since
> there were no new instances being created).
>
>
> 16:16:16,053 INFO [STDOUT] Instantiating LocatingResource:
> 1219432576053
> 16:16:16,053 ERROR [STDERR] java.lang.Exception
> 16:16:16,054 ERROR [STDERR] at
> padauan.LocatingResource.<init>(LocatingResource.java:30)
> 16:16:16,054 ERROR [STDERR] at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> 16:16:16,054 ERROR [STDERR] at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> 16:16:16,054 ERROR [STDERR] at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> 16:16:16,054 ERROR [STDERR] at
> java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> 16:16:16,054 ERROR [STDERR] at
> org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:96)
> 16:16:16,054 ERROR [STDERR] at
> org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:61)
> 16:16:16,054 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:875)
> 16:16:16,054 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:837)
> 16:16:16,054 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:440)
> 16:16:16,054 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
> 16:16:16,054 ERROR [STDERR] at
> java.security.AccessController.doPrivileged(Native Method)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:220)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:429)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:381)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
> 16:16:16,055 ERROR [STDERR] at
> org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
> 16:16:16,055 ERROR [STDERR] at
> org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3856)
> 16:16:16,055 ERROR [STDERR] at
> org.apache.catalina.core.StandardContext.start(StandardContext.java:4361)
> 16:16:16,055 ERROR [STDERR] at
> org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:790)
> 16:16:16,056 ERROR [STDERR] at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:770)
> 16:16:16,056 ERROR [STDERR] at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:553)
> 16:16:16,056 ERROR [STDERR] at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 16:16:16,056 ERROR [STDERR] at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 16:16:16,056 ERROR [STDERR] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 16:16:16,056 ERROR [STDERR] at
> java.lang.reflect.Method.invoke(Method.java:597)
> 16:16:16,056 ERROR [STDERR] at
> org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
> 16:16:16,056 ERROR [STDERR] at
> org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
> 16:16:16,056 ERROR [STDERR] at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
> 16:16:16,056 ERROR [STDERR] at
> org.apache.catalina.core.StandardContext.init(StandardContext.java:5312)
> 16:16:16,056 ERROR [STDERR] at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 16:16:16,056 ERROR [STDERR] at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 16:16:16,056 ERROR [STDERR] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 16:16:16,056 ERROR [STDERR] at
> java.lang.reflect.Method.invoke(Method.java:597)
> 16:16:16,056 ERROR [STDERR] at
> org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:296)
> 16:16:16,056 ERROR [STDERR] at
> org.jboss.mx.server.RawDynamicInvoker.invoke(RawDynamicInvoker.java:164)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.web.tomcat.service.TomcatDeployer.performDeployInternal(TomcatDeployer.java:301)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.web.tomcat.service.TomcatDeployer.performDeploy(TomcatDeployer.java:104)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.web.AbstractWebDeployer.start(AbstractWebDeployer.java:375)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.web.WebModule.startModule(WebModule.java:83)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.web.WebModule.startService(WebModule.java:61)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.system.ServiceMBeanSupport.jbossInternalStart(ServiceMBeanSupport.java:289)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.system.ServiceMBeanSupport.jbossInternalLifecycle(ServiceMBeanSupport.java:245)
> 16:16:16,057 ERROR [STDERR] at
> sun.reflect.GeneratedMethodAccessor3.invoke(Unknown Source)
> 16:16:16,057 ERROR [STDERR] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 16:16:16,057 ERROR [STDERR] at
> java.lang.reflect.Method.invoke(Method.java:597)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
> 16:16:16,057 ERROR [STDERR] at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.system.ServiceController$ServiceProxy.invoke(ServiceController.java:978)
> 16:16:16,058 ERROR [STDERR] at $Proxy0.start(Unknown Source)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.system.ServiceController.start(ServiceController.java:417)
> 16:16:16,058 ERROR [STDERR] at
> sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)
> 16:16:16,058 ERROR [STDERR] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 16:16:16,058 ERROR [STDERR] at
> java.lang.reflect.Method.invoke(Method.java:597)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:86)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
> 16:16:16,058 ERROR [STDERR] at
> org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
> 16:16:16,069 ERROR [STDERR] at $Proxy44.start(Unknown Source)
> 16:16:16,069 ERROR [STDERR] at
> org.jboss.web.AbstractWebContainer.start(AbstractWebContainer.java:466)
> 16:16:16,069 ERROR [STDERR] at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> 16:16:16,070 ERROR [STDERR] at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> 16:16:16,070 ERROR [STDERR] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 16:16:16,070 ERROR [STDERR] at
> java.lang.reflect.Method.invoke(Method.java:597)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.mx.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:97)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.system.InterceptorServiceMBeanSupport.invokeNext(InterceptorServiceMBeanSupport.java:238)
> 16:16:16,070 ERROR [STDERR] at
> org.jboss.wsf.container.jboss42.DeployerInterceptor.start(DeployerInterceptor.java:87)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.deployment.SubDeployerInterceptorSupport$XMBeanInterceptor.start(SubDeployerInterceptorSupport.java:188)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.deployment.SubDeployerInterceptor.invoke(SubDeployerInterceptor.java:95)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
> 16:16:16,071 ERROR [STDERR] at $Proxy45.start(Unknown Source)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.deployment.MainDeployer.start(MainDeployer.java:1025)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:819)
> 16:16:16,071 ERROR [STDERR] at
> org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:782)
> 16:16:16,072 ERROR [STDERR] at
> sun.reflect.GeneratedMethodAccessor21.invoke(Unknown Source)
> 16:16:16,072 ERROR [STDERR] at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> 16:16:16,072 ERROR [STDERR] at
> java.lang.reflect.Method.invoke(Method.java:597)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:155)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.dispatch(Invocation.java:94)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:133)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:142)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
> 16:16:16,072 ERROR [STDERR] at
> org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:659)
> 16:16:16,073 ERROR [STDERR] at
> org.jboss.mx.util.MBeanProxyExt.invoke(MBeanProxyExt.java:210)
> 16:16:16,073 ERROR [STDERR] at $Proxy9.deploy(Unknown Source)
> 16:16:16,073 ERROR [STDERR] at
> org.jboss.deployment.scanner.URLDeploymentScanner.deploy(URLDeploymentScanner.java:421)
> 16:16:16,073 ERROR [STDERR] at
> org.jboss.deployment.scanner.URLDeploymentScanner.scan(URLDeploymentScanner.java:610)
> 16:16:16,073 ERROR [STDERR] at
> org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.doScan(AbstractDeploymentScanner.java:263)
> 16:16:16,073 ERROR [STDERR] at
> org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.loop(AbstractDeploymentScanner.java:274)
> 16:16:16,073 ERROR [STDERR] at
> org.jboss.deployment.scanner.AbstractDeploymentScanner$ScannerThread.run(AbstractDeploymentScanner.java:225)
> 16:16:16,093 INFO [STDOUT] new Seci being injected at
> LocatingResource: 1219432576053
> 16:16:16,097 INFO [ContextLoader] Root WebApplicationContext:
> initialization completed in 533 ms
>
>
>
> 16:16:21,089 INFO [STDOUT] Instantiating LocatingResource:
> 1219432581089
> 16:16:21,098 ERROR [STDERR] java.lang.Exception
> 16:16:21,098 ERROR [STDERR] at
> padauan.LocatingResource.<init>(LocatingResource.java:30)
> 16:16:21,098 ERROR [STDERR] at
> sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native
> Method)
> 16:16:21,098 ERROR [STDERR] at
> sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
> 16:16:21,098 ERROR [STDERR] at
> sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
> 16:16:21,098 ERROR [STDERR] at
> java.lang.reflect.Constructor.newInstance(Constructor.java:513)
> 16:16:21,098 ERROR [STDERR] at
> org.resteasy.ConstructorInjectorImpl.construct(ConstructorInjectorImpl.java:82)
> 16:16:21,099 ERROR [STDERR] at
> org.resteasy.plugins.server.resourcefactory.POJOResourceFactory.createResource(POJOResourceFactory.java:38)
> 16:16:21,099 ERROR [STDERR] at
> org.resteasy.ResourceMethod.invoke(ResourceMethod.java:133)
> 16:16:21,099 ERROR [STDERR] at
> org.resteasy.Dispatcher.invoke(Dispatcher.java:161)
> 16:16:21,099 ERROR [STDERR] at
> org.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:138)
> 16:16:21,099 ERROR [STDERR] at
> org.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:77)
> 16:16:21,099 ERROR [STDERR] at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
> 16:16:21,099 ERROR [STDERR] at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
> 16:16:21,099 ERROR [STDERR] at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 16:16:21,099 ERROR [STDERR] at
> org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
> 16:16:21,100 ERROR [STDERR] at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
> 16:16:21,100 ERROR [STDERR] at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
> 16:16:21,100 ERROR [STDERR] at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
> 16:16:21,100 ERROR [STDERR] at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
> 16:16:21,100 ERROR [STDERR] at
> org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:182)
> 16:16:21,100 ERROR [STDERR] at
> org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
> 16:16:21,100 ERROR [STDERR] at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
> 16:16:21,100 ERROR [STDERR] at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
> 16:16:21,100 ERROR [STDERR] at
> org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
> 16:16:21,101 ERROR [STDERR] at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
> 16:16:21,101 ERROR [STDERR] at
> org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
> 16:16:21,101 ERROR [STDERR] at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
> 16:16:21,101 ERROR [STDERR] at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
> 16:16:21,101 ERROR [STDERR] at
> org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
> 16:16:21,101 ERROR [STDERR] at
> java.lang.Thread.run(Thread.java:619)
> 16:16:21,101 INFO [STDOUT] 'fabiopqp' URL begin called at
> LocatingResource: 1219432581089
> 16:16:21,102 INFO [STDOUT] Injected Seci for this call: null
>
>
> []s,
>
>
> On Fri, Aug 22, 2008 at 4:05 PM, Bill Burke <bb...@re...
> <mailto:bb...@re...> <mailto:bb...@re...
> <mailto:bb...@re...>>> wrote:
>
> Ok, that helps.
>
> Now, in the constructor add this:
>
> public MyResourceA()
> {
> new Exception.printStackTrace();
> ...the id printing...
> }
>
> This will tell us exactly who is instantiating the resource.
>
>
>
>
> Paulo Siqueira wrote:
>
> MyResourceA should be a singleton right? Only
> instantiated once?
>
>
> Yes and yes.
> I just can't see this as a Resteasy problem.
> Can you put in a
> default constructor and see how many times an instance of
> MyResourceA is instantiated? Another thing maybe
> could be to use
> setter injection and log there to see how many times the
> setter is
> call. A final thing, create some random ID per
> instance and
> print
> it out to see if you have different instances.
>
>
> Following your suggestions, here is an output we got:
>
> 15:33:34,597 INFO [STDOUT] Instantiating LocatingResource:
> 1219430014597
> 15:33:34,616 INFO [STDOUT] new Seci being injected at
> LocatingResource: 1219430014597
> 15:33:34,619 INFO [ContextLoader] Root
> WebApplicationContext:
> initialization completed in 506 ms
>
> 15:34:12,010 INFO [STDOUT] Instantiating LocatingResource:
> 1219430052010
> 15:34:12,013 INFO [STDOUT] 'fabiopqp' URL begin called at
> LocatingResource: 1219430052010
> 15:34:12,013 INFO [STDOUT] Injected Seci for this call: null
>
> "LocatingResource" is the name of the Resteasy bean.
> Notice that
> it is instantiated twice: one in the startup (first three
> outputs), and another when a URL mapped to a method is called
> (last three outputs).
>
> Also, in the second time, the injector method is not
> called, and
> thus the correspondent field is null.
>
> []s,
>
> -- Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
>
> -- Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
>
>
> --
> Bill Burke
> JBoss, a division of Red Hat
> http://bill.burkecentral.com
>
>
>
>
> --
> Paulo R C Siqueira
> SCJP / SCWCD
> http://www.ipti.org.br
> Contato: (11) 8149-5046
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|