Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 350407 - Do not deploy dependencies to WEB-INF/lib for OSGi web bundles
Summary: Do not deploy dependencies to WEB-INF/lib for OSGi web bundles
Status: CLOSED FIXED
Alias: None
Product: Virgo
Classification: RT
Component: tooling (show other bugs)
Version: 3.0.0.M03   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: 1.0.1.RELEASE   Edit
Assignee: Chris Frost CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 368785
  Show dependency tree
 
Reported: 2011-06-27 04:08 EDT by Jean-Pierre Bergamin CLA
Modified: 2013-01-28 10:22 EST (History)
3 users (show)

See Also:


Attachments
Howto prevent the deployment of the /WEB-INF/lib folder (50.74 KB, image/png)
2011-07-28 05:16 EDT, Jean-Pierre Bergamin CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jean-Pierre Bergamin CLA 2011-06-27 04:08:51 EDT
Build Identifier: 

When deploying our OSGi web bundle to virgo from within STS, the libs in WEB-INF/lib must not be copied into the stage directory to avoid having those libs loaded - somehow. We use camel in our webbundle and get tons of these errors when starting it:

8<------------------------------------------
[2011-06-24 10:15:43.464] ERROR Thread-93                    System.err                                                        INFO: Initializing Spring root WebApplicationContext
[2011-06-24 10:15:43.465] INFO  Thread-93                    org.springframework.web.context.ContextLoader                     Root WebApplicationContext: initialization started
[2011-06-24 10:15:43.465] INFO  Thread-93                    o.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext   Refreshing ServerOsgiBundleXmlWebApplicationContext(bundle=net.junisphere.eranger.ui.web, config=/WEB-INF/appl
icationContext.xml): startup date [Fri Jun 24 10:15:43 CEST 2011]; root of context hierarchy
[2011-06-24 10:15:43.465] INFO  Thread-93                    o.eclipse.virgo.web.dm.ServerOsgiBundleXmlWebApplicationContext   Application Context service already unpublished
[2011-06-24 10:15:43.473] INFO  Thread-93                    org.springframework.beans.factory.xml.XmlBeanDefinitionReader     Loading XML bean definitions from ServletContext resource [/WEB-INF/spring/camel-context.xml]
[2011-06-24 10:15:43.666] INFO  Thread-93                    org.apache.camel.spring.handler.CamelNamespaceHandler             OSGi environment not detected.
[2011-06-24 10:15:43.942] ERROR Thread-93                    org.springframework.web.context.ContextLoader                     Context initialization failed org.springframework.beans.factory.BeanDefinitionStoreException: Failed to create
 the JAXB binder; nested exception is com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 61 counts of IllegalAnnotationExceptions
Two classes have the same XML type name "{http://camel.apache.org/schema/spring}identifiedType". Use @XmlType.name and @XmlType.namespace to assign different names to them.
        this problem is related to the following location:
                at org.apache.camel.model.IdentifiedType
                at org.apache.camel.model.DataFormatDefinition
        this problem is related to the following location:
                at org.apache.camel.model.IdentifiedType
                at org.apache.camel.core.xml.AbstractCamelFactoryBean
                at org.apache.camel.core.xml.AbstractCamelConsumerTemplateFactoryBean
                at org.apache.camel.spring.CamelConsumerTemplateFactoryBean
8<------------------------------------------
It seems as if camel has been loaded twice, once from the WEB-INF/lib dir. An indication for this could also be camel's info message "OSGi environment not detected".

When I manually delete the WEB-INF/lib dir from the web project in the stage directory, the webapp can be started again (i.e. by right clicking on the project in the "Servers" view and choose "Redeploy" or by restarting virgo). The libs in the WEB-INF folder are not needed anyway, since all dependencies are provided in the repository/usr repo.

Reproducible: Always
Comment 1 Jean-Pierre Bergamin CLA 2011-06-27 04:09:33 EDT
Someone can close this bug report in the springsource jira:
https://issuetracker.springsource.com/browse/STS-1882
Comment 2 Jean-Pierre Bergamin CLA 2011-07-28 05:16:46 EDT
Created attachment 200503 [details]
Howto prevent the deployment of the /WEB-INF/lib folder

The deployment of the /WEB-INF/lib folder can be suppressed by removing the entry "Public/export dependency: /WEB-INF/lib" in the Java Build Path settings as shown in the attached screenshot. This bug can be closed, since eclipse offers a reasonable "workaround".
Comment 3 Glyn Normington CLA 2011-07-28 05:20:25 EDT
Let's keep this bug open either to improve the usability of the tooling in this area or to document the workaround.
Comment 4 Chris Frost CLA 2013-01-28 10:22:38 EST
This is not a problem with the Virgo IDE tooling, it is working as designed. There has also been lots of improvement with the m2e plugin for Eclipse and this is the desired way of working with Maven built projects that need to deploy on to Virgo. Looking at how the current level of m2e works I don't believe this to be a problem any more and the work around not required.

Note, Virgo doesn't support PDE plugins.