Cloudbees RUN#Cloud: Could not hook log4j errors - log4j

On RUN#Cloud I have the following trace from the staxnet startup:
WARNING: Could not hook log4j errors
java.lang.NoClassDefFoundError: org/apache/log4j/AppenderSkeleton
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at com.staxnet.appserver.jmx.ApplicationObjectFactory$InjectableClassLoader.initClass(ApplicationObjectFactory.java:75)
at com.staxnet.appserver.jmx.ApplicationObjectFactory$InjectableClassLoader.loadClass(ApplicationObjectFactory.java:58)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.staxnet.appserver.jmx.ApplicationObjectFactory.loadApplicationClass(ApplicationObjectFactory.java:37)
at com.staxnet.appserver.jmx.ApplicationObjectFactory.createApplicationObject(ApplicationObjectFactory.java:21)
at com.staxnet.appserver.jmx.AppManagementContext.hookLog4JEvents(AppManagementContext.java:60)
at com.staxnet.appserver.jmx.AppManagementContext.onBeforeContextInitialized(AppManagementContext.java:50)
at com.staxnet.appserver.jmx.AppManagementContext.containerEvent(AppManagementContext.java:31)
I understand that it is because I don't have log4j in my application, but this is intentional because we use slf4j+logback which works properly.
It doesn't seem to prevent applications from starting nor functionning, but we cannot add log4j as it conflicts with our logging.
Does this makes us miss some important log coming from the staxnet server?
We have papertrail with notifications and we want to be notified of errors occuring during start-up.

Answer from cloudbees support:
Hi Gaspard,
you can safely ignore this error.
This is caused by a platform component that was introduced long time
ago trying to better integrate with application logs. Nowadays, we
rely on Papertrail add-on for this feature. This is kept on platform
to ensure backward compatibility for oldest applications we host.
Nicolas De Loof CloudBees, Inc

Related

Hazelcast IMDG 3.12.5 adding log4j dependency to support logging

i have followed the hazelcast docs for supporting log4j using below link:
https://docs.hazelcast.org/docs/latest/manual/html-single/#logging-configuration
but even after doing so i am not able to get hazelcast logs.
queries:
do we explicitly need to add log4j-1.2.17.jar file and add this dependency to pom.xml file? if yes
please let me know what is missing in hazelcast docs
is it possible to troubleshoot and check what is the error ?
There is a note in the Hazelcast reference manual section you've shared. It explains the thing:
If you choose to use log4j, log4j2, or slf4j, you should include the proper dependencies in the classpath.
It means, yes. If you use a logging framework different from the java.util.logging, then you have to provide the implementation yourself.
If you don't provide the proper implementation, the node fails to start:
java -Dhazelcast.logging.type=log4j -jar \
~/.m2/repository/com/hazelcast/hazelcast/3.12.5/hazelcast-3.12.5.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
at com.hazelcast.logging.Log4jFactory.createLogger(Log4jFactory.java:29)
at com.hazelcast.logging.LoggerFactorySupport$1.createNew(LoggerFactorySupport.java:32)
at com.hazelcast.logging.LoggerFactorySupport$1.createNew(LoggerFactorySupport.java:30)
at com.hazelcast.util.ConcurrencyUtil.getOrPutIfAbsent(ConcurrencyUtil.java:125)
at com.hazelcast.logging.LoggerFactorySupport.getLogger(LoggerFactorySupport.java:38)
at com.hazelcast.logging.Logger.getLogger(Logger.java:110)
at com.hazelcast.logging.Logger.getLogger(Logger.java:64)
at com.hazelcast.instance.HazelcastInstanceFactory.<clinit>(HazelcastInstanceFactory.java:67)
at com.hazelcast.core.Hazelcast.newHazelcastInstance(Hazelcast.java:91)
at com.hazelcast.core.server.StartServer.main(StartServer.java:46)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
at java.lang.ClassLoader.loadClass(ClassLoader.java:418)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:352)
at java.lang.ClassLoader.loadClass(ClassLoader.java:351)
... 10 more
log4j is deprecated since 5 years ago, has security vulnerabilities and may not work on newer versions of Java. See here.
Specifying hazelcast.logging.type as log4j indicates to Hazelcast to use whatever Log4j it finds at runtime, as this enables you to chose the version you want.
So your pom needs to build an executable Jar including at least the Hazelcast jar and Log4j jar. Or, you put both on the classpath for runtime.
For me, 3.12.5 fails immediately with
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
if I request Log4j but don't provide a Log4j jar on the runtime classpath. If you
don't get that message it could be that the configuration you specified isn't being used.

