Java service Symbol not found Error

Hi,

I’m new to java services.I’m trying to run a Java code but I’m facing some issues.

This is a part of the code which I’m using:

System.out.println(“About to invoke adapter”);
writeLog(“About to invoke adapter”);

I have imported java.io.* and java.io.Object

But i’m getting an error :

C:\Program Files\webMethods6\IntegrationServer\packages\DBADAPTER\code\source\testing.java:133: cannot find symbol
symbol : method writeLog(java.lang.String)
location: class testing
writeLog(“About to invoke adapter”);

Please let me know why I’m getting this error.What has to be set for writeLog() method?Is there anything to be defined in source of Shared Tab.Reply Immediately.

Yes Ma’am… replying IMMEDIATELY!

Verry funny taurean…Please dont give immediate replies if you dont hav soluntions…

The error tells you what the problem is: it cannot find the method writeLog. You need to either create a method called writeLog (for example, in the Shared section) or you need to replace the call to writeLog with something else.

By the way, java.io.Object doesn’t exist.

Suggestion #1: it sounds like you would benefit from some basic Java training. Learning Java by creating Java services in the IS will probably be a painful experience.
Suggestion #2: don’t write “Reply immediately” in your future posts. It is almost a sure way of not getting any replies at all.

  • Percio

Funny - not really… I wasn’t trying to be. My suggestion - heed to Percio’s suggetions - both of them. Also, I think this post from Rob is extremely useful and definitely worth reading.

~R

What prompted you to try to call writeLog()? I’m trying to figure out what API/class you are trying to use. AFAIK, there isn’t a public method in the IS API named writeLog in any of the public classes.

I’m tring to use writeLog method in LogWriter Class.It logs all activity.
http://www.jpedal.org/javadoc/org/jpedal/utils/LogWriter.html

System.out.println(“About to invoke adaptor”);
writeLog(“About to invoke adaptor”);

Please tell me how to import jars in webmethods?

I assume you’re doing something with JPedal? It seems odd in this case that you’re trying to use the LogWriter from that product.

I’m concerned that you may be headed down the wrong path, but I don’t have enough information to really help.

What I know for sure;

  • You seem new to Java (not just to IS Java services).
  • You didn’t mention JPedal in your first post, but are trying to use a class from that product.
  • The first post listed a pathname that included “DBADAPTER” which implies that you’re not trying to do anything with JPedal–though this may be a faulty assumption.

Can you provide some information about what you’re trying to do? With that info we can provide better guidance to help you achieve what you need to do. At this point, I’m not sure that Java services are the right way to go.

Hi Reamon,

I’m tring to integrate DBADAPTERS which is an integartion tool with Webmethods.

DBADAPTERS is a middleware where I can integarte applications.

So I’m trying to call the adaptor by writing Java Code in Webmethods.
I am new to Webmethods eventhough I have some knowledge in Core Java.

There are many userdefined functions used here to run the adaptor,shut down the adaptor etc.When I searched for these functions they are actually present in Java.But I dont know why it is not accepting.When I run this code,I’m getting symbol not found.I’m giving the code below:

IDataCursor pipelineCursor = pipeline.getCursor();
String adaptorName = IDataUtil.getString( pipelineCursor, “adaptorName” );
Properties propertyObj = (Properties) IDataUtil.get( pipelineCursor, “propertyObj” );
pipelineCursor.destroy();
String successFlag = “TRUE”;
System.out.println(“About to invoke adapter”);
writeLog(“About to invoke adapter”);
try{
System.out.println("props = " + propertyObj);
RunAdaptor adaptor = new RunAdaptor(adaptorName, propertyObj);
// ShutdownRunAdaptor adaptor = new ShutdownRunAdaptor(adaptorName, propertyObj);
System.out.println(“Instance created”);
writeLog("Instance created ");
adaptor.run();

            System.out.println("Adapter running... About to terminate"); 
            writeLog("Adapter running... About to terminate"); 
            adaptor.getController().terminate();
            System.out.println("Adapter terminated");
            writeLog("Adapter terminated");
    }catch (Exception e){
            successFlag = "FALSE";
            ibe.printStackTrace();
            writeLog("In 1st Catch Block");
            throw new ServiceException("IbafException " + ibe.getMessage());
    }catch (ClassCastException cce){
            successFlag = "FALSE";
            cce.printStackTrace();
            writeLog("In 2nd Catch Block");
            throw new ServiceException(" ERROR IN CREATING THE LOCALSOURCE;CHECK COMPONENT NAME AND LOGGING " + cce.getMessage());
    }catch(Exception e){
            successFlag = "FALSE";
            e.printStackTrace();
    writeLog("In 3rd Catch Block");
            throw new ServiceException(" ERROR IN SETUP OF THE IBUSADAPTOR " + e.getMessage());
    
    }

pipeline
IDataCursor pipelineCursor_1 = pipeline.getCursor();
IDataUtil.put( pipelineCursor_1, “successFlag”, successFlag );
pipelineCursor_1.destroy();

Please try running thsi code and let me know why the error is coming and how I can define these classes.For example writeLog is a method in class LogWriter.

But when I give LogWriter.writeLog…
ie;classname.method_name then also I’m getting the same error.

Is it because it is not able to find the Java Class?

What should be the path of JAVA_DIR in server.bat file?
Right now it is :
SET JAVA_DIR=C:\Program Files\Java\jdk1.5.0_07

Even if I need to use a jar file ,will simple giving it in the class_path will import these jars?

writeLog is a static method of the class LogWriter. Therefore, the proper way for calling the method would be LogWriter.writeLog.

If you get a similar error saying that the compiler doesn’t recognize the class LogWriter, then it’s probably because you haven’t imported that class. You can import the class in the Shared tab of the service. You could also call writeLog (without importing the class) by specifying the complete name of the class followed by the method name: org.jpedal.utils.LogWriter.writeLog

Now, all this assumes that you have added the JPedal JAR file (assuming there’s one) to the Integration Server’s classpath. If you haven’t, search WMUsers on how to import JAR files into the IS. There have been numerous posts here regarding this topic.

Having said all this, I’m with Rob. I’m not sure you’re going down the right path either. From what I understood, you’re trying to integrate an integration tool to another integration tool. Why?

  • Percio