[MGNLREST-82] Can't install modules because of conflict on Weblogic with Jersey library Created: 09/Feb/17  Updated: 22/Jun/22  Resolved: 14/Mar/18

Status: Closed
Project: Magnolia REST Framework
Component/s: None
Affects Version/s: 1.2
Fix Version/s: 2.1

Type: Bug Priority: Critical
Reporter: Edwin Guilbert Assignee: Dai Ha
Resolution: Fixed Votes: 0
Labels: consolidation
Remaining Estimate: 1d 6.5h
Time Spent: 6d 1.5h
Original Estimate: Not Specified
Environment:

Weblogic 12.1.3
Magnolia 5.5.x


Attachments: Text File Jersey-conflict.log    
Issue Links:
Cloners
is cloned by MGNLREST-182 Verify REST on Weblogic with Magnolia... Closed
is cloned by MGNLWLS-18 CLONE - Can't install modules because... Closed
Relates
relates to MGNLWLS-20 Can't run endpoint and render page at... Accepted
relates to MGNLWLS-17 Weblogic module is no longer compatib... Closed
relates to MGNLEE-429 Include all quirks and config changes... Closed
relates to MGNLREST-92 Revise REST servlet integration Open
causality
dependency
duplicate
relation
is related to MGNLWLS-20 Can't run endpoint and render page at... Accepted
is related to MGNLREST-433 Donate REST Jersey support to community Open
is related to MGNLREST-342 DOC: Explain the difference between t... Closed
is related to DOCU-1181 Verfiy/Update Weblogic install instru... Closed
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled
Date of First Response:
Sprint: Kromeriz 129, Saigon 131, Saigon 132, Saigon 133, Saigon 135, Saigon 136, Saigon 137, Saigon 138
Story Points: 5

 Description   

REST modules currently use resteasy-jaxrs-3.0.19.Final library which in turn uses jboss-jaxrs-api_2.0_spec.

Weblogic 12.1.3 uses internally jersey-bundle-1.9 and jsr311-api-1.1.1.

The problem is that both libraries are having a conflict which prevents magnolia's war to deploy:

<Servlet: "Jersey" failed to preload on startup in Web application: "test-stk-webapp-1.0-SNAPSHOT.war".
com.sun.jersey.spi.inject.Errors$ErrorMessagesException
	at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
	at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136)
	at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199)
	at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
	at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)

On previous versions of the REST modules (in Magnolia 5.4.x), resteasy-jaxrs-3.0.4.Final was being used which didn't have any dependency with jboss-jaxrs-api_2.0_spec and didn't have any conflicts deploying on Weblogic.

Full log of the deploy issue attached



 Comments   
Comment by Edwin Guilbert [ 09/Feb/17 ]

On MGNLEE-429 REST modules were excluded from the weblogic magnolia bundle

Comment by Mikaël Geljić [ 02/Jun/17 ]

FYI I linked MGNLREST-92 which goes in similar direction—that's not for a minor release though, as there will be few pom changes.
Our rest-integration module may depend upon standard APIs only; so we don't have to provide resteasy when jersey is around.

In the meantime for the customer, you would have to rewrite part of the RestDispatcherServlet into a jersey-friendly equivalent, configure it under servlets, and exclude the resteasy artifacts.

Comment by Mikaël Geljić [ 20/Nov/17 ]

Closing this as "Workaround exists", as per Jan's comments (both here and on the support ticket). Should this not do the trick, let's reopen with more details (or move to MGNLEE if this is about re-including REST modules in the weblogic demo webapp).

Comment by Edwin Guilbert [ 24/Nov/17 ]

I have not been able to fix the issue with classpath filtering. Also a client is still waiting for this to be fixed as reported in SUPPORT-7606

Comment by Richard Gange [ 24/Nov/17 ]

What about this prefer-web-inf-classes element? Scroll down a bit. It mentions:

This allows a Web application to use its own version of a third-party class, which might also be part of WebLogic Server. See "weblogic.xml Deployment Descriptor Elements".

Comment by Edwin Guilbert [ 24/Nov/17 ]

