Tuesday, December 13, 2011

ClassNotFoundException with the new Java design element

Last week Vince Shuurman blogged about having to recompile when opening an XPage app in Domino Designer.

I had the same issue. I was using some Java code in an XPage, and every time I opened the app in designer, I got ClassNotFoundException when opening the XPage. A build of the project fixed the issue.

My java code was in the new Java design element (new in Domino 8.5.3), so I suspected that it might have something to do with this.

I moved the code to a "custom" java source folder, and the error went away. Closing/opening the app in Designer did not result in ClassNotFoundException.


Karsten Lehmann said...

Same experience here. Something is weird with the new Java code design elements.
I got AbstractMethodError's a few times when using it and in that case also could not find design elements with the corresponding .class files in the DB design. Moving the code to the classic WEB-INF/src folder did not help in all cases, sometimes I also had to remove the whole project from DDE (including deleting the project files on disk) and reopening the database in DDE to let it properly recompile everything.

The main disadvantage of using code in WEB-INF/src location is that you don't have a UI to set the "prohibit design refresh" flag and its not set by default. I already lost a few files in a sample db derived from names.nsf, because the Designer tasks kicked in.

Tommy Valand said...

You have the UI. I think it was new in Domino Designer 8.5.3.

Right click the application -> Application -> Set prohibit refresh property

I think Mary Beth Raven blogged about it.

Karsten Lehmann said...

Cool, did not know that!

Karsten Lehmann said...

I just tried to set/remove a prohibit flag for classic design elements (forms) this way. Does not seem to work. Existing flags are not visible in the dialog and design elements do not get updated (already refreshed the design list with F9).

Tommy Valand said...

It worked when I tested it on a view.

Leave the "Prohibit.." unchecked, check the design elements that you want to remove prohibit from.

I agree that it's irritating that it doesn't show the current status.

Mark Leusink said...

Have experienced this a couple of times also (when using the new Java code design elements). Haven't been able to pinpoint exactly what's causing it.

If I get this error and try to open the Java class I get a "resource out of sync" error. Clicking F9 fixes it and everything works normal againg.

Baiju said...

I had this strange issue after I moved all my java code from custom WEB-INF/src folder to the java design elements. It started giving all sorts of issues and it started recompiling everything when I just open a project in designer. Finally I moved all the code back to WEB-INF/src and issues are resolved for now. I think there is some wiered issues with the java design element.

Maureen said...

do any of the java files have an underscore in their title? There was a bug fixed post 8.5.3, which I believe will be in the first fix pack, that could be affecting the behavior.

Karsten Lehmann said...

I don't think so, but I remember having issues with inner classes, so the name contained a $ character.

Tommy Valand said...

@Maureen: None of my classes have underscore in them, but they were "put in a package" with the name no.pareto.