Java Service need to recompile after IS restarted

What product/components do you use and which version/fix level are you on?

10.11

Is your question related to the free trial, or to a production (customer) instance?

Customer License

What are you trying to achieve? Please describe it in detail.

Hi, I am having a java service that import a jar that consist of class that I want to use on the IS Java service, but everytime the IS got restarted or the package got reloaded the java service produced this error.

java.lang.reflect.InvocationTargetException: Unresolved compilation problems: 
	FieldInfo cannot be resolved to a type

I need to recompile the java service everytime the IS performed a restart to get rid of this problem, the .class file was already created on the Package/code/classes/Folder/Service.class and the jar also attached on the Package/code/jars. Any idea to get rid of this issue? because it failed everytime the IS got restarted and need a manual action to solve

Hi Vincent Koh,
It seems to be some issue with the Java build settings. Please check in the Designer Java build settings and see if anything is missing.

Compiling a Java Service (softwareag.com)

I suspect a package load ordering issue, with a conflicting class/library somewhere. Recompiling resolves the issue because it resolves to the desired class. Can you share more about the Java service and what Java package/classes it is using? And what libraries you have added where, if any, beyond the library you mention in Package/code/jars.

2 Likes

Thank you for the advice @Jaideep turns out, I need to recompile the java service after i set the correct build path with the external jars, the .class I compiled after adding external jars to the build path is correct now, and no more errors after reloading the package or restarting the IS. Thank you!

2 Likes

Glad the issue is resolved.

But strange that before the build path was changed that a compile would work, then the linkages foiled upon restart. How did this compile before? If the build path was not right, how was the compile successful? But then the .class “bad” after a restart? Still feels like there are conflicting versions of a Java package/classes and the order of class loading is okay now but may resurface later?

1 Like

Hi reamon, let me explain this, so before i was compiling the java services without my jar on the reference library (build path Designer) the jar was already assigned on the packages/code/jars. The .class file compiled in this condition is not fully compiled (not sure but there is a difference in size of the file). when i assigned Helper.jar on my referenced libraries, then i recompile the java service, the .class file size is bigger (means the right one?) and no more exception every time IS got restarted.

image

if you really curious about the compiled .class file, i attached the files below, there is difference between two files
classFile.zip (3.0 KB)
m

Thanks for sharing the classes. If you use a Java decompiler to look at the “before” class, you’ll see that every method within throws new Error, with various messages. One of them:

Unresolved compilation problems:
The import HelperUtil cannot be resolved
FieldInfo cannot be resolved to a type

Unclear as to why a recompile would resolve that, and then not be saved to disk such that a restart would revert to the old .class.

I learned something today. I’ve never seen a compiler do this – create a .class that just throws Errors complaining about the compile-time problem. I’m curious as to how that happened.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.