Monday, February 13, 2017

Install local jars in maven repository

Following command can be used to install local or internal jar files in maven repository.

mvn install:install-file -Dfile=d:/libs/test.jar -DgroupId=com.company.test -DartifactId=test -Dversion=1.0 -Dpackaging=jar

After installing jar files in maven repository, you can use the jar files in maven project as a dependency in pom.xml.

<dependencies>
<dependency>
<groupId>com.company.test</groupId>
<artifactId>test</artifactId>
<version>1.0</version>
</dependency>
</dependencies>

Sunday, February 5, 2017

JBoss EAP6.4 log4j deadlock error

JBoss6.4 is using log4j 'per deployment logging' function. That means, JBoss application server itself adding log4j into application. When using multiple log4j implementations, log4j deadlock scenario may be caused. To avoid that, it can be added 'jboss-deployment-structure.xml' file into JBoss application WEB-INF.

Error message
------------------
"http-/173.12.241.10:8280-4" #109 daemon prio=5 os_prio=0 tid=0x00007fa3e4163000 nid=0x636a waiting for monitor entry [0x00007fa3ae4e7000]
     java.lang.Thread.State: BLOCKED (on object monitor)
     at java.io.PrintStream.flush(PrintStream.java:335)

Solution
------------
jboss-deployment-structure.xml
<jboss-deployment-structure>
<deployment>
<!-- exclude the logging subsystem to disable deployment unit processors from running -->
<exclude-subsystems>
<subsystem name="logging" />
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>