Configure patched module in jboss eap 7 - jboss-cli

We use eclipselink in our applications therefore we configured JBoss to use eclipselink as persistence provider. We configured this by putting the eclipselink.jar into the following path:
JBOSS_HOME/modules/system/layers/base/org/eclipse/persistence/main
In addition we have changed the module.xml accordingly. After that we could use it and it worked fine.
Now we want to configure the jboss with a command line script to avoid manual work. In addition the jboss should be patched to the current patch level (jboss eap 7.0.7).
After applying the patch the eclipse persistence module is in the following path:
JBOSS_HOME/modules/system/layers/base/.overlays/layer-base-jboss-eap-7.0.7.CP/org/eclipse/persistence/main
With a later patch the path could be different therefore we don't want to copy files in absolute paths.
Is it somehow possible to use the jboss-cli to configure this module (add jar and change module.xml)?

You can use
module add --name=MODULE_NAME --resources=PATH_TO_RESOURCE --dependencies=DEPENDENCIES --module-xml=YOUR_MODULE.XML
--module-xml - (used with add, optional) filesystem path to the module.xml
file which should be used for the added module. The file will
be copied to the created module's directory. If this argument
is not specified, module.xml file will be generated in the
new created module's directory.
MODULE_NAME should be org/eclipse/persistence/main in your case

Related

Installing Log4J 2 on Windows 10

I am trying to install log4j (2) on Windows 10. I downloaded and extracted log4j from https://logging.apache.org/log4j/1.2/download.html
However I don't know what do add to the path variable or how to call log4j on windows 10.
The latest steps on Linux for log4j where:
$ export CLASSPATH=$CLASSPATH:/usr/local/apache-log4j-1.2.15/log4j-1.2.15.jar
$ export PATH=$PATH:/usr/local/apache-log4j-1.2.15/
The Problem here is, as far as I know, Windows has no classpath and there is no log4j.jar file just log4j-core and log4j-api (and similar) jars.
If someone could help me set this up correctly I'd greatly appreciate this.
Log4j does not require installation. It is a set of libraries. You should not specify the CLASSPATH as a system-wide environment variable (however it is acceptable). If you want your application make use of log4j you should propagate the class path to log4j libraries as a parameter to java.exe. If you need those libs on development phase you should either specify the path in your IDE project settings (the way how to do this is specific for each particular IDE), or, if you use standard maven project type, specify the appropriate dependency in pom file so that IDE takes care of proper classpath configuration.
Please also refer to this post helping you to get started with log4j.

How to force Jetty to redownload a modules external libs after Jetty home upgrade

I've split up my Jetty installation from my configuration by using the "Jetty Base and Jetty Home" mechanism.
This made it very easy to upgrade Jetty 9.4.3 to 9.4.6 by just referencing to the new Jetty home directory.
In my Jetty base directory I have activated the cdi module, which had downloaded various lib files under {$jetty.base}/lib/cdi.
Although Jetty 9.4.6 has new versions of the weld framework referenced in its module description, those libs in my Jetty base directory did not get updated automatically. What is the recommended way to update these libs?
Deactivating the module, deleting the libs and reactivating it feels a little bit odd...
Add --create-files to your start.jar command line once.
If the module is defined properly (sometimes it isn't. if so, that's a bug), only the specific jar files needed are referenced, not the old ones.

How to externalize i18n properties files in spring-boot applications

I’ve succeed to externalize my spring-boot configuration file (application.properties) in a config folder when I run my spring-boot application as a unix service with the help of the official spring documentation https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html
I have also some i18n messages.properties files in my src/main/resources that I would like to externalize in the same config folder but I failed to do it. I’ve tried a lot of things, like playing with spring.messages.basename but unfortunately, it doesn’t work.
I’m using the latest version of spring-boot, and use auto configure mode with the default i18n properties name messages.
What am I missing??? thanks for your help.
Just a few notes:
classpath:message - will always lookup embeded message_xxx files
classpath:/message and classpath:message are equivalent
file:message - will lookup jar's external current directory e.g. ./message_en.properties <- this is what you want
file:/message - you have to put your message files to root "/" to make it work
use notation file:config/message if you need to put in config folder together with your
./config/application.properties
I think you need a leading slash.
Try: spring.messages.basename=classpath:/config/messages
I think, resource bundle is default to classpath. So there's no need to append it. just go straight to your folder location from classpath.
Try this: **assuming your config is inside static folder
spring.messages.basename=static/config/messages

