connecting To Java Application from IS

What is the best way to connect to a JAVA application from the webmethods integration server

Thanks
Krishna

This depends. You can connect to a Java application remotely via Web services, for example. Or, if your Java app is an EJB running inside an app server, you can connect to it, also remotely, from the Integration Server using the EJB adapter. Or you can let your Java app run inside the Integration Server as a native service. It really depends on your desired architecture and choice of protocols etc.

Hope this helps …

Michael

hi,

can i remotely invoke an ejb without the use of the ejb adapter?

thanks
kenny

Yes. You can create a java service that uses Remote Method Invocation (RMI) to invoke EJB methods running in a app server. This is not too tough for java programmers who are able to write EJB’s or the java clients that invoke them, but is too complex for inexperienced java programmers or those who have not developed many webMethods java services.

The complexity comes from the need to connect to the app server, instantiate the EJB, invoke any methods you might need and map the attributes of the objects those methods return to the IData objects (records) you want your java service to return.

Other options for invoking EJB methods include:

  • Use the WmJBoss package to host the EJB locally and generate “virtual services” for the EJB’s public methods that allow them to be invoked as easily as any other built-in or custom service in IS.
  • Use webMethods Glue to expose EJB methods as web services and use web services connetors in IS to run those services
  • Use the EJB adapter

Hope this helps,

Mark Carlson
mcarlson@conneva.com

Thanks for the prompt reply Mark.

When you say using RMI to invoke an EJB on the app server, do you mean using JNDI? i.e. get the initial context, and lookup the ejbhome and so on etc.

regards
Kenny

Yes. I used this approach for multiple interfaces to EJB’s on a remote BEA Weblogic server in my last project.

My observations from building both a web services and a RMI java service version of the same interface were:

  • If each EJB method was exposed as a “fine-grained” web service, it was more work to build soap messages to invoke them than to make the EJB calls from a java service
  • If the EJB methods returned complex java objects, it was significantly easier to extract the results from the documents returned by the web services than to right java code to traverse the complex objects returned by the EJB calls and map them to IData objects (records) to be returned from the java service.
  • The RMI java service approach was only slightly faster than the web services approach, despite the use of very large schemas and soap messages. To be fair, most of the time spent on the java service side was attributed to the JNDI lookup and instantiating the initial context rather than in invoking the public methods.

In essence, while the web services took more work to invoke because of the need to assemble a soap message for each invocation, they provided a major productivity gain when it came to processing the results due to the ability to use IS built-in services to process the documents.

In addition, with very little work on the EJB side more “course-grained” web services could be used to expose the EJB methods reducing the number of web services invocations.

Mark

Boy am i glad you’ve done the RMI invocation already…
I totally agreed that web service should be use for coarse-grain services due to its document-oriented nature.

I’m trying to do remote ejb invocation from the IS java service but i keep hitting the java.lang.InvocationTargetException. Have you encounter this before?

I’m using IS6.01 without any SP (running jdk 1.3), and calling a ejb on weblogic 8.1 (running jdk 1.4)

The client jar for your EJB as well as the Weblogic client jar file(s) needs to be in the server’s classpath. The client jar for your EJB needs to have the same method signatures and objects as the ones on your application server.

What worked for me was to get a java test client working from the command line and then convert that into a webMethods Java service. Often the developer of the EJB you are using has already created a test client that you can use for this purpose. Work through any class path or connectivity issues with the test client and then add the jars you need to your IS class path. Turn the main() method from the test client into a java service and consider placing any helper classes in the common section of the java service.

Good luck,

Mark

when i place the jar files into the lib/jar directory or edit the
APPEND_CLASSPATH (in server.bat) to include them, i get
InvocationTargetException: NoClassDefFoundError

but when i edit the APPEND_SYSTEM_CLASSPATH to include the jar files, i get
InvocationTargetException:
java.security.auth.callback.NoCallbackHandlerException

My EJB client codes are running fine in a standalone JVM.

regards
Kenny

oops… I realise i was using weblogic.jar instead of wlclient.jar. when i which over and path them with the APPEND_SYSTEM_CLASSPATH, the error on top disappears.
But i hit another error

java.lang.NoClassDefError: org/omg/CORBA/LocalObject

i found something that could be the likely source of the problem.
My EJBs are running in weblogic 8.1 using jdk 1.4. But the IS is running in jdk 1.3
and jdk 1.3 does not have this particular class.
but IS 6.01 can’t run on jdk 1.4

any advise?

regards
Kenny

Support for JDK 1.4 was introduced as part of the IS 6.1 release. On Windows platforms both the IBM 1.3.1 and Sun 1.4 JRE’s are provided although the default is IBM 1.3.1. The 1.4 JRE is located in your “<webMethods_root>\jvm\win142” folder and you can use it by modifying the “server.bat” script in your IntegrationServer\bin folder.

What JDK version are you using for your standalone test client? You should run your test client using the same version of Java used by your IS installation for the most accurate testing scenario.

