Hi
On 28/06/13 16:02, ced_benoit wrote:
Hi Sergey,
No the problem is not resolved and I am new in JAX-RS. I have add your
exemple:
@Context
private UriInfo uriOnfo;
in the class TestRest,
@Path("TestRest")
public class TestRest {
@Context
private UriInfo uriOnfo;
This is the first option to have it injected, into a field
@Context
*ublic* *void* setUriInfo(UriInfo ui)
{
*this*.uriOnfo = ui;
}
this is another option, use a setter, in this case you need to remove
@Context on the field, keep it on a method only
@GET
@Path("/findId/{id}")
@Produces("application/json")
public Response findId(@PathParam("id") Integer pID) {
...
return Response.*ok*("test").build();
}
}
and the problem isn't resolved. When you say:
"Can you have a context like UriInfo injected this way and then accessed
from a method like findId() ?" It mean that a @context must pass to the
method finId() likie this:
public Response findId(@Context contex, @PathParam("id") Integer pID)
This is option 3, pass is as a parameter.
Well, the actual problem is to do with some class loader issue and I'm
not sure what to advise there, I've never seen it before myself
Cheers, Sergey
Thank you for your help
Cedric
2013/6/28 Sergey Beryozkin [via CXF] <
[hidden email] <http://user/SendEmail.jtp?type=node&node=5730094&i=0>>
>
Hi Cedric
On 28/06/13 10:51, ced_benoit wrote:
Hi Sergey,
When you say: "What JAX-RS context do you try to inject ?", It means
to
use annotation @Context? For exemple, in my class , I have this:
@Path("TestRest")
public class TestRest {
@GET
@Path("/findId/{id}")
@Produces("application/json")
public Response findId(@PathParam("id") Integer pID) {
...
}
}
Which kind of context, i can inject in a simple case?
Did you get the issue resolved ? The exception trace led me to believe
that the runtime was trying to create a thread local proxy which would
done when you have something like this:
@Path("TestRest")
public class TestRest {
@Context
private UriInfo uriOnfo;
@GET
@Path("/findId/{id}")
@Produces("application/json")
public Response findId(@PathParam("id") Integer pID) {
}
}
assuming TestRest is a singleton class.
Can you have a context like UriInfo injected this way and then accessed
from a method like findId() ?
Sergey
thank you for you help!
Cedric
2013/6/24 Sergey Beryozkin [via CXF] <
[hidden email] <http://user/SendEmail.jtp?type=node&node=5730067&i=0>>
>>>
Looks like
> Caused by: java.lang.IllegalArgumentException: interface
> org.apache.cxf.jaxrs.impl.tl.ThreadLocalProxy is not visible
from
class
> loader
> at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:484)
> at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:713)
causes it.
What JAX-RS context do you try to inject ?
Sergey
On 24/06/13 16:26, ced_benoit wrote:
Hi,
when I start the server where I have the webservice JAX-RS, I have
this
exception comes:
SEVERE: error invoking
org.apache.openejb.observer.ObserverManager$Observer@152424eb
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at
org.apache.openejb.observer.ObserverManager$Observer.invoke(ObserverManager.java:145)
at
org.apache.openejb.observer.ObserverManager.fireEvent(ObserverManager.java:69)
at
org.apache.openejb.loader.SystemInstance.fireEvent(SystemInstance.java:107)
at
org.apache.tomee.catalina.TomcatWebAppBuilder.afterStart(TomcatWebAppBuilder.java:1486)
at
org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:110)
at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at
org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:402)
at
org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:168)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at
org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at
java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ExceptionInInitializerError
at
org.apache.cxf.jaxrs.AbstractJAXRSFactoryBean.setupFactory(AbstractJAXRSFactoryBean.java:320)
at
org.apache.cxf.jaxrs.JAXRSServerFactoryBean.create(JAXRSServerFactoryBean.java:163)
at
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.deploy(CxfRsHttpListener.java:164)
at
org.apache.openejb.server.cxf.rs.CxfRsHttpListener.deployPojo(CxfRsHttpListener.java:110)
at
org.apache.openejb.server.rest.RESTService.deployPojo(RESTService.java:436)
at
org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:248)
at
org.apache.tomee.webservices.TomeeJaxRsService.afterApplicationCreated(TomeeJaxRsService.java:51)
... 20 more
Caused by: java.lang.IllegalArgumentException: interface
org.apache.cxf.jaxrs.impl.tl.ThreadLocalProxy is not visible from
class
loader
at java.lang.reflect.Proxy.getProxyClass0(Proxy.java:484)
at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:713)
at
org.apache.cxf.jaxrs.utils.InjectionUtils.createThreadLocalProxy(InjectionUtils.java:875)
at
org.apache.cxf.jaxrs.model.AbstractResourceInfo.addContextMethod(AbstractResourceInfo.java:163)
at
org.apache.cxf.jaxrs.model.AbstractResourceInfo.checkContextMethod(AbstractResourceInfo.java:146)
at
org.apache.cxf.jaxrs.model.AbstractResourceInfo.findContextSetterMethods(AbstractResourceInfo.java:132)
at
org.apache.cxf.jaxrs.model.AbstractResourceInfo.<init>(AbstractResourceInfo.java:65)
at
org.apache.cxf.jaxrs.model.ProviderInfo.<init>(ProviderInfo.java:29)
at
org.apache.cxf.jaxrs.provider.ProviderFactory.initJaxbProviders(ProviderFactory.java:127)
at
org.apache.cxf.jaxrs.provider.ProviderFactory.<init>(ProviderFactory.java:117)
at
org.apache.cxf.jaxrs.provider.ProviderFactory.getInstance(ProviderFactory.java:157)
at
org.apache.cxf.jaxrs.provider.ProviderFactory.<clinit>(ProviderFactory.java:71)
... 27 more
I checkad again annontations in the service webservice, but I don't
find
what is wrong!
Thank you for your help!
Cedirc
--
View this message in context:
http://cxf.547215.n5.nabble.com/JAX-RS-error-in-start-up-server-tp5729730.html
Sent from the cxf-user mailing list archive at Nabble.com.
------------------------------
If you reply to this email, your message will be added to the
discussion
below:
.
NAML<
http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
--
View this message in context:
http://cxf.547215.n5.nabble.com/JAX-RS-error-in-start-up-server-tp5729730p5730060.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com
------------------------------
If you reply to this email, your message will be added to the
discussion
below:
>> .
NAML<
http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
--
View this message in context:
http://cxf.547215.n5.nabble.com/JAX-RS-error-in-start-up-server-tp5729730p5730089.html
Sent from the cxf-user mailing list archive at Nabble.com.
--
Sergey Beryozkin
Talend Community Coders
http://coders.talend.com/
Blog: http://sberyozkin.blogspot.com
------------------------------
If you reply to this email, your message will be added to the
discussion below:
http://cxf.547215.n5.nabble.com/JAX-RS-error-in-start-up-server-tp5729730p5730094.html
To unsubscribe from [JAX-RS] error in start up server, click
here<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=5729730&code=Y2VkLmJlbm9pdEBnbWFpbC5jb218NTcyOTczMHwxMDYyOTEyMjQw>
.
NAML<http://cxf.547215.n5.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>