You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by Harald Wellmann <hw...@gmail.com> on 2013/04/25 21:22:11 UTC

Servlet scanned twice in embedded mode

I'm trying to upgrade the Pax Exam test container for TomEE from 1.5.1 
to 1.5.2, and there's a problem related to servlet scanning.

Pax Exam builds a WAR from more or less everything found on the 
classpath and deploys it to org.apache.tomee.embedded.Container.

This used to work fine with 1.5.1, but with 1.5.2 there's an exception 
for a duplicate @WebServlet which is picked up twice, once from the 
application classpath, and once from the webapp classloader.

I've tried using org.apache.catalina.startup.ContextConfig.jarsToSkip to 
exclude application classpath components (which also contain directories 
like foo/target/classes/), but without success.

Is there some other solution? Does it make sense at all to scan anything 
outside the WAR for servlets?

Best regards,
Harald

Re: Servlet scanned twice in embedded mode

Posted by Harald Wellmann <hw...@gmail.com>.
Here is a JIRA issue and a failing test attached:
https://issues.apache.org/jira/browse/TOMEE-923

Best regards,
Harald



2013/4/27 Harald Wellmann <hw...@gmail.com>

> Erdem's problem is different from mine. There is no embedded container.
>
> I still see the same issue with the latest trunk build. I'll try to
> isolate it in a sample project and get back.
>
> Best regards,
> Harald
>
> Am 26.04.2013 12:40, schrieb erdemy:
>
>  Hi Romain,
>> i have uploaded the test project before as in the link (multi module
>> project):
>> http://openejb.979440.n4.**nabble.com/attachment/4662451/**0/test.rar<http://openejb.979440.n4.nabble.com/attachment/4662451/0/test.rar>
>>
>> if you can import the project in Eclipse then deploy and start Tomee in
>> Eclipse, you can see error message in the startup log.
>>
>> kind regards,
>> Erdem
>>
>>
>>
>> --
>> View this message in context: http://openejb.979440.n4.**
>> nabble.com/Servlet-scanned-**twice-in-embedded-mode-**
>> tp4662460p4662478.html<http://openejb.979440.n4.nabble.com/Servlet-scanned-twice-in-embedded-mode-tp4662460p4662478.html>
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>>
>

Re: Servlet scanned twice in embedded mode

Posted by Harald Wellmann <hw...@gmail.com>.
Erdem's problem is different from mine. There is no embedded container.

I still see the same issue with the latest trunk build. I'll try to 
isolate it in a sample project and get back.

Best regards,
Harald

Am 26.04.2013 12:40, schrieb erdemy:
> Hi Romain,
> i have uploaded the test project before as in the link (multi module
> project):
> http://openejb.979440.n4.nabble.com/attachment/4662451/0/test.rar
>
> if you can import the project in Eclipse then deploy and start Tomee in
> Eclipse, you can see error message in the startup log.
>
> kind regards,
> Erdem
>
>
>
> --
> View this message in context: http://openejb.979440.n4.nabble.com/Servlet-scanned-twice-in-embedded-mode-tp4662460p4662478.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>


Re: Servlet scanned twice in embedded mode

Posted by erdemy <er...@teb.com.tr>.
Hi Romain,
i have uploaded the test project before as in the link (multi module
project):
http://openejb.979440.n4.nabble.com/attachment/4662451/0/test.rar

if you can import the project in Eclipse then deploy and start Tomee in
Eclipse, you can see error message in the startup log.

kind regards,
Erdem



--
View this message in context: http://openejb.979440.n4.nabble.com/Servlet-scanned-twice-in-embedded-mode-tp4662460p4662478.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Servlet scanned twice in embedded mode

Posted by Romain Manni-Bucau <rm...@gmail.com>.
any chance you share a maven project with a test showing the issue?

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/4/26 erdemy <er...@teb.com.tr>

