ClassLoader problem

Good day,
I ran into a bizare issue with the class loader. The first time I start the app server (Tomcat ) the problem is not there. The second time: boom, the third time the problem is not there, the fourth time: boom and so on. This is consistent.
I get the stack trace:

java.lang.NoClassDefFoundError: Could not initialize class nl.magsoft.admin.test_console.TestConsoleView

The class TestConsoleView is in the same package/jar as class TestConsoleApp and when I tried to create an instance in TestConsoleApp like this:

static { new TestConsoleView () } I get null NullPointerException inside TestConsoleView suggesting that the class was loaded fine in the class loader from the startup thread (when called by com.vaadin.server.VaadinSession.readObject(

Has anyone seen and/or solved this problem?

Have not seen this behaviour in the UI.init , but I do get java.lang.ClassNotFoundException: during session de-serialization using glassfish. For now we have given up on session serialization using Glassfish. I’ll probably move to WildFly once I get some free time on my hands.

I’m not sure if our issue is related to yours except for the fact that you mentioned VaadinSession.readObject

What are you doing in TestConsoleView constructor ??

Nothing special,TestConsoleView exends HorizontalLayout and creates the controls/layouts in the constructor.
TestConsoleApp has:

public class TestConsoleApp extends UI {
    @WebServlet(value = {"/test-console/*"}, asyncSupported = true) @VaadinServletConfiguration(productionMode = true, ui = TestConsoleApp.class, widgetset = "nl.magsoft.vaadin.AppWidgetSet")
    public static class Servlet extends VaadinServlet {
    @Override protected void init(VaadinRequest request) {
            setContent(new TestConsoleView());

I had indeed something to de with session deserialisation. I could work around the problem by adding the second line in the Tomcat server.xml

<Context docBase="${catalina.home}/abc" path="" reloadable="false"> [b] <Manager pathname=""/> [/b] </Context> It seems that if the session deserializer loads the TestConsoleView class first, the classloader used by Vaadin has problems with it.