JDBC Driver class not found: oracle.jdbc.OracleDriver

I have installed a third party java webservice which uses Oralce jdbc thin driver to write data into Oracle database. When i run this, i get the following error;
JDBC Driver class not found: oracle.jdbc.OracleDriver
I have oracle installed and set classpath variable to following value:
*D:\oracle\product\10.2.0\client_1\jdbc\lib\classes12.jar;D:\oracle\product\10.2.0\client_1\jdbc\lib\classes12.zip;D:\oracle\product\10.2.0\client_1\jdbc\lib\ojdbc14.jar;D:\oracle\product\10.2.0\client_1\jdbc\lib\ojdbc14.zip;C:\Program Files\Java\jdk1.7.0\jre\lib\rt.jar*
and path variable to following value;
*D:\oracle\product\10.2.0\client_1\bin;C:\Program Files\Java\jdk1.7.0\bin\;D:\oracle\product\10.2.0\client_1\jdbc\lib\classes12.jar;D:\oracle\product\10.2.0\client_1\jdbc\lib\classes12.zip;D:\oracle\product\10.2.0\client_1\jdbc\lib\ojdbc14.jar;D:\oracle\product\10.2.0\client_1\jdbc\lib\ojdbc14.zip*
Any suggestion why web service is not able to identify jdbc driver?
Thanks
I know 2 ways of turning Java app into Windows service and both do not use CLASSPATH. One is Java Service Wrapper by Tanuki Software. This tool uses wrapper.conf where you can show directories with .jar libraries:
# Java Classpath (include wrapper.jar) Add class path elements as
# needed starting from 1
wrapper.java.classpath.1=c:\jars\*
wrapper.java.classpath.2=myservice.jar
Second tool I know is JSL: Java Service Launcher. In this tool there is jsl.ini where you put command line to run your server. It can use java with -cp option to show location of .jar libraries:
[defines]
MY_LIBS=d:\jars\*
AXIS_LIBS=d:\axis2-1.5.4\lib\*
CLASSPATH=.;%MY_LIBS%;%AXIS_LIBS%
export = CLASSPATH
...
[java]
...
cmdline = -Dfile.encoding=utf8 -cp %CLASSPATH% example.my.server
In both configuration you can use * to add all .jar files or you can show those files one by one (just like in CLASSPATH).
At first you should know what Windows is trying to execute. Check it in the service properties page. Then try to localize its configuration. If it uses one of tools I know then you know what to change. Other tools probably have similar configuration.
Method 1:
Download ojdbc.jar
add ojdbc6.jar to deployment assembly.
Right click on project->properties->select deployment assembly->click on 'Add'
->select 'Archives from File System'->browse to the folder where ojdbc6.jar is saved.->add the jar->click finish->Apply/OK.
Method 2:
if you want to add ojdbc.jar to your maven dependencies you follow this link:
http://www.mkyong.com/maven/how-to-add-oracle-jdbc-driver-in-your-maven-local-repository/
.
.
Even if you're using a maven project it is not necessary to add ojdbc to maven dependencies(method 2), method 1 (adding directly to deployment assembly) works just fine.
Make sure you have the ojdbc jar file (make sure you are using the correct one because depending on java version you may need to choose a different one).
use ojdbc14.jar for Java 1.4
use ojdbc5.jar for Java 1.5
ojdbc6.jar for Java 1.6
here is linke where you can download ojdbc6.jar file
http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-112010-090769.html
You also have to add the jdbc jar to your server classpath. if tomcat, rigth-click on your Project->run as->run configurations, click on classpath and add your jdbc jar in Add external jars option
add ojdbc-6.jar to your lib directory of tomcat installation. Maven will downlowd this jar for you in .m2 directory, but you need to have this jar in tomcat lib as well.

Shared Library websphere

I want to create share library in Websphere Application Server. I have abc.jar inside abc folder. I want to know the difference between specifying c:\abc Vs c:\abc\abc.jar in the classpath
If c:\abc contains other jars, they will also be added to the classpath. If c:\abc contains non-jar files (e.g., c:\abc\test.properties), then c:\abc will be added to the classpath itself, which allows getResource calls for the directory to work (e.g., ClassLoader.getResource("test.properties") will find the file).

Resources