rgange I have tried this, and then other issues with weblogic already fixed rise again

https://documentation.magnolia-cms.com/display/DOCS56/Deploying+a+WAR+on+Oracle+WebLogic#DeployingaWARonOracleWebLogic-Conflictinglibraries

https://documentation.magnolia-cms.com/display/DOCS56/Known+issues#Knownissues-OracleWebLogic12cconflictwithGoogleGuavalibrary

Comment by Richard Gange [ 24/Nov/17 ]

I see what you mean now. There is no way to disable the scanning that jersey does.

*********************************************************************************************************
*                                                                                                       *
* Magnolia needs module updates or installs, point your browser to your Magnolia instance and confirm ! *
*                                                                                                       *
*********************************************************************************************************
Nov 24, 2017 8:44:51 PM info.magnolia.cms.i18n.DefaultMessagesManager load
INFO: Loading i18n configuration - /server/i18n/system
Nov 24, 2017 8:44:51 PM info.magnolia.cms.i18n.DefaultMessagesManager load
WARNING: /server/i18n/system does not exist yet; skipping.
<Nov 24, 2017 8:44:51 PM CET> <Warning> <info.magnolia.cms.i18n.DefaultMessagesManager> <BEA-000000> </server/i18n/system does not exist yet; skipping.> 
Nov 24, 2017 8:44:51 PM info.magnolia.cms.i18n.DefaultMessagesManager registerEventListener
INFO: Registering event listener for i18n
Nov 24, 2017 8:44:51 PM info.magnolia.cms.beans.config.MIMEMapping init
INFO: Initializing MIMEMapping from /server/MIMEMapping
Nov 24, 2017 8:44:51 PM info.magnolia.cms.beans.config.MIMEMapping load
WARNING: No MIMEMapping info configured at /server/MIMEMapping
<Nov 24, 2017 8:44:51 PM CET> <Warning> <info.magnolia.cms.beans.config.MIMEMapping> <BEA-000000> <No MIMEMapping info configured at /server/MIMEMapping> 
Nov 24, 2017 8:44:51 PM info.magnolia.cms.beans.config.MIMEMapping registerEventListener
INFO: Registering event listener for MIMEMapping
Nov 24, 2017 8:44:51 PM info.magnolia.enterprise.beans.config.VersionConfig load
INFO: Loading version config from /server/version...
Nov 24, 2017 8:44:51 PM info.magnolia.enterprise.beans.config.VersionConfig load
INFO: No version configuration found. Falling back to default configuration.
Nov 24, 2017 8:44:51 PM info.magnolia.cms.beans.config.ConfigLoader load
INFO: Configuration loaded (took 5 seconds)
Nov 24, 2017 8:44:51 PM info.magnolia.context.AbstractRepositoryStrategy releaseSession
WARNING: won't close session because of registered observation listener config
<Nov 24, 2017 8:44:51 PM CET> <Warning> <info.magnolia.context.AbstractRepositoryStrategy> <BEA-000000> <won't close session because of registered observation listener config> 
Nov 24, 2017 8:44:51 PM info.magnolia.cms.filters.FilterManagerImpl initRootFilter
INFO: Initializing filters
Nov 24, 2017 8:44:51 PM info.magnolia.cms.filters.CompositeFilter initFilters
INFO: Initializing filter [Wrapper for Resources Servlet servlet]
Nov 24, 2017 8:44:51 PM info.magnolia.cms.filters.CompositeFilter initFilters
INFO: Initializing filter [install]
Nov 24, 2017 8:44:51 PM com.sun.jersey.api.core.PackagesResourceConfig init
INFO: Scanning for root resource and provider classes in the packages:
  info.magnolia.rest.service.command.v2
  org.jboss.resteasy.plugins.providers.jaxb
  org.jboss.resteasy.client.exception.mapper
  info.magnolia.rest
  info.magnolia.rest.service.command.v1
  info.magnolia.rest.service.node.v1
  info.magnolia.rest.service.property.v1
  info.magnolia.cache.browser.rest.endpoint
  org.jboss.resteasy.plugins.interceptors.encoding
  org.jboss.resteasy.plugins.stats
  org.jboss.resteasy.plugins.providers
  info.magnolia.cache.browser.rest.filter
  org.jboss.resteasy.core
  info.magnolia.resteasy.client.components
  com.fasterxml.jackson.jaxrs.json
  org.codehaus.jackson.jaxrs
  org.jboss.resteasy.plugins.providers.jackson