> Hi Romain,
> yesterday i have checked out trunk source code and build from source.
> still the same problem:
>
> Caused by: java.lang.IllegalArgumentException: The servlets named
> [TestServlet] and [TestServlet] are both mapped to the url-pattern
> [/test/*]
> which is not permitted
>         at
> org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:335)
>         at org.apache.catalina.deploy.WebXml.merge(WebXml.java:1691)
>         at
>
> org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1338)
>         at
>
> org.apache.tomee.catalina.OpenEJBContextConfig.webConfig(OpenEJBContextConfig.java:297)
>         at
>
> org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
>         at
>
> org.apache.tomee.catalina.OpenEJBContextConfig.configureStart(OpenEJBContextConfig.java:96)
>         at
>
> org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
>         at
>
> org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
>         at
>
> org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
>         at
>
> org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)
>         at
> org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
>
>
>
> --
> View this message in context:
> http://openejb.979440.n4.nabble.com/Servlet-scanned-twice-in-embedded-mode-tp4662460p4662472.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>

Re: Servlet scanned twice in embedded mode

Posted by erdemy <er...@teb.com.tr>.
Hi Romain,
yesterday i have checked out trunk source code and build from source. 
still the same problem:

Caused by: java.lang.IllegalArgumentException: The servlets named
[TestServlet] and [TestServlet] are both mapped to the url-pattern [/test/*]
which is not permitted
	at org.apache.catalina.deploy.WebXml.addServletMapping(WebXml.java:335)
	at org.apache.catalina.deploy.WebXml.merge(WebXml.java:1691)
	at
org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1338)
	at
org.apache.tomee.catalina.OpenEJBContextConfig.webConfig(OpenEJBContextConfig.java:297)
	at
org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:878)
	at
org.apache.tomee.catalina.OpenEJBContextConfig.configureStart(OpenEJBContextConfig.java:96)
	at
org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:369)
	at
org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
	at
org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
	at
org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5269)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)



--
View this message in context: http://openejb.979440.n4.nabble.com/Servlet-scanned-twice-in-embedded-mode-tp4662460p4662472.html
Sent from the OpenEJB User mailing list archive at Nabble.com.

Re: Servlet scanned twice in embedded mode

Posted by Harald Wellmann <hw...@gmail.com>.
No, I used the latest binary snapshot.

Am 25.04.2013 22:39, schrieb Romain Manni-Bucau:
> build from sources?
>
> guys, please share sthg reproducing it, i was not able to get it locally
> with an up to date snapshot
>
> *Romain Manni-Bucau*
> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
> *Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
> *Github: https://github.com/rmannibucau*
>
>
>
> 2013/4/25 Harald Wellmann <hw...@gmail.com>
>
>> I'm getting the same error with 1.6.0-SNAPSHOT...
>>
>> Regards,
>> Harald
>>
>> Am 25.04.2013 21:31, schrieb erdemy:
>>
>>   Hi Harald,
>>> We have the same problem, i am going to try build from trunk as Romain
>>> told.
>>>
>>> kind regards,
>>> Erdem
>>>
>>>
>>>
>>> --
>>> View this message in context: http://openejb.979440.n4.**
>>> nabble.com/Servlet-scanned-**twice-in-embedded-mode-**
>>> tp4662460p4662461.html<http://openejb.979440.n4.nabble.com/Servlet-scanned-twice-in-embedded-mode-tp4662460p4662461.html>
>>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>>
>>>
>>
>


Re: Servlet scanned twice in embedded mode

Posted by Romain Manni-Bucau <rm...@gmail.com>.
build from sources?

guys, please share sthg reproducing it, i was not able to get it locally
with an up to date snapshot

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/4/25 Harald Wellmann <hw...@gmail.com>

> I'm getting the same error with 1.6.0-SNAPSHOT...
>
> Regards,
> Harald
>
> Am 25.04.2013 21:31, schrieb erdemy:
>
>  Hi Harald,
>> We have the same problem, i am going to try build from trunk as Romain
>> told.
>>
>> kind regards,
>> Erdem
>>
>>
>>
>> --
>> View this message in context: http://openejb.979440.n4.**
>> nabble.com/Servlet-scanned-**twice-in-embedded-mode-**
>> tp4662460p4662461.html<http://openejb.979440.n4.nabble.com/Servlet-scanned-twice-in-embedded-mode-tp4662460p4662461.html>
>> Sent from the OpenEJB User mailing list archive at Nabble.com.
>>
>>
>

Re: Servlet scanned twice in embedded mode

Posted by Harald Wellmann <hw...@gmail.com>.
I'm getting the same error with 1.6.0-SNAPSHOT...

Regards,
Harald

Am 25.04.2013 21:31, schrieb erdemy:
> Hi Harald,
> We have the same problem, i am going to try build from trunk as Romain told.
>
> kind regards,
> Erdem
>
>
>
> --
> View this message in context: http://openejb.979440.n4.nabble.com/Servlet-scanned-twice-in-embedded-mode-tp4662460p4662461.html
> Sent from the OpenEJB User mailing list archive at Nabble.com.
>


Re: Servlet scanned twice in embedded mode

Posted by erdemy <er...@teb.com.tr>.
Hi Harald,
We have the same problem, i am going to try build from trunk as Romain told.

kind regards,
Erdem



--
View this message in context: http://openejb.979440.n4.nabble.com/Servlet-scanned-twice-in-embedded-mode-tp4662460p4662461.html
Sent from the OpenEJB User mailing list archive at Nabble.com.