Log4j2 with Websphere Application Server org.apache.logging.log4j.web.Log4jServletContainerInitializer not a subtype - servlets

We have an application which uses Log4j2 and running on WAS 8.5. We have selected the class loading option as PARENT_LAST, so the jar files will be picked up from WEB-INF/lib. We are error getting the below error when starting up the server.
com.ibm.ws.exception.RuntimeWarning: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: javax.servlet.ServletContainerInitializer: Provider org.apache.logging.log4j.web.Log4jServletContainerInitializer not a subtype
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:432)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1177)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1370)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:639)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:968)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:776)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$5.run(ApplicationMgrImpl.java:2195)
at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5387)
at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5603)
at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2200)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:435)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:378)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:126)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:984)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1865)
Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: Failed to load webapp: javax.servlet.ServletContainerInitializer: Provider org.apache.logging.log4j.web.Log4jServletContainerInitializer not a subtype
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:759)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
... 18 more
Caused by: com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: javax.servlet.ServletContainerInitializer: Provider org.apache.logging.log4j.web.Log4jServletContainerInitializer not a subtype
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:176)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
... 20 more
Caused by: java.util.ServiceConfigurationError: javax.servlet.ServletContainerInitializer: Provider org.apache.logging.log4j.web.Log4jServletContainerInitializer not a subtype
at java.util.ServiceLoader.fail(ServiceLoader.java:243)
at java.util.ServiceLoader.access$300(ServiceLoader.java:193)
at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:381)
at java.util.ServiceLoader$1.next(ServiceLoader.java:457)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:535)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initialize(WebAppImpl.java:409)
at com.ibm.ws.webcontainer.webapp.WebGroupImpl.addWebApplication(WebGroupImpl.java:88)
at com.ibm.ws.webcontainer.VirtualHostImpl.addWebApplication(VirtualHostImpl.java:169)
When we have the lo4j2 related jar's as part of the ext folder of the server, it is working fine without any issues.
We also have log4j jar's as well as part of the application which is being used by some third party jar's.
Can some throw some light as what is going on here and why this error is being thrown?

If you are using web.xml for your application configuration refer to following link for configuring log4j-web module related listener and filter.
http://logging.apache.org/log4j/2.x/manual/webapp.html

Related

Unable to request the metadata service Service-Id after upgrading to Artifactory 6.9.1 from 6.0.2