Nov 24, 2017 8:44:52 PM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Root resource classes found:
  class info.magnolia.rest.service.property.v1.PropertyEndpoint
  class org.jboss.resteasy.plugins.stats.RegistryStatsResource
  class info.magnolia.rest.service.command.v1.CommandEndpoint
  class info.magnolia.rest.service.node.v1.NodeEndpoint
  class info.magnolia.rest.service.command.v2.CommandEndpoint
  class org.jboss.resteasy.core.AsynchronousDispatcher
  class info.magnolia.cache.browser.rest.endpoint.CacheEndpoint
Nov 24, 2017 8:44:52 PM com.sun.jersey.api.core.ScanningResourceConfig logClasses
INFO: Provider classes found:
  class org.jboss.resteasy.plugins.providers.jaxb.CollectionProvider
  class org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider
  class org.jboss.resteasy.plugins.providers.jackson.UnrecognizedPropertyExceptionHandler
  class org.jboss.resteasy.plugins.providers.jaxb.JAXBElementProvider
  class com.fasterxml.jackson.jaxrs.json.JacksonJaxbJsonProvider
  class org.jboss.resteasy.plugins.providers.jackson.ResteasyJacksonProvider
  class org.jboss.resteasy.plugins.interceptors.encoding.MessageSanitizerContainerResponseFilter
  class org.codehaus.jackson.jaxrs.JacksonJsonProvider
  class org.jboss.resteasy.plugins.interceptors.encoding.AcceptEncodingGZIPInterceptor
  class org.jboss.resteasy.plugins.providers.DefaultNumberWriter
  class org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlSeeAlsoProvider
  class org.jboss.resteasy.plugins.providers.jaxb.MapProvider
  class org.jboss.resteasy.plugins.providers.DataSourceProvider
  class org.jboss.resteasy.plugins.providers.DocumentProvider
  class info.magnolia.resteasy.client.components.RestEasyDelegateJacksonProvider
  class org.jboss.resteasy.plugins.providers.FormUrlEncodedProvider
  class org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlRootElementProvider
  class info.magnolia.rest.RestExceptionMapper
  class org.jboss.resteasy.core.AcceptHeaderByFileSuffixFilter
  class org.jboss.resteasy.plugins.providers.jackson.Jackson2JsonpInterceptor
  class org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor
  class info.magnolia.cache.browser.rest.filter.AuthenticationClientRequestFilter
  class org.jboss.resteasy.plugins.interceptors.encoding.GZIPEncodingInterceptor
  class org.jboss.resteasy.plugins.providers.jaxb.JAXBXmlTypeProvider
  class org.codehaus.jackson.jaxrs.JsonParseExceptionMapper
  class com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider
  class org.jboss.resteasy.plugins.providers.FileProvider
  class org.jboss.resteasy.plugins.providers.jackson.ResteasyJackson2Provider
  class org.jboss.resteasy.plugins.providers.SerializableProvider
  class org.jboss.resteasy.plugins.providers.JaxrsFormProvider
  class org.jboss.resteasy.plugins.providers.IIOImageProvider
  class org.jboss.resteasy.plugins.providers.jackson.JacksonJsonpInterceptor
  class org.jboss.resteasy.plugins.providers.jaxb.XmlJAXBContextFinder
  class org.jboss.resteasy.plugins.providers.StringTextStar
  class org.codehaus.jackson.jaxrs.JsonMappingExceptionMapper
  class org.jboss.resteasy.plugins.providers.SourceProvider
  class org.jboss.resteasy.plugins.providers.DefaultTextPlain
  class org.jboss.resteasy.plugins.interceptors.encoding.AcceptEncodingGZIPFilter
  class org.jboss.resteasy.plugins.providers.ReaderProvider
  class org.jboss.resteasy.client.exception.mapper.ApacheHttpClient4ExceptionMapper
  class org.jboss.resteasy.plugins.providers.InputStreamProvider
