Coould not initialize a jars from java service

Hello,
I create a java service in a package to read an excel file. For this I needed some jars files (for your information these jars are poi* from 3.17 versions).
In my development environment I have no problem :

  • A project was created in my workspace and this project refer to this jars file
  • In Integration server, in my package I have my jars files in lib folder. So in runtime that’s work.

But when I deploy my project in preprod environment, I found my jars in lib libraries of packages in integration server (so no problem). But when I debugg my flow service which use my java service I have a could not initialise class exception.

You have to know that in Development server SAG was installed on :\app\softwareag folder and in preproduction server it is installed on (the same):\app\SoftwareAG folder (in camel casing). I don"t expect a problem of casing but just in cas I ask.

My SAG Version is 9.10

Thanks

Hi Vital,

as long as the jar is only needed by this package it should be under IntegrationServer/instances/default//code/jars.
When it needs to be under lib directory of IS it should be in IntegrationServer/instances/default/lib/jars/custom.

The CamelCase should not be a problem.

Regards,
Holger

I confirm in my two servers the folder is IntegrationServer/instances/default//code/jars

But in dev : the root is E:\app\softwareag
In PProd : the root is E:\app\SoftwareAG

Hi Vital,

as pointed out already, the installation directory should not matter in this case.

The pathes where IntegrationServer looks up jar files should be relative to the instance directory, default in this case.

Regards,
Holger

Thanks Holger,
So I don’t understand why m’y java service work on dev environment and not in preprod environment.
Is There Any path to configure or any service/program to activate for calling jars when java service using jars are not created in the same Integration server ?

Hi Vital,

package needs to be reloaded after adding the jar to get the jar loaded into the JVM.

How did you deploy the package?
Evnetually you will have to recompile the Java-Service on the target.

Regards,
Holger

Hi Holdger,
I reloaded the package but I have still the same error. I used the deployer to deploy in preprod.
I don’t know how to recompile the java service in target

Please tell us exactly which files you deployed. It might be that you forgot some fles and that rendered the java service unusable. Normally, you should not compile anyhing in the target environment. It should just work after the deployment.

Ok : I have a package (I call it Pkg1 here) containing a Java service named xlsReading and another flow service xlsRead which called the Java service.
From my Java Service I call some classes from some jars prefixed by poi.
For compilation in my designer I use Java EE perspective and in my project in build path, I référence my jars. Automatically that copied my jars in integration server in Pkg1/code/… folder and my flow service work.
I create a build in deployer containing the Pkg1 package. I deploy it in my other environment (preprod). After deploying in file system I see my flow service, my java service and the jars I used in my java service. I even reload the package. But when I connect in the target environment in my designer and I called my flow service in debug I have a target invocation exception corresponding to a class including in jars file

I’m sorry but without the knowledge about the exact structure of your package (which folder contains which files) I can’t help.

It seems to me that you can compile locally in designer but the package has a wrong structure so that the server can’t find files/classes where it expects them.

Im sorry : my package make 14 MB, I can not upload it here.

I find my solution with the forum :

[url]http://tech.forums.softwareag.com/techjforum/posts/list/56376.page[/url]

Ok :
obviously I have to modify my manifest.v3 file of my package and add the following line :

<value name="classloader">package</value>

It’s seems obscure for me but it’s work.

1 Like

Thank you for posting the solution! My understanding is that the class that can’t be initialized (part of the POI lib?) uses some other lib that is present in the IS but has an incompatible version. Hence one has to take action so that the version you provide is loaded first (and not the one provided by the IS). Now it would be interesting to know which library causes the conflict.