BPM, Workflow, and Case

 View Only

 Java Service from a Server File – Unable to Add Dependency Libraries

Jump to  Best Answer
Zarko Zunic's profile image
Zarko Zunic posted Tue July 01, 2025 06:44 PM

Hello Friends, 

I am trying to build a "Java service from server file" and I have been partially successful. I created a "hello world" Java .jar file in NetBeans without any external jar libraries, wrapped a service flow around it, and executed the call successfully.

The problem is when I want to work with FileNet, for example, and add necessary libraries like petools.jar and pe.jar. In NetBeans, I build the application with those libraries imported, but once I try to call the Java service from a service flow in BAW, I get an error:

Caused by: java.lang.NoClassDefFoundError: com/filenet/api/core/Factory$Connection
    at javaintegrationbawtest.CEConnection.establishConnection(CEConnection.java:31).

It is clear to me that the class was not found. I tried different settings in WAS to add those libraries — none helped.

How can I make the necessary libraries available to my Java .jar server file?

Where to store dependencies on WAS and how to set it up?

Please refer to the images below for additional info.

NetBeans project builds successfully:

Builded jar is added as server file to my process application:

Java service from server file is created:

Finally, the call fails:

BR

Žarko

Don Williams's profile image
Don Williams  Best Answer

Normally to add dependent libraries, you just add the jar files to the BAW project as Server Files. You may have to add additional dependent jars that those libraries require as well, and you also want to be careful about versions and not to upload something that may conflict with existing WebSphere libraries.

In some cases, I've had to add the jar files directly on the WebSphere path at /WAS_INSTALL_DIR/lib or /WAS_INSTALL_DIR/lib/ext - I forget exactly where - but it's definitely preferable to add them to the process application or toolkit and see if you can get it working that way since the libraries are deployed when the snapshot is deployed.

Hope this helps.

Zarko Zunic's profile image
Zarko Zunic

@Don Williams Don, your answer definitely helped. I tried what you suggested, and it worked. I uploaded the dependency libraries as server files, just like the JAR file that uses them.

Hope I mentioned the right Don

Thank you!

Žarko

Mohammed Shaker's profile image
Mohammed Shaker

Hello,

Another solution is change build target from "jar" to "package for store" to include all your dependencies with your custom java classes into one build and import your jar into your process app and you don't need to add these binaries in all your environment (specially in first deployments)

below is an example

Zarko Zunic's profile image
Zarko Zunic

Thank you Mohammed! @Mohammed Shaker

I will  post again as soon as i try it.

It is an elegant solution.