Nov 24, 2017 8:44:52 PM com.sun.jersey.server.impl.cdi.CDIComponentProviderFactoryInitializer initialize
INFO: CDI support is enabled
Nov 24, 2017 8:44:52 PM com.sun.jersey.server.impl.application.WebApplicationImpl _initiate
INFO: Initiating Jersey application, version 'Jersey: 1.18.1 02/19/2014 03:28 AM'
Nov 24, 2017 8:44:52 PM com.sun.jersey.spi.inject.Errors processErrorMessages
SEVERE: The following errors and warnings have been detected with resource and/or provider classes:
  SEVERE: Missing dependency for constructor public org.jboss.resteasy.plugins.providers.DocumentProvider(org.jboss.resteasy.spi.ResteasyConfiguration) at parameter index 0
  SEVERE: Missing dependency for constructor public info.magnolia.rest.service.command.v2.CommandEndpoint(info.magnolia.rest.service.command.definition.CommandEndpointDefinition,info.magnolia.commands.CommandsManager) at parameter index 0
  SEVERE: Missing dependency for constructor public info.magnolia.rest.service.command.v2.CommandEndpoint(info.magnolia.rest.service.command.definition.CommandEndpointDefinition,info.magnolia.commands.CommandsManager) at parameter index 1
  SEVERE: Missing dependency for constructor public info.magnolia.rest.service.command.v1.CommandEndpoint(info.magnolia.rest.service.command.definition.CommandEndpointDefinition,info.magnolia.commands.CommandsManager) at parameter index 0
  SEVERE: Missing dependency for constructor public info.magnolia.rest.service.command.v1.CommandEndpoint(info.magnolia.rest.service.command.definition.CommandEndpointDefinition,info.magnolia.commands.CommandsManager) at parameter index 1
  SEVERE: Missing dependency for constructor public info.magnolia.rest.service.node.v1.NodeEndpoint(info.magnolia.rest.service.node.definition.NodeEndpointDefinition) at parameter index 0
  SEVERE: Missing dependency for constructor public info.magnolia.rest.service.property.v1.PropertyEndpoint(info.magnolia.rest.service.property.definition.PropertyEndpointDefinition) at parameter index 0
  SEVERE: Missing dependency for constructor public info.magnolia.cache.browser.rest.endpoint.CacheEndpoint(info.magnolia.cache.browser.rest.endpoint.CacheEndpointDefinition,info.magnolia.module.cache.inject.CacheFactoryProvider,info.magnolia.i18nsystem.SimpleTranslator) at parameter index 0
  SEVERE: Missing dependency for constructor public info.magnolia.cache.browser.rest.endpoint.CacheEndpoint(info.magnolia.cache.browser.rest.endpoint.CacheEndpointDefinition,info.magnolia.module.cache.inject.CacheFactoryProvider,info.magnolia.i18nsystem.SimpleTranslator) at parameter index 1
  SEVERE: Missing dependency for constructor public info.magnolia.cache.browser.rest.endpoint.CacheEndpoint(info.magnolia.cache.browser.rest.endpoint.CacheEndpointDefinition,info.magnolia.module.cache.inject.CacheFactoryProvider,info.magnolia.i18nsystem.SimpleTranslator) at parameter index 2
  SEVERE: Missing dependency for constructor public org.jboss.resteasy.core.AsynchronousDispatcher(org.jboss.resteasy.spi.ResteasyProviderFactory) at parameter index 0