Build failure for example application cloud-s4-sdk-book (integration test)

I have loaded a sample application for SCP / S/4HANA Business Partner integration, did changes as documented in read.me, I also have comm. user/arrangement in S/4HANA for 0008.
When I try to build it,
I get error during integration test, the content of file com.sap.cloud.s4hana.examples.addressmgr.BusinessPartnerServletTest is:
<<< ERROR! org.jboss.arquillian.container.spi.client.container.DeploymentException: Unable to deploy
Caused by: org.apache.openejb.OpenEJBRuntimeException: org.apache.openejb.OpenEJBException: Creating application failed: /Users/d036682/Downloads/cloud_app/integration-tests/target/surefire-fork/1/arquillian-tomee-working-dir/0/292d95a8-4414-4535-846f-c8fae7dcd7e9: Cannot get Unsafe.defineClass
Caused by: org.apache.openejb.OpenEJBException: Creating application failed: /Users/d036682/Downloads/cloud_app/integration-tests/target/surefire-fork/1/arquillian-tomee-working-dir/0/292d95a8-4414-4535-846f-c8fae7dcd7e9: Cannot get Unsafe.defineClass
Caused by: java.lang.IllegalStateException: Cannot get Unsafe.defineClass
Caused by: java.lang.NoSuchMethodException: sun.misc.Unsafe.defineClass(java.lang.String,[B,int,int,java.lang.ClassLoader,java.security.ProtectionDomain)
Could you please help
Thanks,
Konstantin
Please make sure to use JDK 8 as documented until further notice. Various dependencies don't work in later versions as of now.
Kind regards
Florian

Websphere 8.5 - ArrayIndexOutofBoundsException while starting application

I've managed to deploy a simple Web application to Websphere 8.5, but unable to start it. It throws an ArrayIndexOutofBoundsException while starting my application.
We have been using Tomcat7 so far for our web app. It's a simple web-app with JSPs, JSs and Servlets.
I've tried a lot of options to deploy the application on Websphere, but the latest hurdle i'm facing is the ArrayIndexOutofBoundsException.
I tried to deploy the same application (a mini version) which contained only one servlet, and it was successful. But when I have multiple servlets, I get this exception. Below is my stack trace
[8/12/14 12:15:55:463 IST] 00000046 BeansDeployer E BeansDeployer deploy
java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException
at org.apache.webbeans.portable.AnnotatedElementFactory.newAnnotatedType(AnnotatedElementFactory.java:150)
at org.apache.webbeans.config.BeansDeployer.deployFromClassPath(BeansDeployer.java:484)
at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:171)
at org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:124)
at org.apache.webbeans.web.lifecycle.WebContainerLifecycle.startApplication(WebContainerLifecycle.java:78)
at com.ibm.ws.webbeans.common.CommonLifeCycle.startApplication(CommonLifeCycle.java:106)
at com.ibm.ws.webbeans.services.JCDIServletContainerInitializer.onStartup(JCDIServletContainerInitializer.java:85)
at com.ibm.ws.webcontainer.webapp.WebAppImpl.initializeServletContainerInitializers(WebAppImpl.java:613)
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)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApp(WSWebContainer.java:749)
at com.ibm.ws.webcontainer.WSWebContainer.addWebApplication(WSWebContainer.java:634)
at com.ibm.ws.webcontainer.component.WebContainerImpl.install(WebContainerImpl.java:426)
at com.ibm.ws.webcontainer.component.WebContainerImpl.start(WebContainerImpl.java:718)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:1175)
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:774)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:2182)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:445)
at com.ibm.ws.runtime.component.CompositionUnitImpl.start(CompositionUnitImpl.java:123)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.start(CompositionUnitMgrImpl.java:388)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl.access$500(CompositionUnitMgrImpl.java:116)
at com.ibm.ws.runtime.component.CompositionUnitMgrImpl$CUInitializer.run(CompositionUnitMgrImpl.java:994)
at com.ibm.wsspi.runtime.component.WsComponentImpl$_AsynchInitializer.run(WsComponentImpl.java:502)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1862)
Caused by: java.lang.ArrayIndexOutOfBoundsException
at org.apache.webbeans.portable.AbstractAnnotatedCallable.setAnnotatedParameters(AbstractAnnotatedCallable.java:66)
at org.apache.webbeans.portable.AnnotatedConstructorImpl.<init>(AnnotatedConstructorImpl.java:56)
at org.apache.webbeans.portable.AnnotatedElementFactory.newAnnotatedType(AnnotatedElementFactory.java:117)
... 27 more
I read a couple of other posts from people who faced more or less the same problem, but they were talking about Spring or Guava, none of which I use here. As a result, the solutions I read there did not solve my problem.
Can any one throw light on a solution? It would be helpful to a very great extent.
Additional Info:
I'm developing my project on Eclipse Kepler and using the Webshpere 8.5 plugin to deploy on Websphere application server.
Thanks,
Sriram
Actually it turns out my project was indeed referencing to guava. It was using guava version 15.0. I changed the version to 16.0 and included then in my shared library.. and it solves the issue. Apologies for overlooking guava.. old have saved a lot of time !!

