Jenkins slave running Maven gives log4j warning - maven

I'm using Jenkins, and I have a Windows machine set up as a slave worker. I have a Maven-based project that runs on the slave. The build works correctly, but I get a warning from log4j about it not being initialized. I'd like to scratch that itch and remove the warning, but I don't know how.
I'm not very familiar with log4j. I do understand I could set a system property to tell it where to find a config file, but I don't know where in the Jenkins pipeline that property should be set or how. It looks like the warning comes before Maven starts but after the slave begins the job.
Here's the snippit of console output:
Parsing POMs
[MyTest] $ java -cp C:\jenkins\maven3-agent.jar;C:\jenkins\tools\Maven\Maven\boot\plexus-classworlds-2.4.jar org.jvnet.hudson.maven3.agent.Maven3Main C:\jenkins\tools\Maven\Maven C:\Users\waisbrot\AppData\LocalLow\Sun\Java\Deployment\cache\6.0\28\5c50da9c-2d1a9aef C:\jenkins\maven3-interceptor.jar 49210
<===[JENKINS REMOTING CAPACITY]===>channel started
log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.
Executing Maven: -B -f C:\jenkins\workspace\MyTest\pom.xml test
[INFO] Scanning for projects...

I'm not particularly proud of this, but I wasn't interested in any of that idle chatter, so I suppressed it by doing
jar uf <path to maven3-agent-1.2.jar>/maven3-agent-1.2.jar log4j.xml
where log4j.xml contains
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
<root>
<level value="off"/>
</root>
</log4j:configuration>
NB: the jar command must be executed as shown, with log4j.xml in the current directory.

Just provide a log4j.properties or a log4j.xml with valid contents in the classpath. See the log4j documentation for details

Related

Springboot logging level disable DEBUG logging on Gitlab

On our bootstrap.yml of our test units
logging:
level:
com.xxxx: INFO #from DEBUG
However the debugging still shows on Gitlab but it the INFO logging works when i run it local
Why is Gitlab still show DEBUG level logging?
Note that these are flowable debug logs and i have tried logging.level.org.fowable = info but that doesn't work
The solution is to use logback-test.xml and place in within resource folder of each module
<configuration>
<logger name="org.springframework" level="INFO"/>
##additional entries
</configuration>

How fix "Invalid ODBC handle" for sajdbc4 under Wildfly 20?