<Nov 24, 2017 8:44:52 PM CET> <Error> <com.sun.jersey.spi.inject.Errors> <BEA-000000> <The following errors and warnings have been detected with resource and/or provider classes:
  SEVERE: Missing dependency for constructor public org.jboss.resteasy.plugins.providers.DocumentProvider(org.jboss.resteasy.spi.ResteasyConfiguration) at parameter index 0
  SEVERE: Missing dependency for constructor public info.magnolia.rest.service.command.v2.CommandEndpoint(info.magnolia.rest.service.command.definition.CommandEndpointDefinition,info.magnolia.commands.CommandsManager) at parameter index 0
  SEVERE: Missing dependency for constructor public info.magnolia.rest.service.command.v2.CommandEndpoint(info.magnolia.rest.service.command.definition.CommandEndpointDefinition,info.magnolia.commands.CommandsManager) at parameter index 1
  SEVERE: Missing dependency for constructor public info.magnolia.rest.service.command.v1.CommandEndpoint(info.magnolia.rest.service.command.definition.CommandEndpointDefinition,info.magnolia.commands.CommandsManager) at parameter index 0
  SEVERE: Missing dependency for constructor public info.magnolia.rest.service.command.v1.CommandEndpoint(info.magnolia.rest.service.command.definition.CommandEndpointDefinition,info.magnolia.commands.CommandsManager) at parameter index 1
  SEVERE: Missing dependency for constructor public info.magnolia.rest.service.node.v1.NodeEndpoint(info.magnolia.rest.service.node.definition.NodeEndpointDefinition) at parameter index 0
  SEVERE: Missing dependency for constructor public info.magnolia.rest.service.property.v1.PropertyEndpoint(info.magnolia.rest.service.property.definition.PropertyEndpointDefinition) at parameter index 0
  SEVERE: Missing dependency for constructor public info.magnolia.cache.browser.rest.endpoint.CacheEndpoint(info.magnolia.cache.browser.rest.endpoint.CacheEndpointDefinition,info.magnolia.module.cache.inject.CacheFactoryProvider,info.magnolia.i18nsystem.SimpleTranslator) at parameter index 0
  SEVERE: Missing dependency for constructor public info.magnolia.cache.browser.rest.endpoint.CacheEndpoint(info.magnolia.cache.browser.rest.endpoint.CacheEndpointDefinition,info.magnolia.module.cache.inject.CacheFactoryProvider,info.magnolia.i18nsystem.SimpleTranslator) at parameter index 1
  SEVERE: Missing dependency for constructor public info.magnolia.cache.browser.rest.endpoint.CacheEndpoint(info.magnolia.cache.browser.rest.endpoint.CacheEndpointDefinition,info.magnolia.module.cache.inject.CacheFactoryProvider,info.magnolia.i18nsystem.SimpleTranslator) at parameter index 2
  SEVERE: Missing dependency for constructor public org.jboss.resteasy.core.AsynchronousDispatcher(org.jboss.resteasy.spi.ResteasyProviderFactory) at parameter index 0> 
<Nov 24, 2017 8:44:52 PM CET> <Error> <HTTP> <BEA-101216> <Servlet: "Jersey" failed to preload on startup in Web application: "magnoliaAuthor.war".
com.sun.jersey.spi.inject.Errors$ErrorMessagesException
	at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
	at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136)
	at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199)
	at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:795)
	at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:790)
	Truncated. see log file for complete stacktrace
Comment by Richard Gange [ 24/Nov/17 ]

The filtering seems to be for the cases where I want to use a different version of a jar. But in this case we are talking about two different implementations of JAX-RS. It does not seem that Weblogic is providing a way to disable this subsystem or prevent it from scanning the webapp's lib.

Comment by Mikaël Geljić [ 27/Nov/17 ]

There's also mention of using the web.xml's metadata-complete attribute (to disable web fragments basically). At least it's officially documented on the WebSphere side, which also uses Jersey.

We would have to make sure this doesn't disable other components of the system though (like log4j 2 for example—hopefully we don't use the "web" artifact and start it up manually so we should be fine).

Comment by Richard Gange [ 27/Nov/17 ]

I did try this as well. The metadata-complete attribute is already included in our Weblogic specific war.

<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:j2ee="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
         metadata-complete="true">
Generated at Mon Feb 12 06:56:25 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.