You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by exabrial12 <ex...@gmail.com> on 2013/06/10 22:40:04 UTC
JAX-RS severely broken when virtual hosts are used
Hey guys, I have a pretty simple JAX-RS application that I'm trying to deploy
on a virtualhost. TomEE 1.5.2+ really freaks out:
@ApplicationPath("/api")
public class NetQuoteApplication extends Application {
/**
* {@inheritDoc}
*/
@Override
public Set<Class<?>> getClasses() {
return new HashSet<Class<?>>(Arrays.asList(XMLEndpoint.class,
RestExceptionMapper.class));
}
}
@Path("xml/leads/vendor/netquote")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_FORM_URLENCODED
})
@Produces(MediaType.APPLICATION_XML)
@ApplicationScoped
public class XMLEndpoint extends NetQuoteRestController {
}
public abstract class NetQuoteRestController {
@Inject
private Logger log;
@Inject
private Event<NetQuoteData> netQuoteBus;
@POST
@Path("create")
public NetQuoteResponse create(@FormParam("LeadData") String leadData) {
log.debug("create() leadData:{}", leadData);
netQuoteBus.fire(JAXB.unmarshal(new StringReader(leadData),
NetQuoteData.class));
NetQuoteResponse netQuoteResponse = new NetQuoteResponse();
netQuoteResponse.setResponseCode(ResponseTypes.ACCEPTED);
return netQuoteResponse;
}
}
SEVERE: error invoking
org.apache.openejb.observer.ObserverManager$Observer@652916e4
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.addChildInternal(ContainerBase.java:901)
at
org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
at
org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
at
org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
at
org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
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.IllegalStateException: Invalid context ''. Cannot find
context in host localhost
at
org.apache.tomee.webservices.TomcatRsRegistry.createRsHttpListener(TomcatRsRegistry.java:76)
at
org.apache.openejb.server.rest.RESTService.deployPojo(RESTService.java:433)
at
org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:218)
at
org.apache.tomee.webservices.TomeeJaxRsService.afterApplicationCreated(TomeeJaxRsService.java:51)
... 24 more
<Engine
name="Catalina"
defaultHost="localhost">
<Realm className="org.apache.catalina.realm.LockOutRealm">
<Realm
className="org.apache.catalina.realm.UserDatabaseRealm"
resourceName="UserDatabase" />
</Realm>
<Host
name="localhost"
appBase="localhost"
unpackWARs="true"
autoDeploy="true">
</Host>
<Host
name="lead-dominator"
appBase="lead-dominator"
unpackWARs="true"
autoDeploy="true">
</Host>
</Engine>
--
View this message in context: http://openejb.979440.n4.nabble.com/JAX-RS-severely-broken-when-virtual-hosts-are-used-tp4663598.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: JAX-RS severely broken when virtual hosts are used
Posted by exabrial12 <ex...@gmail.com>.
Hey,
One more question, I really kinda need support for this right now... Is
there a RC or Beta out for 1.6.0 yet that is somewhat production worthy? I
hate pulling a build straight from trunk.
Thanks!
--
View this message in context: http://openejb.979440.n4.nabble.com/JAX-RS-severely-broken-when-virtual-hosts-are-used-tp4663598p4663790.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: JAX-RS severely broken when virtual hosts are used
Posted by exabrial12 <ex...@gmail.com>.
Cool thanks. I'll look forward to the 1.6 release...
<3 TomEE and I appreciate all the work you guys do!
--
View this message in context: http://openejb.979440.n4.nabble.com/JAX-RS-severely-broken-when-virtual-hosts-are-used-tp4663598p4663724.html
Sent from the OpenEJB User mailing list archive at Nabble.com.
Re: JAX-RS severely broken when virtual hosts are used
Posted by Romain Manni-Bucau <rm...@gmail.com>.
Hi
It works on trunk i think
1.5 got issues with root context
Le 11 juin 2013 08:22, "exabrial12" <ex...@gmail.com> a écrit :
> Hey guys, I have a pretty simple JAX-RS application that I'm trying to
> deploy
> on a virtualhost. TomEE 1.5.2+ really freaks out:
>
> @ApplicationPath("/api")
> public class NetQuoteApplication extends Application {
> /**
> * {@inheritDoc}
> */
> @Override
> public Set<Class<?>> getClasses() {
> return new
> HashSet<Class<?>>(Arrays.asList(XMLEndpoint.class,
> RestExceptionMapper.class));
> }
> }
>
> @Path("xml/leads/vendor/netquote")
> @Consumes({ MediaType.APPLICATION_XML,
> MediaType.APPLICATION_FORM_URLENCODED
> })
> @Produces(MediaType.APPLICATION_XML)
> @ApplicationScoped
> public class XMLEndpoint extends NetQuoteRestController {
> }
>
> public abstract class NetQuoteRestController {
> @Inject
> private Logger log;
> @Inject
> private Event<NetQuoteData> netQuoteBus;
>
> @POST
> @Path("create")
> public NetQuoteResponse create(@FormParam("LeadData") String
> leadData) {
> log.debug("create() leadData:{}", leadData);
> netQuoteBus.fire(JAXB.unmarshal(new StringReader(leadData),
> NetQuoteData.class));
> NetQuoteResponse netQuoteResponse = new NetQuoteResponse();
> netQuoteResponse.setResponseCode(ResponseTypes.ACCEPTED);
> return netQuoteResponse;
> }
> }
>
>
> SEVERE: error invoking
> org.apache.openejb.observer.ObserverManager$Observer@652916e4
> 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.addChildInternal(ContainerBase.java:901)
> at
> org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877)
> at
> org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633)
> at
> org.apache.catalina.startup.HostConfig.deployWAR(HostConfig.java:977)
> at
> org.apache.catalina.startup.HostConfig$DeployWar.run(HostConfig.java:1655)
> at
> java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
> 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.IllegalStateException: Invalid context ''. Cannot
> find
> context in host localhost
> at
>
> org.apache.tomee.webservices.TomcatRsRegistry.createRsHttpListener(TomcatRsRegistry.java:76)
> at
> org.apache.openejb.server.rest.RESTService.deployPojo(RESTService.java:433)
> at
>
> org.apache.openejb.server.rest.RESTService.afterApplicationCreated(RESTService.java:218)
> at
>
> org.apache.tomee.webservices.TomeeJaxRsService.afterApplicationCreated(TomeeJaxRsService.java:51)
> ... 24 more
>
>
> <Engine
> name="Catalina"
> defaultHost="localhost">
>
> <Realm
> className="org.apache.catalina.realm.LockOutRealm">
> <Realm
>
> className="org.apache.catalina.realm.UserDatabaseRealm"
> resourceName="UserDatabase" />
> </Realm>
> <Host
> name="localhost"
> appBase="localhost"
> unpackWARs="true"
> autoDeploy="true">
> </Host>
> <Host
> name="lead-dominator"
> appBase="lead-dominator"
> unpackWARs="true"
> autoDeploy="true">
> </Host>
> </Engine>
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/JAX-RS-severely-broken-when-virtual-hosts-are-used-tp4663598.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>