I have upgraded a few test instances of our Artifactory 6.0.2 Installation to version 6.9.1 using the provided instructions found at:
https://www.jfrog.com/confluence/display/RTF/Upgrading+Artifactory
I have tried both the yum upgrade and rpm installation pathways, and would like to end the installation with no error messages in the log files to minimize any potential issues from such errors.
After installation and many manual remediation steps I have reached an error "Unable to request the Metadata Service Service-Id" that I cannot find Google results for:
2019-04-09 16:22:13,409 [art-init] [ERROR] (o.a.m.s.s.ArtifactoryMetadataClientConfigStore:111) - Unable to request the Metadata Service Service-Id
2019-04-09 16:22:13,409 [art-init] [ERROR] (o.a.m.s.MetadataEventServiceImpl:188) - Unable to init the Metadata client. The Metadata Event pipeline will be disabled.
I have tried both the yum upgrade and rpm installation pathways.
After the upgrades, I noticed errors in the Catalina and Artifactory log files and followed the google search results regarding those error messages (added below my question for posterity):
(1) Created:
/var/opt/jfrog/artifactory/access/etc/bootstrap.creds
Containing:
access-admin#127.0.0.1=NEW_PASSWORD
(2) Removed access folder:
rm -rf /opt/jfrog/artifactory/tomcat/webapps/access
(3) Changed permissions of Artifactory directories:
cd /var/opt/jfrog/artifactory/
chown -R artifactory:artifactory .
(4) EDITED the artifactory.system.properties file adding:
artifactory.pathChecksum.migration.job.enabled=true
(5) Enabled sha 256 migration by adding this content to this same file:
##SHA2 Migration block
artifactory.sha2.migration.job.enabled=true
artifactory.sha2.migration.job.queue.workers=5
(5) Finally, Rebooted instance.
Yet the errors including The Metadata Event pipeline will be disabled persist.
I expect that the final state of the Artifactory server will be such that there are no error messages in the Artifactory nor Catalina log files.
Any assistance on remediating this error so that i can deploy the latest Artifactory build will be highly appreciated.
Thank you in advance.
======================
Here are some of the ERROR LOGS WHICH INITIATED CHANGES SHOWN ABOVE:
(1) 2019-03-27 05:03:22,872 [art-init] [WARN ] (o.j.a.c.AccessClientHttpException:41) - Unrecognized ErrorsModel by Access. Original message: Failed on executing /api/v1/system/ping, with response: Not Found
2019-03-27 05:03:22,872 [art-init] [ERROR] (o.a.s.a.AccessServiceImpl:364) - Could not ping access server: {}
org.jfrog.access.client.AccessClientHttpException: HTTP response status 404:Failed on executing /api/v1/system/ping, with response: Not Found.
(2)2019-03-27 05:06:53,235 [art-exec-3] [INFO ]
(o.a.s.j.m.s.Sha256MigrationJobDelegate:216) - SHA256 migration job (for existing artifacts) is disabled and will not run, there are 52496 artifacts without SHA256 values in the database.  Future versions of Artifactory may enforce this migration as a prerequisite for upgrades.
(3) 2019-04-04 16:20:10,951 [localhost-startStop-1] [JFrog-Access] [WARN ] (o.s.b.c.e.AnnotationConfigEmbeddedWebApplicationContext:550) - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.springframework.boot.autoconfigure.jersey.JerseyAutoConfiguration': Unsatisfied dependency expressed through constructor parameter 1; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jerseyConfig' defined in URL [jar:file:/opt/jfrog/artifactory/tomcat/webapps/access/WEB-INF/lib/access-application-4.2.0.jar!/org/jfrog/access/rest/config/JerseyConfig.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.jfrog.access.rest.config.JerseyConfig]: Constructor threw exception; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'systemResource' defined in URL [jar:file:/opt/jfrog/artifactory/tomcat/webapps/access/WEB-INF/lib/access-server-rest-4.2.0.jar!/org/jfrog/access/server/rest/resource/system/SystemResource.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'backupSubResource' defined in URL [jar:file:/opt/jfrog/artifactory/tomcat/webapps/access/WEB-INF/lib/access-server-rest-4.2.0.jar!/org/jfrog/access/server/rest/resource/system/backup/BackupSubResource.class]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'backupServiceImpl': Unsatisfied dependency expressed through field 'importerExporter'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'accessImporterExporterImpl': Unsatisfied dependency expressed through method 'setServerBootstrap' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'accessServerBootstrapImpl': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Failed to bootstrap initial access credentials.
Thank you for the feedback #error404.
We ended up opening a ticket with Jfrog support (https://www.jfrog.com/jira/browse/RTFACT-18939) who was able to replicate the issue and subsequently marked the ticket as "Fix Version/s: 6.10.0"
Although not strictly stated, I assume this Fix Version update implies that the described issue will be remediated in the next release.

Ensure that the 'dir.root' property '/var/lib/alfresco/alf_data_dev' is pointing to the correct data

We are doing the alfresco 5.1 installation in multiple servers in clone env.Except in one server ,we are seeing below error other 3 servers.To resolve this error we have done below steps but no luck.please note that below path was there in all servers.
1)Stop all shared servers
2)Drop database schema and create new schema.
3)Delete contents(contentstore & contentstore.deleted) inside /var/lib/alfresco/alf_data_dev
4)Start all shared servers.
07-28 07:01:30,864 ERROR [repo.admin.ConfigurationChecker] [localhost-startStop-1] CONTENT INTEGRITY ERROR: System content not found in content store.
2016-07-28 07:01:30,864 ERROR [repo.admin.ConfigurationChecker] [localhost-startStop-1] Ensure that the 'dir.root' property '/var/lib/alfresco/alf_data_dev_new' is pointing to the correct data location.
2016-07-28 07:01:30,867 ERROR [web.context.ContextLoader] [localhost-startStop-1] Context initialization failed
org.alfresco.error.AlfrescoRuntimeException: 06280002 Ensure that the 'dir.root' property '/var/lib/alfresco/alf_data_dev' is pointing to the correct data location.
at org.alfresco.repo.admin.ConfigurationChecker.check(ConfigurationChecker.java:263)
at org.alfresco.repo.admin.ConfigurationChecker.access$0(ConfigurationChecker.java:198)
at org.alfresco.repo.admin.ConfigurationChecker$1$1.doWork(ConfigurationChecker.java:186)
at org.alfresco.repo.security.authentication.AuthenticationUtil.runAs(AuthenticationUtil.java:555)
at org.alfresco.repo.admin.ConfigurationChecker$1.execute(ConfigurationChecker.java:182)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:464)
at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:352)

spring MVC, Jboss 7

I am trying to build a sample spring MVC app using Maven and getting deployed in JBoss 7 application server.
While trying to build using maven, it builds fine without error. However while trying to deploy using JBoss 7, I am getting this following error.
Kindly help to give ideas what might be the cause of this error.
13:48:36,408 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-4) MSC00001: Failed to start service jboss.deployment.unit."firstSpring-1.0-SNAPSHOT.war".POST_MODULE: org.jboss.msc.service.StartException in service jboss.deployment.unit."firstSpring-1.0-SNAPSHOT.war".POST_MODULE: Failed to process phase POST_MODULE of deployment "firstSpring-1.0-SNAPSHOT.war"
Caused by: java.lang.RuntimeException: Error getting reflective information for class org.springframework.web.servlet.tags.EvalTag with ClassLoader ModuleClassLoader for Module "deployment.firstSpring-1.0-SNAPSHOT.war:main" from Service Module Loader
Caused by: java.lang.NoClassDefFoundError: org/springframework/expression/PropertyAccessor
Caused by: java.lang.ClassNotFoundException: org.springframework.expression.PropertyAccessor from [Module "deployment.firstSpring-1.0-SNAPSHOT.war:main" from Service Module Loader]