PrimeFaces FileUpload Filter ClassNotFound Exception

I am getting an error while running a JSF project. Here is the error log;
org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter PrimeFaces FileUpload Filter
java.lang.ClassNotFoundException: org.primefaces.webapp.filter.FileUploadFilter
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1714)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1559)
at org.apache.catalina.core.DefaultInstanceManager.loadClass(DefaultInstanceManager.java:527)
at org.apache.catalina.core.DefaultInstanceManager.loadClassMaybePrivileged(DefaultInstanceManager.java:509)
at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:137)
at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:107)
at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4775)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5452)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
at java.util.concurrent.FutureTask.run(FutureTask.java:166)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/Project] startup failed due to previous errors
I've already created a user library added commons-fileupload-1.3.jar and commons-io-2.4.jar files but I'm still gettin the error. Any ideas?
I gather that you mean the Eclipse-specific user library management when you said "user library" there. I also gather that you've PrimeFaces already installed, otherwise this is food for Mr. Obvious. Its FileUploadFilter will indeed fail to initialize like that if Commons FileUpload and/or Commons IO are absent. You should see a NoClassDefFoundError further in the stack trace.
Just creating a new "user library" and adding to Build Path of project's properties is not exactly the right way. They also need to end up in /WEB-INF/lib of the built WAR. Usually, you'd need to add the user library in Deployment Assembly section of project's properties as well. However, this whole process is unnecessarily clumsy. Just drop those two JAR files in /WEB-INF/lib folder of dynamic web project. Eclipse will then automatically do all the necessary magic. You don't need to fiddle in project's properties. To avoid conflicts, undo all those changes which you ever made in Build Path.

WARNING: Multiple JSF Applications found on same ClassLoader. Unable to safely determine which FactoryManager instance to use

I am trying to create an application where I combine jsf2, prettyfaces, jpa and glassfish 3.1. I had some trouble gettings prettyfilter to load properly, which was fixed by following the tutorial here.
However, after completing the steps I got a problem with the Glassfish log being flooded by some really really irritating warnings mesages. It seams they dont have any impact on the functionality of my page, but I would like to know if there is something that will make them go away? The warning is:
WARNING: Multiple JSF Applications found on same ClassLoader. Unable to safely determine which FactoryManager instance to use. Defaulting to first match
In addition I'm having problem undeploying this webapp. Glassfish admin gui will show a text saying "Long lasting process has been detected", before the admin gui is useless and I have to restart the gf server. I get an error in the gf log:
INFO: PrettyFilter shutting down...
INFO: Admin Console: Initializing Session Attributes...
WARNING: java.lang.reflect.InvocationTargetException while attempting to process a 'command' event for 'button1'.
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException while attempting to process a 'command' event for 'button1'.
Not sure if this makes any sense for anyone, but any help is much appreciated!!:)
Both issues are already reported to the Glassfish dev team.
Issue GLASSFISH-15809 - JSF PhaseListener executed for each virtual host
Issue GLASSFISH-16112 - Admin GUI fails with NPE when attempting to undeploy an application
Glassfish 3.2 will be the earliest version where both issues will be fixed.

Resources