Java code from my IDE to WM

I saw in the documentation that I can bulding my with my Own IDE.

“… if you build a Java service in your own IDE, you need to use a utility called jcode to compile your service and generate the necessary files in the namespace…”

Where is jcode??
Does someone have a stupid example (simply a System.out.println())??

Jcode is available in IS server home/bin directory. Just give the package you want to build with a switch -makeall, will build all your codes and create required nodes.

Sample:
jcode -makeall

Thk you for your answer, but I’m new with WM. What’s the next step? Shoud I need to compile my stupid java code or the jcode.sh will? Does I need to create something in WM or not?

I don’t know jcode at all, and it may be more efficient… But if you want to avoid it, you can simply copy-paste your code from your IDE (say, Jbuilder).

If you specify input/output first and use Tools->Generate code->for implementing this service, you’ll get the right pipeline sections. Paste this into the service, then simply insert your code between the pipeline sections and direct your output variables to the appropriate lines of the output pipeline section.

Oh, and remember any necessary imports in the shared tab.

I develop a jar containing all my goodies using IntelliJ and drop it into MyPackage/code/jars. The the Java services I created with Developer are very slim wrappers that get/put from the pipeline and do parameter/type checking.

I did a cut and paste for a general code.

I got the following error.

Any Ideas?

In the box

The source was saved, but was not compiled due to the following errors:

com.wm.app.b2b.server.ServiceException: [ISS.0014.9116] Unable to locate or start compiler

Details of the error

com.wm.app.b2b.server.ServiceException: [ISS.0014.9116] Unable to locate or start compiler

at com.wm.util.LocalizedException.(LocalizedException.java:109)

at com.wm.app.b2b.server.ServerException.(ServerException.java:34)

at com.wm.app.b2b.server.ServiceException.(ServiceException.java:20)

at wm.server.nsimpl._compile(nsimpl.java:4655)

at wm.server.nsimpl.buildClass(nsimpl.java:1600)

at java.lang.reflect.Method.invoke(Native Method)

at com.wm.app.b2b.server.JavaService.baseInvoke(JavaService.java:287)

at com.wm.app.b2b.server.ServiceManager.invoke(ServiceManager.java:336)

at com.wm.app.b2b.server.comm.DefaultServerRequestHandler.handleMessage(DefaultServerRequestHandler.java:64)

at com.wm.app.b2b.server.HTTPMessageHandler.process(HTTPMessageHandler.java:167)

at com.wm.app.b2b.server.Dispatch.run(Dispatch.java:203)

at com.wm.util.pool.PooledThread.run(PooledThread.java:105)

at java.lang.Thread.run(Thread.java:498)

hi,
Check your Memory settings in server.sh or bat file. You should be having sufficient memory for JVM as well as swap memory for your system.
We had same problem, because we set Max and Min as 1GB and no memory left over for swap. we reduced it to 1/2 GB and then we haven’t seen this error

Set the path to your java.exe. I do it from the Server Settings > Extended web page.

watt.server.compile=c:/Java/jdk1.3.1_06/bin/javac -classpath {0} -d {1} {2}

Fred,

I made the changes specified. No luck yet. Anything else?

Thanks
MKR

You need to modifiy the server.sh. Locate the two line containned javac and modify it to point to your javac compiler. IMPORTANT before doing this stop IS, modify the file and restart IS

Hi Fred, can you give me more detail on your example with your jar’s file? The cut & paste from the source of your java service, import, etc. Thanks

Looks like it Worked. I had to download the JDK 1.3.1. Install it.
Make Path/JAVA_HOME changes etc.

Then I made changes to

watt.server.compile

variable to point to the latest JDK

Then I did a cut and paste to the code. Made sure no “main” is available. Only code snippets were allowed.

Any Snippet code, cut and paste was saved using developer.

Did a

jcode makeall

It compiled fine and dandy.

Was able to run the new Java service successfully.

P.S:-
donot use ; in the imports section in "shared tab.

Now we are rocking and rolling… :slight_smile:

Thanks all

MKR

If c:/Java/jdk1.3.1_06/bin/javac runs your Java compiler, than it should work. This is the command line used by IS to compile non-Unicode java files (there is a similar watt.server parameter for the unicode compile command line).

I never change server.bat/sh (just continue to run with the JRE that installs with the product). I’ve never seen “Unable to locate or start compiler” that didn’t get fixed by setting that command line.

As far as developing within an IDE is concerned. The 4.6 ISDeveloperGuide page 485 describes the code/jars directory. This is part of a package, so the jars are on the package class loader, which is refreshed each time the package is loaded/reloaded.

The steps for integrating any 3rd party jar into a package are the same:

  1. copy the jar into code/jars
  2. create a Java service in Developer.
  3. do an import in the Java service of a Java class that is in your jar.
  4. use that class in your service.

When you edit a Java serivce via Developer, the package class loader is rebuilt, so your jar is reloaded as well (but startup services aren’t run each time, so if you have stuff initialized by startup services you have to explicitly reload the package).

HTH,
Fred

Hi “MKR” can you provide me more detail of what you did I mean the exact step. A example of your cut & paste, etc. Thank

Hi Steph,

I did the following.

  1. Make Server configurations.

  2. Make Variable settings

  3. Create a new Java Service say “HelloWorld”.

3a. Take any simple program for example a

        System.out.println("Hello World \n"); 

program.

3b. Paste it inside the Java Service Source for “HelloWorld” tab.

3c. Save the work.

3d. Go to Command Prompt.

  1. Go to <wMHOME>\IntegrationServer\bin directory

  2. do a "jcode makeall <packagename>

5a. Correct errors if any.

5b. Go to Developer.

  1. Run the Service.

P.S:-

3b can be applied to any small/big java service we may have to implement.

I didn’t try anything with nested classes or invoking another service in a custom java service.

Will post one if it works out.

HTH
MKR

Thanks!!! it’s work now. Let me known if you try with nested classes or invoking another service in a custom java service.

Steph:
For invoking a service inside a custom java service, you can use this code (stolen from post by Igor at [url=“wmusers.com”]wmusers.com):

String serviceName = “pub.db:execSQL”;
NSName nsName = NSName.create(serviceName);
// Run sql
IData results = Service.doInvoke(nsName, pipeline);

Thanks everyone,

reading this message save me a lot of time to solve the error message…
“com.wm.app.b2b.server.ServiceException: [ISS.0014.9116] Unable to locate or start compiler”

Kumar,

Always use the Search functionality of this site,lot of threads had discussed on this common problem.you will be surprised after seeing the results.It will be the fast way of resolving issues.

see this link,
[url=“wmusers.com”]wmusers.com

HTH,
RMG

I have problem saving Java service. wM 4.6 complains about have class name same as package name. The following is full path to my Java service: EDI_DB.EDI_DB:submitData. The first EDI_DB is package name, the second EDI_DB is folder name and service name is submitData. The folder EDI_DB (it is a name of Java class on wM IS) has all service written in Java. And they worked fine but I just have a lot of service there now and it started to complain about the package/class name conflict. If I create another folder and save submitData Java service there, no problem…Did anybody have something similar?

Thanks.