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

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.

Related

Sonarqube 9.6.1 not starting - Windows10 cmd

I've set the environmental variable SONAR_JAVA_PATH.
It's taken in the SonarServiceWrapper.xml
<!-- Path to the Java executable. To be replaced by SonarService.bat script -->
<executable>D:\Programmes\Java\jdk-13.0.2\bin\java.exe</executable>
<!-- DO NOT EDIT THE FOLLOWING SECTIONS -->
<arguments>
-Xms8m -Xmx32m
-Djava.awt.headless=true
--add-exports=java.base/jdk.internal.ref=ALL-UNNAMED
--add-opens=java.base/java.lang=ALL-UNNAMED
--add-opens=java.base/java.nio=ALL-UNNAMED
--add-opens=java.base/sun.nio.ch=ALL-UNNAMED
--add-opens=java.management/sun.management=ALL-UNNAMED
--add-opens=jdk.management/com.sun.management.internal=ALL-UNNAMED
-cp "..\..\..\lib\sonar-application-9.6.1.59531.jar" "org.sonar.application.App"
</arguments>
<id>SonarQube</id>
<name>SonarQube</name>
<description>SonarQube</description>
<logpath>../../../logs</logpath>
<log mode="none"/>
</service>
No error in the command line.
Only one log file SonarServiceWrapper.wrapper.log with this line :
2022-10-11 12:26:01,286 DEBUG - Starting WinSW in console mode
I've tried with jdk-11.0.2, jdk-13.0.2 and jdk-19 : same thing
Add the following system environment, Ex:
SONAR_JAVA_PATH : C:\Program Files\Java\jdk-11.0.17\bin\java.exe
In StartSonar.bat, i've commented
REM call :check_if_sonar_is_running FAIL || goto:eof
Next, i use jdk-11.0.2
And sonarqube is up

Why does Test Connection fail in Wildfly 20 Using SQL Anywhere sajdbc4 driver?

I had Wildfly 10 running previously and have just upgraded to Wildfly 20 (under Ubuntu 20). My configuration from Wildfly 10 no longer works when it comes to getting the Sybase SQL Anywhere 17 sajdbc4 driver working. When I "Test Connection" it fails. I am using the same configuration and testing against the exact same (SQL Anywhere High Availability) database server.
"Test Connection" on the following Datasource triggers an "Invalid ODBC handle" error:
<datasource jndi-name="java:jboss/datasources/TestDB" pool-name="TestDB" spy="true" tracking="true" enlistment-trace="true">
<connection-url>jdbc:sqlanywhere:Host=192.168.1.45:19000,192.168.1.45:19001;ServerName=TestDB</connection-url>
<driver>sajdbc4.jar</driver>
<security>
<user-name>...</user-name>
<password>...</password>
</security>
</datasource>
Connection is not valid
Caused by: java.sql.SQLException: Invalid ODBC handle
at deployment.sajdbc4.jar//sap.jdbc4.sqlanywhere.IDriver.makeODBCConnection(Native Method)
at deployment.sajdbc4.jar//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
How I set this up:
I used the console to Deploy the sajdbc4.jar and that appears to work fine. I see no errors and sajdbc4 shows up as Deployed in the console and it also shows up as a JDBC Driver in the Subsystems. Here is what was created in standalone.xml after using the console:
deployment name="sajdbc4.jar" runtime-name="sajdbc4.jar">
content sha1="b690ff7a8ba1a3c2e8dd5079138b7970d969c2b9"/>
/deployment>
(I had to drop the leading angle brackets to get the previous lines to show - even when marked as Code!)
Next I had to ensure that the java.library.path and classpath included the path to the sajdbc4.jar and its support files so Wildfly can find them. To do so I added the "HACK" to the following in standalone.conf:
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/sybase/main -cp .:/opt/wildfly-20.0.1.Final/modules/system/layers/base/com/sybase/main/sajdbc4.jar"
echo "Java Properties Next:"
java -XshowSettings:properties -version
else
echo "JAVA_OPTS already set in environment; overriding default settings with values: $JAVA_OPTS"
fi
Finally, I added the datasource block shown at the top. After starting Wildfly TestDB shows up as a Datasource in the Datasources Subsystem but when I Test Connection I get the "Invalid ODBC handle" error.
I feel confident that the driver and all its support files are "working" because I have a very simple Java test app that just makes a connection to TestDB, fetches from a table and displays the rows. Note that it uses the exact same java.library.path and classpath as I set in standalone.conf:
cd $HOME/Desktop
export LD_LIBRARY_PATH=/opt/wildfly-20.0.1.Final/modules/system/layers/base/com/sybase/main
export CLASSPATH=.:/opt/wildfly-20.0.1.Final/modules/system/layers/base/com/sybase/main/sajdbc4.jar
java sajdbc4DriverTest.java
Note that server.log shows no errors and in fact shows lines like:
[org.jboss.as.server.deployment] (MSC service thread 1-3) WFLYSRV0027: Starting deployment of "sajdbc4.jar" (runtime-name: "sajdbc4.jar")
...
[org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-4) WFLYJCA0005: Deploying non-JDBC-compliant driver class sap.jdbc4.sqlanywhere.IDriver (version 4.0)
[org.jboss.as.connector.deployers.jdbc] (MSC service thread 1-3) WFLYJCA0018: Started Driver service with driver-name = sajdbc4.jar
[org.jboss.as.connector.subsystems.datasources] (MSC service thread 1-3) WFLYJCA0001: Bound data source [java:jboss/datasources/TestDB]
...
[org.jboss.as.server] (Controller Boot Thread) WFLYSRV0010: Deployed "sajdbc4.jar" (runtime-name : "sajdbc4.jar")
Note that my connection string is for connecting to a SQL Anywhere High Availability system (hence the two URLS). In Wildfly 20 I see that there is now a new "HA URL Separator" field in the console's Datasource definition page. I tried setting that to a comma and that just changed the Test Connection error to "Unable to create connection from URL":
2020-08-25 11:45:08,378 WARN [org.jboss.jca.core.connectionmanager.pool.strategy.OnePool] (External Management Request Threads -- 1) IJ000604: Throwable while attempting to get a new connection: null: javax.resource.ResourceException: IJ031085: Unable to create connection from URL: jdbc:sqlanywhere:Host=192.168.1.45:19000,192.168.1.45:19001;ServerName=TestDB
at org.jboss.ironjacamar.jdbcadapters#1.4.22.Final//org.jboss.jca.adapters.jdbc.local.LocalManagedConnectionFactory.getHALocalManagedConnection(LocalManagedConnectionFactory.java:381)
How do I get "Test Connection" to work?
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.

