Search code examples
javalotus-dominodomino-designer-eclipse

How to resolve NoClassDefFoundError Java agent


Suddenly when trying to add an external library (jar) from disk to my database I get NoClassDefFoundError when running the agent.
This has worked before without any hustle.

[0A04:001B-13BC] 2014-01-21 11:24:57   AMgr: Start executing agent 'areadregis' in 'kunder\lf\emir.nsf'
[0A04:001E-0F38] 2014-01-21 11:24:57   Agent Manager: Agent  error: Exception in thread "AgentThread: readRegis"
[0A04:001F-0F38] 2014-01-21 11:24:57   Agent Manager: Agent  error: java.lang.NoClassDefFoundError: org.apache.commons.i
o.FileUtils

In reference to this thread https://stackoverflow.com/questions/14464827/are-jar-files-in-webcontent-web-inf-lib-available-to-java-design-elements-in-dom I have tried all tips but still failing.

My code gets an error when referencing the library and suggest me to add it to Build Path. The thing is that it is already in my build path.

If I add the jar file to WebContent/WEB-INF/lib/ and the right-click and add to Build Path it moves up to Referenced Libraries.
The Java agent compiles without errors or warnings but when running it stops with an other error:

[19D8:01CB-17D8] 2014-01-21 11:13:25   Agent Manager: Agent  error: Exception in thread "Launcher: readRegis"
[19D8:01CC-17D8] 2014-01-21 11:13:25   Agent Manager: Agent  error: java.lang.Error: Unresolved compilation problems:
The import org.apache.commons.io cannot be resolved     FileUtils cannot be resolved

running Domino 9.0.1 Win/64

Please advice


Solution

  • As far as I am aware, you can't use a jar file that's in WebContent\WEB-INF in a Java agent. From that location it's only accessible to Java classes for XPages etc.

    If you add it directly to the agent or a Script Library, it should work.