Tagfiles (.tag) in JAR (Java App) not picked up in RAD 7

I am using Websphere 6.1.0.23 and RAD7. I have a Java App (SearchJava) which has a tagfile cluster.tag under src/META-INF/tags. I also have search.tld under src/META-INF/tld which has
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
version="2.0">
<tlib-version>2.0</tlib-version>
<jsp-version>1.2</jsp-version>
<short-name></short-name>
<uri>http://x.y.z/search/tags</uri>
<tag-file>
<name>cluster</name>
<path>/META-INF/tags/cluster.tag</path>
</tag-file>
</taglib>
I have a web app (SearchWeb) which has a dependency on my java app (configured as a Web Library using J2EE Module Dependencies). When I start my server in RAD, it can find the tld, but it can't seem to find the tag file. However when I deploy to a standalone Websphere 6.1 instance (i.e. without RAD) it works. This is the error I'm seeing.
[04/05/11 11:20:54:359 IST] 00000016 WebGroup A SRVE0169I: Loading Web Module: SearchWeb.
[04/05/11 11:20:54:703 IST] 00000016 jsp E com.ibm.ws.jsp.taglib.TldParser logParseErrorMessage Failed to parse Tag Library [search.tld]: JSPG0036E: Failed to find resource /META-INF/tags/cluster.tag
[04/05/11 11:20:54:703 IST] 00000016 jsp W com.ibm.ws.jsp.taglib.TagLibraryCache loadLooseLibTagFiles jsp error failed to parse loose library tld . location = [C:\CCRC\common_apps\SearchJava\bin/META-INF/tld]
com.ibm.ws.jsp.JspCoreException: com.ibm.ws.jsp.JspCoreException: JSPG0036E: Failed to find resource /META-INF/tags/cluster.tag
at com.ibm.ws.jsp.taglib.TldParser.parseTLD(TldParser.java:251)
at com.ibm.ws.jsp.taglib.TagLibraryCache.loadLooseLibTagFiles(TagLibraryCache.java:554)
at com.ibm.ws.jsp.taglib.TagLibraryCache.loadLooseLibTagFiles(TagLibraryCache.java:589)
at com.ibm.ws.jsp.taglib.TagLibraryCache.loadLooseLibTagFiles(TagLibraryCache.java:589)
at com.ibm.ws.jsp.taglib.TagLibraryCache.<init>(TagLibraryCache.java:119)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.<init>(AbstractJSPExtensionProcessor.java:169)
at com.ibm.ws.jsp.webcontainerext.ws.WASJSPExtensionProcessor.<init>(WASJSPExtensionProcessor.java:66)
at com.ibm.ws.jsp.webcontainerext.ws.WASJSPExtensionFactory.createProcessor(WASJSPExtensionFactory.java:189)
at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionFactory.createExtensionProcessor(AbstractJSPExtensionFactory.java:75)
at com.ibm.ws.webcontainer.webapp.WebApp.initializeExtensionProcessors(WebApp.java:1191)
at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinish(WebApp.java:345)
at com.ibm.ws.wswebcontainer.webapp.WebApp.initialize(WebApp.java:292)
at com.ibm.ws.wswebcontainer.webapp.WebGroup.addWebApplication(WebGroup.java:92)
at com.ibm.ws.wswebcontainer.VirtualHost.addWebApplication(VirtualHost.java:157)
at com.ibm.ws.wswebcontainer.WebContainer.addWebApp(WebContainer.java:671)
at com.ibm.ws.wswebcontainer.WebContainer.addWebApplication(WebContainer.java:624)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:335)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:551)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1274)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:1165)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:569)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:832)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:921)
at com.ibm.ws.runtime.component.ApplicationMgrImpl$AppInitializer.run(ApplicationMgrImpl.java:2124)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:342)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1473)
Does anybody know how to get this to work? Is there something I can configure in RAD?
Thanks
I had the same error this week, I think the problem is because RAD uses the workspace resouces, you could change the configuration of the server to use the server resource instead of the workspace, then it works fine.
Double Click in the Server, in Server View in the section
Publishing settings for WebSphere Application Server select Run server with resources on Server

why can't you consistently deploy an EJB

I need to know what factors contribute to not being able to deploy an EJB. I have an error like this:
An error has occurred
Deploying application in domain failed;
Error loading deployment descriptors for module [blach]
Referencing error: This bundle has no bean of name [blah]
Error loading deployment descriptors for module [blah]
Referencing error: This bundle has no bean of name [blah]
"Error loading deployment descriptors" sounds like the deployment descriptor is broken. I'd try validating it against the DTD, and perhaps crank up the log level of the app server to try and get more detailed error messages.

Resources