WildFly - is missing [jboss.naming.context.java.jdbc.__TimerPool]

I have followed this manual to migrate from GlassFish to WildFly:
http://wildfly.org/news/2014/02/06/GlassFish-to-WildFly-migration/
However I'm getting the following error when running my application in WildFly:
ERROR [org.jboss.as.controller.management-operation] (Controller Boot Thread) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "exampleProject-ear-1.0-SNAPSHOT.ear")]) - failure description: {"WFLYCTL0180: Services with missing/unavailable dependencies" => [
"jboss.persistenceunit.\"exampleProject-ear-1.0-SNAPSHOT.ear/exampleProject-web-1.0-SNAPSHOT.war#exampleProjectPU\".FIRST_PHASE is missing [jboss.naming.context.java.jdbc.__TimerPool]",
"jboss.persistenceunit.\"exampleProject-ear-1.0-SNAPSHOT.ear/exampleProject-web-1.0-SNAPSHOT.war#exampleProjectPU\" is missing [jboss.naming.context.java.jdbc.__TimerPool]"
]}
The error talks about jboss.naming.context.java.jdbc.__TimerPool. Any idea of what should I do? I'm using WildFly 10 and MySQL as database.
Forget about this. __TimerPool was the name of a Datasource in GlassFish and I was using it without knowing it, I simply removed the persistence.xml file that contained it and it worked.
Check your standalone.xml. It must be having a datasource with pool-name "exampleProjectPU" . Something like this. Please remove the full xml block.
<datasources>
<datasource jndi-name="xxx:exampleProjectPU" pool-name="exampleProjectPU" enabled="true">
<connection-url>jdbc:oracle:thin:#//host:port/SID</connection-url>
<driver>oracle</driver>
<security>
<user-name></user-name>
<password></password>
</security>
</datasource>
Go to deployments folder and check if there is any sample project with name "example project.war". If yes, remove it and start the server again. It should work fine.
try to change your mysql-connecter to bin file like mysql-connector-java-5.1.47-bin
make sure the name in is the some in jndi-name

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.

Jenkins slave running Maven gives log4j warning

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

Resources