I had Wildfly 10 running previously and have just upgraded to Wildfly 20 (under Ubuntu 20). My configuration from the past no longer works when it comes to getting the Sybase SQL Anywhere 17 sajdbc4 driver working.
A quick summary of what's going wrong is that I installed sajdbc4.jar and the supporting files in /opt/wildfly-20.0.1.Final/modules/system/layers/base/com/mydomain/sybase/main/. I then ran a simple Java test app to confirm that it can connect to a test database and it works fine. I configured a driver and datasource in standalone.xml and run Wildfly with the following. When I Test Connection for the datasource it fails with "Invalid ODBC handle":
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/wildfly-20.0.1.Final/modules/system/layers/base/com/mydomain/sybase/main
export CLASSPATH=$CLASSPATH:/opt/wildfly-20.0.1.Final/modules/system/layers/base/com/mydomain/sybase/main
sudo ./standalone.sh
Can anyone explain what I still need to do to get the sajdbc4 driver to work?
Here are detailed notes:
*** I used tar to install Wildfly 20 in:
/opt/wildfly-20.0.1.Final
*** Placed the Sybase Sql Anywhere 17 sajdbc4.jar and other supporting files in /opt/wildfly-20.0.1.Final/modules/system/layers/base/com/mydomain/sybase/main
*** I have a simple Java app that tests the connection which I run with:
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/wildfly-20.0.1.Final/modules/system/layers/base/com/mydomain/sybase/main
java -classpath .:/opt/wildfly-20.0.1.Final/modules/system/layers/base/com/mydomain/sybase/main/sajdbc4.jar sajdbc4DriverTest.java
This simple test app runs and dumps a database table so I conclude that everything I need to work is in /opt/wildfly-20.0.1.Final/modules/system/layers/base/com/mydomain/sybase/main
*** Here is module.xml (in .sybase/main):
<?xml version="1.0" encoding="utf-8"?>
<module xmlns="urn:jboss:module:1.1" name="com.mydomain.sybase">
<resources>
<resource-root path="sajdbc4.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
*** To test Wildfly I added the driver definition in standalaone.xml as:
<drivers>
...
<driver name="sajdbc4" module="com.mydomain.sybase"/>
</drivers>
*** I then add the following datasource in standalaone.xml:
<datasource jndi-name="java:jboss/datasources/TestDB" pool-name="TestDB" spy="true" tracking="true">
<connection-url>jdbc:sqlanywhere:Host=192.168.1.89:11111,192.168.1.89:11112;ServerName=TestDB;</connection-url>
<driver>sajdbc4</driver>
<pool>
<min-pool-size>0</min-pool-size>
<max-pool-size>30</max-pool-size>
</pool>
<security>
<user-name>...</user-name>
<password>...</password>
</security>
</datasource>
*** I then run in /opt/wildfly-20.0.1.Final/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/wildfly-20.0.1.Final/modules/system/layers/base/com/mydomain/sybase/main
export CLASSPATH=$CLASSPATH:/opt/wildfly-20.0.1.Final/modules/system/layers/base/com/mydomain/sybase/main
sudo ./standalone.sh
At the top of the Terminal's log we see:
...
JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED
Note that the two exports were ignored!
*** If I then try to test the datasource connection (in the Admin console) we crash with:
...
Caused by: java.lang.UnsatisfiedLinkError: no dbjdbc17 in java.library.path: [/usr/java/packages/lib, /usr/lib/x86_64-linux-gnu/jni, /lib/x86_64-linux-gnu, /usr/lib/x86_64-linux-gnu, /usr/lib/jni, /lib, /usr/lib]
at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2670)
...
]) - failure description: "WFLYJCA0040: failed to invoke operation: WFLYJCA0047: Connection is not valid"
In an attempt to get around the "export failures" I modified standalone.config (everything after "# ADDED FOLLOWING HACK")
#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true"
JAVA_OPTS="$JAVA_OPTS -Djboss.modules.system.pkgs=$JBOSS_MODULES_SYSTEM_PKGS -Djava.awt.headless=true"
# ADDED FOLLOWING HACK
JAVA_OPTS="$JAVA_OPTS -Djava.library.path=/opt/wildfly-20.0.1.Final/modules/system/layers/base/com/mydomain/sybase/main -cp .:/opt/wildfly-20.0.1.Final/modules/system/layers/base/com/mydomain/sybase/main/sajdbc4.jar"
else
echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
fi
*** Again I run in /opt/wildfly-20.0.1.Final/bin
sudo ./standalone.sh
At the top of the Terminal's log we now see:
JAVA_OPTS: -server -Xms64m -Xmx512m -XX:MetaspaceSize=96M -XX:MaxMetaspaceSize=256m -Djava.net.preferIPv4Stack=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djava.library.path=/opt/wildfly-20.0.1.Final/modules/system/layers/base/com/mydomain/sybase/main -cp .:/opt/wildfly-20.0.1.Final/modules/system/layers/base/com/mydomain/sybase/main/sajdbc4.jar --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED
So that suggests that we now have the java.library.path and classpath as needed.
*** If I again try to test the datasource connection we now crash with:
...
Caused by: java.sql.SQLException: Invalid ODBC handle
at com.mydomain.sybase//sap.jdbc4.sqlanywhere.IDriver.makeODBCConnection(Native Method)
at com.mydomain.sybase//sap.jdbc4.sqlanywhere.IDriver.connect(IDriver.java:809)
at org.jboss.ironjacamar.jdbcadapters#1.4.22.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.createLocalManagedConnection(LocalManagedConnectionFactory.java:321)
... 35 more
]) - failure description: "WFLYJCA0040: failed to invoke operation: WFLYJCA0047: Connection is not valid"
Why are the export LD_LIBRARY_PATH and export CLASSPATH being ignored? (I expect that is what's causing the "no dbjdbc17 in java.library.path" error). How do I specify these to Wildfly?
Even when JAVA_OPTS shows the java.library.path and cp are set we still fail with "Invalid ODBC handle". This is very strange because my simple Java app test showed that when both java.library.path and cp are set to ./sybase/main "everything works". Note that the test app uses the same connection string I use in the in standalone.xml.
Thank you in advance.
The problem turned out to be related to the fact that I was running Wildfly as a service and apparently my efforts above to set the java.library.path is failing. I know the reason for the error but I do not know how to set the path when running as a service.

log4j config issue with socket appender

It shows error when i trying to run the project using socket appender.But it is working fine when i am printing logs on a file.
INFO: Initializing Spring root WebApplicationContext
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

Problems trying to load hwi service in hive-1.1.0?

I have been teaching myself to use Hadoop (2.6.0) and associated applications in the case hive-1.1.0. I am run the hwi server using the information on Hadoop for Dummies page 237, but following the instructions there, I keep running into an error message which says the WAR file is not found in hive-1.1.0/lib.
I had to configure $HIVE_HOME/config/hive-site.xml file to point at where this WAR file is in hive-1.1.0/lib but when i run the command to start the hwi server, it does start but then breaks because in running this command, some of the lines in the path (which should come from my definition in hive-site.xml) are duplicated so the command cannot find the WAR file. I am attaching a screenshot of my hive-site.xml file and the results from what happens when I run the command hive --service hwi.
Relevant part of $HIVE_HOME/config/hive-site.xml file
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="configuration.xsl"?>
<configuration>
<!-- Hive Execution Parameters -->
<property>
<name>hive.metastore.warehouse.dir</name>
<value>/home/hadoop/Hive/warehouse</value>
<description>location of default database for the warehouse</description>
</property>
<property>
<name>hive.hwi.war.file></name>
<value>$HIVE_HOME/lib/hive-hwi.0.12.0.war</value>
<description> This is the WAR file with the jsp content for Hive Web Interface</description>
</property>
</configuration>
On this version of Hive, there was no WAR file, and I copied the hive-hwi.0.12.0.war from hive-0.12.0 as suggested
Results from the following:
[hadoop#fedora21_2 ~]$ hive --service hwi
15/04/05 15:53:02 INFO hwi.HWIServer: HWI is starting up
15/04/05 15:53:04 WARN conf.HiveConf: HiveConf of name hive.hwi.war.file> does not exist
15/04/05 15:53:04 FATAL hwi.HWIServer: HWI WAR file not found at /home/hadoop/hive-1.1.0/home/hadoop/hive-1.1.0/lib/hive-hwi-0.12.0.war
[hadoop#fedora21_2 ~]$
It looks as if when I ran the command to load the HWI service, somehow the command botched up the path to the WAR file as posted in hive-site.xml. Not sure what I am missing here.
change this property from:
<property>
<name>hive.hwi.war.file</name>
<value>{$HIVE_HOME}/lib/hive-hwi-[version].war</value>
</property>
to:
<property>
<name>hive.hwi.war.file</name>
<value>/lib/hive-hwi-[version].war</value>
</property>
You were having the problem because the final execution path became {$HIVE_HOME}/{$HIVE_HOME}/lib/hive-hwi-[version].war
This happened because you are already at the {$HIVE_HOME} directory while reading the configuration file.
So, if you remove {$HIVE_HOME} from your configuration, you get {$HIVE_HOME}/lib/hive-hwi-[version].war which is the correct path.
in your case, [version] = 0.12.0
make a folder inside hive
home/hadoop/hive-1.1.0/lib
and paste all the files of lib in this, then run the command
hive --service hwi
that will work will the time bug is fixed.

Configuration file not found - JBoss7

I wanted to deploy a simple jsp application: I created and copied the myApp.war file to the $JBOSS_HOME/standalone/deployment folder.
Instead of deploying the war file , JBoss created *.war.failed ,
So I thought maybe it's a good idea to restart the jboss to see if it affects the deployment.
In some forums it was suggested to restart the JBoss through : $JBOSS_HOME/bin/jboss-cli.sh
But there was no shutdown or restart command.
While I was trying to restart , I ran the following command :
/usr/local/jboss7/bin/jboss-cli.sh -c ":shutdown(restart=true)"
JBoss stopped working , but it didn't start again.
Now , I want to start it again by :
$JBOSS_HOME/bin/standalone.sh
But it gives me the following exception :
=========================================================================
JBoss Bootstrap Environment
JBOSS_HOME: /usr/local/jboss7
JAVA: /Library/Java/JavaVirtualMachines/jdk1.7.0_71.jdk/Contents/Home/bin/java
JAVA_OPTS: -server -XX:+UseCompressedOops -XX:+TieredCompilation -Xms64m -Xmx512m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Djboss.server.default.config=standalone.xml
=========================================================================
17:29:43,399 INFO [org.jboss.modules] JBoss Modules version 1.1.1.GA
17:29:43,536 INFO [org.jboss.msc] JBoss MSC version 1.0.2.GA
17:29:43,567 INFO [org.jboss.as] JBAS015899: JBoss AS 7.1.1.Final "Brontes" starting
17:29:43,876 ERROR [org.jboss.as.server] JBAS015956: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: JBAS014676: Failed to parse configuration
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:141) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.ServerService.boot(ServerService.java:266) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:155) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
Caused by: com.ctc.wstx.exc.WstxUnexpectedCharException: Unexpected character '*' (code 42) (expected a name start character)
at [row,col {unknown-source}]: [190,160]
at com.ctc.wstx.sr.StreamScanner.throwUnexpectedChar(StreamScanner.java:639)
at com.ctc.wstx.sr.StreamScanner.parseLocalName(StreamScanner.java:1798)
at com.ctc.wstx.sr.BasicStreamReader.handleNsAttrs(BasicStreamReader.java:2975)
at com.ctc.wstx.sr.BasicStreamReader.handleStartElem(BasicStreamReader.java:2926)
at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2802)
at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1050)
at com.ctc.wstx.sr.BasicStreamReader.nextTag(BasicStreamReader.java:1125)
at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.nextTag(XMLExtendedStreamReaderImpl.java:152) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.server.deployment.scanner.DeploymentScannerParser_1_1.readElement(DeploymentScannerParser_1_1.java:85)
at org.jboss.as.server.deployment.scanner.DeploymentScannerParser_1_1.readElement(DeploymentScannerParser_1_1.java:28)
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.server.parsing.StandaloneXml.parseServerProfile(StandaloneXml.java:894) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.parsing.StandaloneXml.readServerElement_1_1(StandaloneXml.java:330) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:127) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.as.server.parsing.StandaloneXml.readElement(StandaloneXml.java:100) [jboss-as-server-7.1.1.Final.jar:7.1.1.Final]
at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.staxmapper.XMLMapperImpl.parseDocument(XMLMapperImpl.java:69) [staxmapper-1.1.0.Final.jar:1.1.0.Final]
at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:133) [jboss-as-controller-7.1.1.Final.jar:7.1.1.Final]
... 3 more
17:29:43,882 FATAL [org.jboss.as.server] JBAS015957: Server boot has failed in an unrecoverable manner; exiting. See previous messages for details.
17:29:43,889 INFO [org.jboss.as] JBAS015950: JBoss AS 7.1.1.Final "Brontes" stopped in 4ms
I searched for the cause of the problem , and I found that probably there's a problem with standalone.xml file.
In /usr/local/jboss7/standalone/configuration/standalone_xml_history I have the following files , but not the standalone.xml
2014xxxx-xxxxxxxx
snapshot
standalone.initial.xml
current
standalone.boot.xml
standalone.last.xml
I'd like to know if I have to rename any of these files to standalone.xml ? (actually I tried renaming standalone.boot.xml to standalone.xml but it didn't work either !) or download a new one ? may I remove these xml files after having the new standalone.xml ?
If JBoss-7 is installed in $JBOSSHOME, the default standalone configuration file is $JBOSS_HOME/standalone/configuration/standalone.xml; $JBOSSHOME/standalone/configuration is the default value of the jboss.server.config.dir property; and running $JBOSSHOME/bin/standalone.sh with no options will start JBoss in standalone mode on Linux/Unix systems.
In order to use a different standalone configuration file it can be renamed to standalone.xml, put in jboss.server.config.dir if it is not already there and standalone.sh run with no options; or its file name can be given to standalone.sh as an argument to its -c option after it is put in jboss.server.config.dir, for example:
$JBoss_home/bin/standalone.sh -c standalone-full.xml
RedHat documentation for this is at https://docs.jboss.org/author/display/AS71/Command+line+parameters
I have had the best success with standalone/configuration/standalone-full.xml since it has the full configuration. It is shipped with JBoss-7. If you don't have it you could download a fresh copy of the distro to get it. What I always do is archive a zip of the distro for recovery in case something gets corrupted or lost in the working copy.

Resources