I am new to J2EE and I try to create a javaagent which is dependent on a class which is not inside its JAR file. I try to simulate a situation I have on my remote server. I need a way to include the class.
My deployment:
- WebSphere server which I run from Eclipse, I use the server to run a simple 'hello world' web application. * The WebSphere server is mendatory for my example *
-
I added a simple javaagent which writes to a file on the server. I added the javagent via 'jvm.option' file I added in the server profile * It was tested and works - file created with static text * The string I write is:
String content = "This is the content : " + Ahelper.getValue();
This javaagent has a preaty simple structure, it has one .class file which has the premain function which writes the file and a manifest file.
-
The Ahelper class is the class I want to included from outside the JAR. It doesnt have any main or premain function and only has the function I call:
public static int getValue() { return 42; }
I tried compiling the Ahelper class and add it to WEB-INF/classes (inside a folder with the name of its package) but it didnt work. I also added a line in the javagent manifest:
Import-Package: helpers.Ahelper
Where helpers is the package of the file.
I am looking for a solution where I add the .class (or maybe I should create a JAR file?) in some folder and maybe specify its path in web.xml or something like that but I cant find any.
Any ideas/solutions?
Aucun commentaire:
Enregistrer un commentaire