Work with your in-house CORBA experts to get their assistance with your CORBA interoperability issues if you can.

Mark

Kenny,
I agree with Mark. But here are the few tips:
1- Make sure you start the IS with Suns JDK1.4 as weblogic8.1 requires Sun s JDK1.4.
IS comes with IBMs and Suns JDK. You can change the server.bat -%IS_DIR% variable.
2- Create a subdirectory under IS\lib as “system”.
3- so now you have 2 subdirectories- IS\lib\jars and IS\lib\system.
4- drop the weblogic.jar and your deplyedbean.jar file in IS\lib\system.
5- dont modfify the “APPEND_SYSTEMCLASSPATH” variable in server.bat. if you have added something in it, you can remove those.
6- restart the IS.
7- It should work.

OR
Use the Suns’s jdk supplied with IS and try to run your standalone client and if it works, then the above option will definitely work.

Thanks
Vijay

Thanks guys…

i tested my standalone client in jdk1.4 and it works. but when i ran it on jdk1.3, i hit the error i’ve mentioned in earlier postings

i’m actually running IS6.01, which does not support jdk1.4. in fact, when i try to use jdk1.4 to start IS6.01, it couldn’t even start; giving me a java.lang.ExceptionInitializerError traced to the javax.crypto.cipher class.

you guys mentioned about the newly release IS6.1. I’ve read the release notes, but just how similar is it to IS6.01? At least in terms of stability.

To remove “java.lang.ExceptionInitializerError traced to the javax.crypto.cipher class” error with jdk1.4, rename the “jce.jar” to “jce.jar.org” so it will not load.

Can you do 2 things now to get you working with IS6.0.1, EJB Adapter:
1- rename the “jce.jar” to “jce.jar.org” or some name except .jar extension.
2- run the IS with jdk1.4.

Thanks
Vijay

Anothe thing- this jce.jar is in <jdk1.4>\jre\lib folder.

i’m actually running IS6.01, which does not support jdk1.4. in fact, when i try to >>use jdk1.4 to start IS6.01, it couldn’t even start; giving me a >>java.lang.ExceptionInitializerError traced to the javax.crypto.cipher class.

Integration Server 6.0.1 has actually supported JVM 1.4.x since service pack 1 (except on AIX). If you are up to the current recommended patch level Service Pack 2, it is relatively easy to switch over to 1.4.x. You do have to handle a conflict over the JCE (Java crypto libraries) because webMethods provides its own libraries and you have to rename or remove the jce.jar in the JVM’s lib directory. The directions may be found in
\IntegrationServer<a href="/servicepacks/svc_pack-20030808-123220/is_readme.txt" target="_new">IS_6-0-1_SP2_README.txt

Thanks. finally got the thing working with the modified JDK 1.4.

I currently running IS6.01 without the service packs. has been trying to get them for some time but it wasn’t available to my account. It’ll definitely be better to use the SP so as to have official support from WM for JDK 1.4.

cheers
Kenny

Hi Guys,

I am trying to invoke an Sessiuon EJB written in webLogic 8.1 from IS 6.01 without using the EJB adaptor.

And i am getting an Exception as org.omg.stub.._._Stub

java.lang.ClassCastException: Unable to load class: org.omg.stub.ejb.bean.addnum._AddNumbersHome_Stub

How do is get over this. i went thru the above messages to find any clues. I can call EJB from my standalone java client. and i have put in the same code in my java services.

It looks like the problem is in the PortableRamoteObject.narrow(…), and at this point i do not have a clue how to get over the errors.

I have put my client as a .jar file in the jar folder of my package and i am accessing that class from a service on IS. Am i missing to include anything in class path… etc… The strangest part is the same client code is working as standalone class file.

Please let me how is shoule go abut this problem…

Any help on this is greatly appriciated.

Thank you,
Ranjith.

I am not familar with WL, but I will give some generic suggestions. WL experts please chime in!

It sounds like a class collision with other jars that in the classpath of your Package or a problem with a jndi.properties file being found that is not the one that you are expected.

To make sure it is not the second issue, for a test, don’t relie on jndi.properties in your code. Pass in the InitialContext parameters explicitly.

If this does not fix the problem, then you have to look at the classpath.

  1. Try using the same JVM for IS that works with your Java client (or visa versa). This will make sure that JVM and JVM /ext classes aren’t causing a problem.

  2. Look at the EJB Adapter configuration information - particularly on where it tells you to put the WL client jars. You will need to replicate this in your package.

HTH,
Fred

Hi Guys,

I am facing problems while trying to connect through EJB Adapter and make EJB calls, the EJB application is running on the webSphere Application Server(WAS) version 6.0.

I am using webMethods6.5 and webMethods7.1 Integration Server running under HP-Unix.

As per my understanding and the documentation, connect to IBM WAS server I have to run the IS using IBM JVM.

Is anyone can help me in getting the IBM JVM for HP-Unix? or are there anyways to resolve this problem?

Thanks in advance…

Thanks,
Venkatesh S