You can subscribe to this list here.
| 2008 |
Jan
|
Feb
|
Mar
(16) |
Apr
(18) |
May
(13) |
Jun
(100) |
Jul
(165) |
Aug
(53) |
Sep
(41) |
Oct
(84) |
Nov
(113) |
Dec
(171) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 |
Jan
(84) |
Feb
(30) |
Mar
(75) |
Apr
(113) |
May
(87) |
Jun
(96) |
Jul
(127) |
Aug
(106) |
Sep
(191) |
Oct
(142) |
Nov
(106) |
Dec
(83) |
| 2010 |
Jan
(62) |
Feb
(93) |
Mar
(92) |
Apr
(58) |
May
(52) |
Jun
(104) |
Jul
(109) |
Aug
(94) |
Sep
(75) |
Oct
(54) |
Nov
(65) |
Dec
(38) |
| 2011 |
Jan
(53) |
Feb
(84) |
Mar
(95) |
Apr
(24) |
May
(10) |
Jun
(49) |
Jul
(74) |
Aug
(23) |
Sep
(67) |
Oct
(21) |
Nov
(62) |
Dec
(50) |
| 2012 |
Jan
(26) |
Feb
(7) |
Mar
(9) |
Apr
(5) |
May
(13) |
Jun
(7) |
Jul
(18) |
Aug
(48) |
Sep
(58) |
Oct
(79) |
Nov
(19) |
Dec
(15) |
| 2013 |
Jan
(33) |
Feb
(21) |
Mar
(10) |
Apr
(22) |
May
(39) |
Jun
(31) |
Jul
(15) |
Aug
(6) |
Sep
(8) |
Oct
(1) |
Nov
(4) |
Dec
(3) |
| 2014 |
Jan
(17) |
Feb
(18) |
Mar
(15) |
Apr
(12) |
May
(11) |
Jun
(3) |
Jul
(10) |
Aug
(2) |
Sep
(3) |
Oct
(4) |
Nov
(4) |
Dec
(1) |
| 2015 |
Jan
|
Feb
(6) |
Mar
(5) |
Apr
(13) |
May
(2) |
Jun
(3) |
Jul
(1) |
Aug
(2) |
Sep
(6) |
Oct
(12) |
Nov
(12) |
Dec
(12) |
| 2016 |
Jan
(10) |
Feb
(3) |
Mar
(8) |
Apr
(4) |
May
(2) |
Jun
(1) |
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(1) |
Nov
|
Dec
|
| 2017 |
Jan
(6) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2019 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
|
|
From: Bill B. <bb...@re...> - 2008-08-27 13:38:45
|
Ok, try it now. The test assumes that String.hashCode() returns the same value on all JDKs. I'm not sure you can rely on that... Michael Brackx wrote: > Hi, > > > Actually, it builds fine for me. Did you check out full trunk? If > so, then no, it will not build as full trunk has a lot of old code. > > Check out as follows: > > svn co > https://resteasy.svn.sourceforge.net/svnroot/resteasy/trunk/jaxrs > resteasy-jaxrs > > > Yes, that is the trunk i was using. > Perhaps i should be more specific: i can build, but the tests are failing. > mvn -Dmaven.test.skip=true package => BUILD SUCCESSFUL > mvn package => BUILD FAILURE > > After "fixing my environment" (e.g. not having anything run on port > 8081) i now have one failure: > org.jboss.resteasy.test.providers.yaml.TestYamlProvider > > ------------------------------------------------------------------------------- > Test set: org.jboss.resteasy.test.providers.yaml.TestYamlProvider > ------------------------------------------------------------------------------- > Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.125 > sec <<< FAILURE! > testGet(org.jboss.resteasy.test.providers.yaml.TestYamlProvider) Time > elapsed: 0.015 sec <<< FAILURE! > junit.framework.AssertionFailedError: --- > !org.jboss.resteasy.test.providers.yaml.MyObject > date: !java.util.Date "123456789" > nested: !org.jboss.resteasy.test.providers.yaml.MyNestedObject > moreText: This is some more sample text > someText: This is some sample text > expected:<-797533417> but was:<1512627500> > at junit.framework.Assert.fail(Assert.java:47) > at junit.framework.Assert.failNotEquals(Assert.java:277) > at junit.framework.Assert.assertEquals(Assert.java:64) > at junit.framework.Assert.assertEquals(Assert.java:195) > at > org.jboss.resteasy.test.providers.yaml.TestYamlProvider.testGet(TestYamlProvider.java:47) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at > org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99) > at > org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81) > at > org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) > at > org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75) > at > org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45) > at > org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71) > at > org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35) > at > org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42) > at > org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) > at > org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52) > at > org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) > at > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) > at > org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) > at org.apache.maven.surefire.Surefire.run(Surefire.java:177) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:585) > at > org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:334) > at > org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:980) > > > > Michael Brackx -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Michael B. <mic...@gm...> - 2008-08-27 12:21:19
|
Hi, > Actually, it builds fine for me. Did you check out full trunk? If so, > then no, it will not build as full trunk has a lot of old code. > > Check out as follows: > > svn co https://resteasy.svn.sourceforge.net/svnroot/resteasy/trunk/jaxrsresteasy-jaxrs > Yes, that is the trunk i was using. Perhaps i should be more specific: i can build, but the tests are failing. mvn -Dmaven.test.skip=true package => BUILD SUCCESSFUL mvn package => BUILD FAILURE After "fixing my environment" (e.g. not having anything run on port 8081) i now have one failure: org.jboss.resteasy.test.providers.yaml.TestYamlProvider ------------------------------------------------------------------------------- Test set: org.jboss.resteasy.test.providers.yaml.TestYamlProvider ------------------------------------------------------------------------------- Tests run: 3, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.125 sec <<< FAILURE! testGet(org.jboss.resteasy.test.providers.yaml.TestYamlProvider) Time elapsed: 0.015 sec <<< FAILURE! junit.framework.AssertionFailedError: --- !org.jboss.resteasy.test.providers.yaml.MyObject date: !java.util.Date "123456789" nested: !org.jboss.resteasy.test.providers.yaml.MyNestedObject moreText: This is some more sample text someText: This is some sample text expected:<-797533417> but was:<1512627500> at junit.framework.Assert.fail(Assert.java:47) at junit.framework.Assert.failNotEquals(Assert.java:277) at junit.framework.Assert.assertEquals(Assert.java:64) at junit.framework.Assert.assertEquals(Assert.java:195) at org.jboss.resteasy.test.providers.yaml.TestYamlProvider.testGet(TestYamlProvider.java:47) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.junit.internal.runners.TestMethodRunner.executeMethodBody(TestMethodRunner.java:99) at org.junit.internal.runners.TestMethodRunner.runUnprotected(TestMethodRunner.java:81) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestMethodRunner.runMethod(TestMethodRunner.java:75) at org.junit.internal.runners.TestMethodRunner.run(TestMethodRunner.java:45) at org.junit.internal.runners.TestClassMethodsRunner.invokeTestMethod(TestClassMethodsRunner.java:71) at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:35) at org.junit.internal.runners.TestClassRunner$1.runUnprotected(TestClassRunner.java:42) at org.junit.internal.runners.BeforeAndAfterRunner.runProtected(BeforeAndAfterRunner.java:34) at org.junit.internal.runners.TestClassRunner.run(TestClassRunner.java:52) at org.apache.maven.surefire.junit4.JUnit4TestSet.execute(JUnit4TestSet.java:62) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.executeTestSet(AbstractDirectoryTestSuite.java:140) at org.apache.maven.surefire.suite.AbstractDirectoryTestSuite.execute(AbstractDirectoryTestSuite.java:127) at org.apache.maven.surefire.Surefire.run(Surefire.java:177) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.apache.maven.surefire.booter.SurefireBooter.runSuitesInProcess(SurefireBooter.java:334) at org.apache.maven.surefire.booter.SurefireBooter.main(SurefireBooter.java:980) Michael Brackx |
|
From: Bill B. <bb...@re...> - 2008-08-27 11:50:42
|
Bill Burke wrote: > > > Michael Brackx wrote: >> Hi, >> >> Any idea when beta 6 will be released? >> (in jira it is set for last week) >> > > I am slating a beta 6 release for next week to go in conjunction with my > next dzone article. > >> How stable/usable is the trunk? >> (currently (rev 298) the build fails) >> > > Whoah! the build shouldn't fail and it should be stable...I'll get this > fixed in about a couple of hours. Maybe I forgot to check something > in... FYI, we're usually good about having a stable trunk. > Actually, it builds fine for me. Did you check out full trunk? If so, then no, it will not build as full trunk has a lot of old code. Check out as follows: svn co https://resteasy.svn.sourceforge.net/svnroot/resteasy/trunk/jaxrs resteasy-jaxrs Notice the *jaxrs* at the end. Bill -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Bill B. <bb...@re...> - 2008-08-27 11:42:04
|
Michael Brackx wrote: > Hi, > > Any idea when beta 6 will be released? > (in jira it is set for last week) > I am slating a beta 6 release for next week to go in conjunction with my next dzone article. > How stable/usable is the trunk? > (currently (rev 298) the build fails) > Whoah! the build shouldn't fail and it should be stable...I'll get this fixed in about a couple of hours. Maybe I forgot to check something in... FYI, we're usually good about having a stable trunk. > Or would you recommend using beta 5? > (but no JSR311 api 0.9 then) > We're up to 0.10 of spec revision in trunk. Use trunk. I'll get it building sometime before 11am EST today. -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Michael B. <mic...@gm...> - 2008-08-26 15:42:54
|
Hi, Any idea when beta 6 will be released? (in jira it is set for last week) How stable/usable is the trunk? (currently (rev 298) the build fails) Or would you recommend using beta 5? (but no JSR311 api 0.9 then) Michael |
|
From: Bill B. <bb...@re...> - 2008-08-25 21:54:37
|
1) Do you have @Path on your class file? You must have at least
@Path("/") to identify the class as a root resource. Otherwise it gets
ignored.
2) Do you see any stack traces on the server that would help me debug
the problem?
3) Do you have any filters/valves that read the input stream or call
HttpServletRequest.getParameter()? This would screw up the input stream
and Resteasy would not be able to read in the map
4) Any way you could mail me a small test case that reproduces the problem?
5) Can I see your web.xml?
Pranav Parikh wrote:
> Hi,
>
> Thanks a ton for the advice. I upgraded to the version Beta 5. But this
> time, I ran into a new problem. On submitting the form,control never
> goes into the method. It throws the HTTP 404 error "The requested
> resource () is not available".
>
> My code is as follows:
>
> @POST
> @Path("/submitform")
> @ProduceMime("text/plain")
> public String submitForm(MultivaluedMap<String,String> form){
>
> logger.info <http://logger.info>("In submitform "+form);
> return "Submit form called"; // just checking to see if the
> control goes in
>
> }
>
> It will be a great help if you can suggest something about this.
>
>
> Thanks & Regards,
> Pranav
>
>
>
> On Thu, Aug 14, 2008 at 9:05 PM, Bill Burke <bb...@re...
> <mailto:bb...@re...>> wrote:
>
> I've implemented a simple test injecting HttpServletRequest using
> Resteasy Beta 5. I can't reproduce your problem and it works fine
> for me so I don't know what to tell you. Are you using Beta 5?
>
>
> FYI A better way to do this would be:
>
> @ConsumeMime("application/x-www-form-urlencoded")
> public String submitForm(MultivaluedMap<String, String> form) {
> ...
> }
>
> You don't need the @ConsumeMime unless your resource can have
> different data formats posted to it other than form.
>
>
>
>
>
> Pranav Parikh wrote:
>
> Hi,
>
> I'm a beginner in REST.I dont know if this is a right place to
> post this message but I could not find any other place so
> posting it here.
>
> I'm implementing RESTful Web services for my application. I'm
> facing a few problems when submitting the HTML form using the
> HTTP POST method. I'm not able to retrieve the form parameters I
> submit using the POST method. The "request" object is always null.
>
> My servlet code is as follows
>
> import javax.servlet.http.HttpServletRequest;
> import javax.ws.rs.POST;
> import javax.ws.rs.Path;
> import javax.ws.rs.ProduceMime;
> import javax.ws.rs.core.Context;
>
> @POST
> @Path("/submitform")
> @ProduceMime("text/plain")
> public String submitForm(@Context HttpServletRequest request){
> logger.info <http://logger.info>
> <http://logger.info>("In submitform"+request);
>
> if(request!=null){ // the control never goes inside if
> String name = request.getParameter("name");
> String surname = request.getParameter("surname");
> logger.info <http://logger.info>
> <http://logger.info>("Name::"+name+",Surname::"+surname);
>
> return "Name::"+name+",Surname::"+surname;
> }
> return "request is null"; // This gets returned always
> }
>
> My HTML looks like
>
> <html>
> <title>A Test Page
> </title>
> <form method="post" name="form1"
> action="https://localhost:8443/rest/submitform/">
> <table>
> <tr>
> <td>Name::
> </td>
> <td>
> <input type=text name="name" value="">
> </td>
> </tr>
> <tr>
> <td>Surname::
> </td>
> <td>
> <input type=text name="surname" value="">
> </td>
> </tr>
> <tr>
> <td align=center colspan=2>
> <input type=submit name="submit" value="submit">
> </td> </tr>
> </table>
> </form>
> </html>
>
> Any kind help will be appreciated.
>
> Thanks,
> Pranav Parikh
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> 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
>
>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
|
|
From: Bill B. <bb...@re...> - 2008-08-25 13:51:22
|
You are right, i've added a jira task for this: https://jira.jboss.org/jira/browse/RESTEASY-111 Christian Sadilek wrote: > Hi, > > I just tried to call OPTIONS on a Resource and always get a "405 Method > not allowed". Should it work already using beta5? Also I could not find > @OPTIONS in javax.ws.rs as described in > http://wiki.jboss.org/wiki/UsingPathAndGETPOSTEtc. > > From the spec I get 3.3.5: > On receipt of an OPTIONS request an implementation MUST either: > 1. Call a method annotated with a request method designator for OPTIONS > or, if none present, > 2. Generate an automatic response using the metadata provided by the > JAX-RS annotations on the matching class and its methods. > > Is this still to be implemented or has there be any change in plan? I > think if no @OPTIONS is present RESTeasy should at least return the > Allow header. It might also make sense to annotate a resource method > with @OPTIONS to provide a custom response maybe a machine readable > description, but I am not sure about this. > > A while ago I also promised some more feedback on the client framework. > I can only say that I didn't have any problems and everything worked > fine for me. > I'm thinking of adding a client cache that can work with Cache-Control headers (like your browser). Bill -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com |
|
From: Christian S. <chr...@gm...> - 2008-08-25 12:24:11
|
Hi, I just tried to call OPTIONS on a Resource and always get a "405 Method not allowed". Should it work already using beta5? Also I could not find @OPTIONS in javax.ws.rs as described in http://wiki.jboss.org/wiki/UsingPathAndGETPOSTEtc. >From the spec I get 3.3.5: On receipt of an OPTIONS request an implementation MUST either: 1. Call a method annotated with a request method designator for OPTIONS or, if none present, 2. Generate an automatic response using the metadata provided by the JAX-RS annotations on the matching class and its methods. Is this still to be implemented or has there be any change in plan? I think if no @OPTIONS is present RESTeasy should at least return the Allow header. It might also make sense to annotate a resource method with @OPTIONS to provide a custom response maybe a machine readable description, but I am not sure about this. A while ago I also promised some more feedback on the client framework. I can only say that I didn't have any problems and everything worked fine for me. Thanks! Christian |
|
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
|
|
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-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 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 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 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 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 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: 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-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-21 00:28:39
|
Christian Bauer wrote: > On Aug 20, 2008, at 02:23 , Bill Burke wrote: > >> What I think I'm going to do is let exceptions perculate up to the >> dispatcher and write a method to handle all exceptions. Seam can >> then just override the method that does exception handling at the >> dispatcher level. > > That's the same then as writing an ExceptionMapper right now, for Seam > integration. That's why I wrote that I need it to bubble OUT of the > dispatcher. > Its not the same because I need certain contextual data set (and eventually cleaned) for MessageBodyWriters to work. Also, WebApplicationException throws a wrench in things as well as it contains a Response that could be marshalled by MessageBodyWriters. Finally, MessageBodyWriters themselves can throw WebApplicationException. As long as the request isn't committed, I have to try and write out that response. All the above logic is not encapsulatable very well within an SPI. Which is why I want dispatcher to be self-contained and not have anything "bubble OUT". >> I also will pull Response writing into dispatcher as well as both >> resources, providers, and ExceptionMappers can throw >> WebApplicationException which has its own Response. > > Out of dispatcher please. > See above. There is a non-trivial amount of logic for response handling. So, if you don't like dispatcher the way it turns out, feel free to write your own dispatcher. I have my own requirements and schedule to deal with. -- 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-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: Christian B. <chr...@gm...> - 2008-08-20 05:35:04
|
On Aug 20, 2008, at 02:23 , Bill Burke wrote: > What I think I'm going to do is let exceptions perculate up to the > dispatcher and write a method to handle all exceptions. Seam can > then just override the method that does exception handling at the > dispatcher level. That's the same then as writing an ExceptionMapper right now, for Seam integration. That's why I wrote that I need it to bubble OUT of the dispatcher. > Also, I'll have 4 types of exceptions each defined as a separate > exception class: > > * PreprocessingFailure - target resource method wasn't invoked (but > Sublocators may have been invoked). > * PostprocessingFailure - failed on marshalling response > * UserException - just like InvocationTargetException, a user > exception was thrown. If you need this internally, at least don't bother your users with it. For users they are all the same. This kind of wrapping is what makes people hat the JSF RI. > I also will pull Response writing into dispatcher as well as both > resources, providers, and ExceptionMappers can throw > WebApplicationException which has its own Response. Out of dispatcher please. |
|
From: Bill B. <bb...@re...> - 2008-08-20 00:23:29
|
What I think I'm going to do is let exceptions perculate up to the
dispatcher and write a method to handle all exceptions. Seam can then
just override the method that does exception handling at the dispatcher
level.
Also, I'll have 4 types of exceptions each defined as a separate
exception class:
* PreprocessingFailure - target resource method wasn't invoked (but
Sublocators may have been invoked).
* PostprocessingFailure - failed on marshalling response
* UserException - just like InvocationTargetException, a user exception
was thrown.
I also will pull Response writing into dispatcher as well as both
resources, providers, and ExceptionMappers can throw
WebApplicationException which has its own Response.
Ryan J.McDonough wrote:
> Christian,
>
> I'll take a look at these once I wrap up the JAXB/JSON changes which I
> hope to complete this week.
>
> Ryan-
>
> On Aug 15, 2008, at 1:42 AM, Christian Bauer wrote:
>
>>> Probably the best solution would be to implement ExceptionMapper
>>> handling in Resteasy as some kind of filter I could enable/disable/
>>> extend.
>> Some pseudo code to illustrate this, current situation:
>>
>> // Wrap in RESTEasy contexts
>> try {
>> ResteasyProviderFactory.pushContext(HttpServletRequest.class,
>> request);
>> ...
>> // Wrap in Seam contexts
>> new ContextualHttpServletRequest(request) {
>> UriInfoImpl uriInfo = // Do stuff
>> dispatcher.getDispatcher().invoke(in, theResponse);
>> }
>>
>> } finally {
>> ResteasyProviderFactory.clearContextData();
>> }
>>
>> Ideally I would get access to the ExceptionMapper invocation like
>> this, the exception needs to bubble out of dispatcher.invoke():
>>
>> // Wrap in RESTEasy contexts
>> try {
>> ResteasyProviderFactory.pushContext(HttpServletRequest.class,
>> request);
>> ...
>> // Wrap in Seam contexts
>> new ContextualHttpServletRequest(request) {
>> UriInfoImpl uriInfo = // Do stuff
>> dispatcher.getDispatcher().invoke(in, theResponse);
>> }
>> } catch (Exception ex) {
>> return exceptionMapper.getResponse(ex);
>> } finally {
>> ResteasyProviderFactory.clearContextData();
>> }
>>
>> Anything else is going to be significantly more effort to integrate
>> into the Seam filter/call stack.
>>
>>
>> -------------------------------------------------------------------------
>> 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
>
>
> -------------------------------------------------------------------------
> 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: Ryan J. M. <ry...@da...> - 2008-08-19 13:09:18
|
Christian,
I'll take a look at these once I wrap up the JAXB/JSON changes which I
hope to complete this week.
Ryan-
On Aug 15, 2008, at 1:42 AM, Christian Bauer wrote:
>
>> Probably the best solution would be to implement ExceptionMapper
>> handling in Resteasy as some kind of filter I could enable/disable/
>> extend.
>
> Some pseudo code to illustrate this, current situation:
>
> // Wrap in RESTEasy contexts
> try {
> ResteasyProviderFactory.pushContext(HttpServletRequest.class,
> request);
> ...
> // Wrap in Seam contexts
> new ContextualHttpServletRequest(request) {
> UriInfoImpl uriInfo = // Do stuff
> dispatcher.getDispatcher().invoke(in, theResponse);
> }
>
> } finally {
> ResteasyProviderFactory.clearContextData();
> }
>
> Ideally I would get access to the ExceptionMapper invocation like
> this, the exception needs to bubble out of dispatcher.invoke():
>
> // Wrap in RESTEasy contexts
> try {
> ResteasyProviderFactory.pushContext(HttpServletRequest.class,
> request);
> ...
> // Wrap in Seam contexts
> new ContextualHttpServletRequest(request) {
> UriInfoImpl uriInfo = // Do stuff
> dispatcher.getDispatcher().invoke(in, theResponse);
> }
> } catch (Exception ex) {
> return exceptionMapper.getResponse(ex);
> } finally {
> ResteasyProviderFactory.clearContextData();
> }
>
> Anything else is going to be significantly more effort to integrate
> into the Seam filter/call stack.
>
>
> -------------------------------------------------------------------------
> 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: Ryan J. M. <ry...@da...> - 2008-08-19 13:07:38
|
Christian,
I'll take a look at these once I wrap up the JAXB/JSON changes which I
hope to complete this week.
Ryan-
On Aug 15, 2008, at 1:42 AM, Christian Bauer wrote:
>
>> Probably the best solution would be to implement ExceptionMapper
>> handling in Resteasy as some kind of filter I could enable/disable/
>> extend.
>
> Some pseudo code to illustrate this, current situation:
>
> // Wrap in RESTEasy contexts
> try {
> ResteasyProviderFactory.pushContext(HttpServletRequest.class,
> request);
> ...
> // Wrap in Seam contexts
> new ContextualHttpServletRequest(request) {
> UriInfoImpl uriInfo = // Do stuff
> dispatcher.getDispatcher().invoke(in, theResponse);
> }
>
> } finally {
> ResteasyProviderFactory.clearContextData();
> }
>
> Ideally I would get access to the ExceptionMapper invocation like
> this, the exception needs to bubble out of dispatcher.invoke():
>
> // Wrap in RESTEasy contexts
> try {
> ResteasyProviderFactory.pushContext(HttpServletRequest.class,
> request);
> ...
> // Wrap in Seam contexts
> new ContextualHttpServletRequest(request) {
> UriInfoImpl uriInfo = // Do stuff
> dispatcher.getDispatcher().invoke(in, theResponse);
> }
> } catch (Exception ex) {
> return exceptionMapper.getResponse(ex);
> } finally {
> ResteasyProviderFactory.clearContextData();
> }
>
> Anything else is going to be significantly more effort to integrate
> into the Seam filter/call stack.
>
>
> -------------------------------------------------------------------------
> 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
|