Jump to content

[BW6] Invoke Java method calling class with external imported jars throwing error


bas vink

Recommended Posts

Hi All,

I'm trying to get to grips with BW6 (and Eclipse). I've built a REST service and it's working fine to the extent that I can call it and it returns expected results. However, I am now trying to extend this service to do a "Java Invoke" call. The idea is that I have a bit of java code that uses the tibjmsadmin.jar to check the connection to an EMS server. So far I have done the following:

 

converted the project to a java projected

added the external jars (everything from the EMS/lib directory) via Properties - Java Build Path

built the class (implements java.io.Serializable) with constructors, setters/getters and a method checkConnection.

I've built a 'tester' class with a main() to test my custom class, it works as expected.

I've added the "Invoke Java" activity to my process and wired the inputs/outputs.

 

When I run the BWApplication and do a call to the service, I get the following error (apologies for the stack dump):

ERROR [bwEngThread:In-Memory Process Worker-1] com.tibco.bw.core -

 

www.tibco.com/plugin/java/JavaMethodActivityExceptionjava.lang.NoClassDe...

The method [checkConnection] raised exception [java.lang.NoClassDefFoundError: com/tibco/tibjms/admin/TibjmsAdmin]. [com/tibco/tibjms/admin/TibjmsAdmin].-{ActivityName=JavaInvoke, ProcessName

=eccs.module.Servers, ModuleName=ECCS.module}

TIBCO-BW-PALETTE-JAVA-500037

 

 

TIBCO-BW-CORE-500050: The BW process [eccs.module.Servers] instance faulted, JobId [bw0a100], ProcessInstanceId [bw0a100], ParentProcessInstanceId [-], Module [ECCS.module:1.0.0.qualifier], Applicatio

n [ECCS:1.0].

TIBCO-BW-CORE-500051: Activity [JavaInvoke] fault.

com.tibco.bw.runtime.ActivityFault: The method [checkConnection] raised exception [java.lang.NoClassDefFoundError: com/tibco/tibjms/admin/TibjmsAdmin]. [com/tibco/tibjms/admin/TibjmsAdmi

n].-{ActivityName=JavaInvoke, ProcessName=eccs.module.Servers, ModuleName=ECCS.module}

java.lang.ClassNotFoundException: com.tibco.tibjms.admin.TibjmsAdmin cannot be found by ECCS.module_1.0.0.qualifier

 

What I make of this error (with my limited java knowledge) is that it looks like the method I'm calling is somehow not able to find the supporting libraries for TibjmsAdmin, eventhough this does work fine when I test via the tester class.

I've looked at some example, but none of them use an external class so that's not helping much.

What am I missing

 

EDIT:I have also edited the Environment settings in the Run Configuration for the BWapplication to add the path to the EMS jars in the "PATH" variable. No luck.

Link to comment
Share on other sites

Hi,

i try JAVA invoke like u in designer. I believe u need the ClassPath property in MANIFEST.MF

In my MANIFEST i get:

[...]

Bundle-Version: 1.0.0.qualifier

Bundle-ClassPath: .,./httpcore-4.2.3.jar,./httpcore-nio-4.2.3.jar

Bundle-Vendor: TIBCO Soft....

[..]

In my case is a proof for invoke REST API without REST Palette.

U need reference ur .jar in this file. Then the error NoClassDefFoundErrordisappears

But, when u upload to TEA, this BW crash. I dont know why.

If somebody can help us!!

Cheers

Link to comment
Share on other sites

I eventually solved it by adding the external jars in a different way. After you make the project "Java", you right-click on the "lib" directory and select "import -> Import -> File System" and then select the jars you want to add. That adds the jars to the project correctly. 

 

I've haven't deployed anything to TEA yet, still messing around in Eclipse. Getting slightly frustrated that changing something on one end tends to break a lot of stuff on the other end. I tried to add an extra service to my REST and it broke the whole service, can't call it anymore. 

 

I understand that BW6 has a learning curve, but I didn't think it would be this frustrating. 

Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...