I am writing an Axis2 client which will not have access to a repository folder on the filesystem. Is there a way to load the modules which axis need for instance rampart and addressing, from the classpath.
you can add the .mar files to the class path. Axis2 can pick the .mar files in the class path as module files.
Simply install axis2 on your filesystem and add it's lib directory to the CLASSPATH. You can set it system wide or create batch/shell script to run your client. I prefer batch/shell script where I can also set some other options. With axis2 libs it can look like:
SET CLASSPATH=my_axis_client.jar;c:/axis2-1.5.1/lib/*
java -Dfile.encoding=utf8 yyy.zzz.my_axis_client
If you work on unix then instead of such
SET CLASSPATH=...
use
export CLASSPATH=my_axis_client.jar:/my/axis/lib/*
(be aware, on unix use : instead of ; to separate directories in the CLASSPATH)
Related
In order to run the application in my local, i need to provide some VM arguments(basically file path, where it is located). In similar way in PCF also I have to provide those arguments.
currently I am keeping in application.yml file like below.
jaas:
conf: /home/vcap/app/BOOT-INF/classes/nonprod_jaas.conf
krb5:
conf: /home/vcap/app/BOOT-INF/classes/krb5.conf
trustore:
conf: /home/vcap/app/BOOT-INF/classes/kafka_client_truststore.jks
When I deploy the application in PCF, will these files will be read from that location.
Basically I want to know this is correct way or not to provide the arguments in PCF.
how to check whether the file is present in that location, /home/vcap/app/BOOT-INF/classes/
You need to ssh into the container to check the location of the file.
cf ssh appname
In spring, #Value enables the use of the classpath: prefix to resolve the classpath (see this link) https://www.baeldung.com/spring-classpath-file-accessclasspath: It means you need to set this programmatically not via the variables in yml. Then you don't need to provide the path the way you are doing.
Also classpath: is a Spring specific convention, the JVM doesn't understand it which means you cannot use it directly in application.yml file. If you need to set in yml or as environment variable - you need to give it a full or relative path. On PCF, you can use /app or /home/vcap/app (the former is a symlink to the latter) as the path to the root of your application.
I have written a java Servlet web application, using NetBeans 7.2.1. The program have some jar file libraries that I have attached to the project. The application runs fine using NetBeans and Apache Tomcat 7.0.27.
My problem is that some of the jar file libraries that I am using in the project, need to access to some folders and files. I put these folder and files on the same directory as the whole NetBeans project is. but I got this exception:
Exception: java.lang.RuntimeException: java.io.FileNotFoundException
So I used these codes to find out where should I put them:
out.println("current directory: " + new File(".").getAbsolutePath());
out.println("current directory: " + System.getProperty("user.dir"));
out.println("current directory: " + getServletContext().getRealPath(("/")));
So I figured out that the current working directory is:
C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.27\bin
My question is that how can I set different directory address for each web application? I have many web applications and some of them use the same resource file names. I can't just put all of them in one directory.
Please note that I don't have access to the source code of jar files to change the. I just need a way to set the absolute path that the jar files use.
I have the same problem when I put the WAR file on the unix server. The extracted WAR file is in this location on the server:
/data02/tools/Apache/Tomcat/apache-tomcat-6.0.37/webapps/BANNEROnline
But I figure I should put the resource folders and files in this path (moosavi3 is my username!):
/home/moosavi3
How can I change the path?
The working directory is the directory from which java.[exe,bin] is started. I assume the bin directory is where the tomcat start-up script is? If the jars are all using this working directory I don't believe there is a way to make different web-apps have different working directory, they're all loaded on the same jvm (java.exe) from the same working directory.
A working directory is the directory from which a binary is started, it is not some arbitrary value that you can change.
I suspect these jar files where meant to be run as standalone applications and expected the filesystem resources they are trying to access to be in the same location as themselves.
Any filesystem resources would have to be moved to the location of your java.exe so that the correct file path resolution can result from your jars.
Standard Servlet project requires external libraries to be placed in the 'WEB-INF/lib' directory under project root. You can search google for 'servlet directory structure' and do your own research for more information. Shared libraries between web applications can be placed in the 'lib' directory under tomcat root, they should be picked up by tomcat jvm. My recommendation would be to keep the dependencies project specific, because you may need different versions in different projects in the future.
Update:
Read this page on the tomcat documentation, it will explain exactly how the project should be structured, and how to add a library that will be shared across all web applications:
http://tomcat.apache.org/tomcat-7.0-doc/appdev/deployment.html
Update 2:
The following Stackoverflow link explains several options how to add a static file to your web application, that will available at runtime.
https://stackoverflow.com/a/2161583/940754
Update 3:
Add a path to the classpath using the project's manifest:
http://docs.oracle.com/javase/tutorial/deployment/jar/downman.html
Is it possible (and if: how?) to set up JBoss AS7 to use his own modules dir and an additional custom modules.custom at the same time? If so, I would not have to mix my custom entries with the default entries.
you can do that by setting JBOSS_MODULEPATH env variable to include more than just your folder.
For instance configuration like this
set JBOSS_MODULEPATH=%JBOSS_HOME%/modules;/path/to/my/modules
it would add /path/to/my/modules to path of modules. But just make sure you still keep default folder in your module path.
for more you can take a look at standalone.sh/bat and look how this variable is used.
(if you are on mac or unix, use export and colons)
export JBOSS_MODULPATH=$JBOSS_HOME/modules:/path/to/my/modules
I have an application which acesses a lot of property files. In jboss 5.1 we can load this from the conf directory. I would like to know if there is any such way of loading the property files in weblogic 10.3 .
I don't want to include it in an jar and place in the lib,since these property files are configurable files. The user needs to configure certain properties of the application.
Also placing the property files in the domain directory is not very good and I also would like to know if there is any other way of achieving the same .
Regards
Raj
You can place the properties files needed by your application(s) to the classpath of Weblogic and then remove the files from your WAR/JAR/EAR.
If you choose a specific folder that is not yet in your classpath, just log on the Weblogic console, and navigate through Environment -> Servers -> [Your server name] -> Configuration -> Server Start
Now it is just about adding the folder containing your properties file(s) to the classpath.
I am writing an application which will be deployed in weblogic. As part of this application, we are using a third party library which uses JNI. How do I make the .so file available to weblogic?
I tried setting the LD_LIBRARY_PATH and restarting weblogic with no luck
The LD_LIBRARY_PATH environment variable should be set in the setWLSEnv.sh or the startWLS.sh scripts.
Can you show us where and how you did that?
You can include the path of the .so files for LD_LIBRARY_PATH in the commEnv.sh . In <WL_install_dir>/common/bin/commEnv.sh based on your OS case block you can update with .so folder like below
LD_LIBRARY_PATH=/usr/vardhan/SOfiles/:${PATCH_LIBPATH}:${LD_LIBRARY_PATH}
export LD_LIBRARY_PATH
Obviously after updating you need restart all the services.