[jboss-as7-dev] jaxrs doesn't deploy with certain module configurations
Bill Burke
bburke at redhat.com
Thu Jan 17 10:48:35 EST 2013
Solved by registering a lifecycle listener and listening for AFTER-START:
@Override
public void start() throws LifecycleException
{
super.start();
StandardContext standardContext = (StandardContext)context;
standardContext.addLifecycleListener(this);
}
@Override
public void lifecycleEvent(LifecycleEvent event)
{
if (event.getType() == Lifecycle.AFTER_START_EVENT) init();
}
I dived into the jbw code a bit, but couldn't find out where the
misorder happens. I'll log a jira on this.
On 1/16/2013 9:32 PM, Stuart Douglas wrote:
> Looks like an ordering issue.
>
> Calling org.apache.catalina.core.ApplicationContext#getInitParameter()
> created a merged view of the parameters, and if the application
> parameters have not been set the first time this method is called then
> the parameters will never show up.
>
> Stuart
>
> Bill Burke wrote:
>> Ok, I narrowed this down further.
>>
>> I reverted my project and everything worked great again. I found that if
>> I get an init parameter from within the start() method of my
>> authentication valve, for some reason, it blows away the context-param
>> metadata set by the jaxrs deployer:
>>
>> context.getServletContext().getInitParameter("skeleton.key.config.file");
>>
>> Still doesn't make sense, but maybe this is a better symptom. I'm a bit
>> tired, so I'll try and create a smaller project that reproduces the
>> problem later.
>>
>>
>>
>> On 1/16/2013 8:40 PM, Stuart Douglas wrote:
>>> Is the code to reproduce this on github?
>>>
>>> Stuart
>>>
>>> Bill Burke wrote:
>>>> I have a very strange, rather complex problem that I'm having a very
>>>> hard time figuring out exactly what the cause is. Its a huge blocker
>>>> for me.
>>>>
>>>> * JBoss AS 7.1.1
>>>> * I have a WAR with very simple JAX-RS classes in them
>>>> * The WAR has security constraints
>>>> * Uses basic auth
>>>>
>>>> The above works great, but when I add some more, specifically:
>>>>
>>>> * I add a custom valve that does authentication
>>>> * The custom valve class lives in a module that is imported via
>>>> jboss-deployment-structure.xml
>>>> * This module has JAX-RS dependencies (not exported)
>>>>
>>>> The above does not work. I'm getting 404's when invoking on the
>>>> deployed JAX-RS classes. I've been placing a bunch of logging
>>>> statements within resteasy (3.0) and also the JAX-RS deployer which I
>>>> forked from the 7.1.1 tagged release.
>>>>
>>>> * The valve works like a charm
>>>> * A JAX-RS servlet is being deployed
>>>> * The AS7 jaxrs deployment scanner is finding the appropriate classes
>>>> * The AS7 jaxrs integration processor is adding the appropriate
>>>> context-params to the web deployment so resteasy servlet knows what to
>>>> deploy. ("resteasy.scanned.resources")
>>>> * But, the context-params are null when the resteasy servlet finally
>>>> decides to initialize, so no JAX-RS classes from the deployment are
>>>> deployed.
>>>>
>>>> I have no idea why!!
>>>>
>>>> To further narrow the problem, I created a simple pass-thru
>>>> authentication valve class within the same custom module. It worked, so
>>>> I decided to just include the initialization code (which does nothing
>>>> really but create some classes, but does reference a bunch of Resteasy
>>>> classes). Then, the problem surfaces again.
>>>>
>>>> It seems like a module/classloader problem, based on adding code to the
>>>> pass-thru valve, but I don't know how the frack classloader issues
>>>> could
>>>> effect servlet metadata created by the JAX-RS deployer.
>>>>
>>>> If you've gotten through this read, thanks.
>>>>
>>>>
>>>>
>>
--
Bill Burke
JBoss, a division of Red Hat
http://bill.burkecentral.com
More information about the jboss-as7-dev
mailing list