A
asaguden
Hi,
We are facing a hard-to-debug problem i our Weblogic server.
The problem has something to do with errors in the classloading
process.
- Here is the exception:
<exception>
....Root cause of ServletException: java.lang.NoClassDefFoundError
A.init ( a.java 3 )
</exception>
- Here is the setup ( pseudo code, may not compile ):
<code>
public class A{
init(){
B b = new B( );
}
}
public class B{
// static attributes
public static HashMap map;
private static final String VAL_1 = "value1";
private static final String VAL_2 = "value2";
private static final String VAL_3 = "value3";
private static final String VAL_4 = "value4";
private static final String VAL_CS = "value4";
private static final String VAL_BS = "value4";
private static final List prod_cs =
ProductHelper.getInstance().getAllProducts( new Category(CS) );
private static final List prod_bs =
ProductHelper.getInstance().getAllProducts( new Category(BS) );
...
// static methods...
// static block
static{
map = new HashMap( );
map.put( "val1", VAL_1 );
map.put( "val2", VAL_2 );
map.put( "val3", VAL_3 );
map.put( "val4", VAL_4 );
map.put( VAL_BS, prod_bs );
map.put( VAL_CS, prod_cs );
...
}
}
}
</code>
As seen in the exception, probable cause is that B is not initialized.
Can someone explain
exactly what happens in the scenario where something in
ProductHelper.getInstance().getAllProducts()
fails...?
PS. The names have been changed to protect the bla bla...
Regards asaguden
We are facing a hard-to-debug problem i our Weblogic server.
The problem has something to do with errors in the classloading
process.
- Here is the exception:
<exception>
....Root cause of ServletException: java.lang.NoClassDefFoundError
A.init ( a.java 3 )
</exception>
- Here is the setup ( pseudo code, may not compile ):
<code>
public class A{
init(){
B b = new B( );
}
}
public class B{
// static attributes
public static HashMap map;
private static final String VAL_1 = "value1";
private static final String VAL_2 = "value2";
private static final String VAL_3 = "value3";
private static final String VAL_4 = "value4";
private static final String VAL_CS = "value4";
private static final String VAL_BS = "value4";
private static final List prod_cs =
ProductHelper.getInstance().getAllProducts( new Category(CS) );
private static final List prod_bs =
ProductHelper.getInstance().getAllProducts( new Category(BS) );
...
// static methods...
// static block
static{
map = new HashMap( );
map.put( "val1", VAL_1 );
map.put( "val2", VAL_2 );
map.put( "val3", VAL_3 );
map.put( "val4", VAL_4 );
map.put( VAL_BS, prod_bs );
map.put( VAL_CS, prod_cs );
...
}
}
}
</code>
As seen in the exception, probable cause is that B is not initialized.
Can someone explain
exactly what happens in the scenario where something in
ProductHelper.getInstance().getAllProducts()
fails...?
PS. The names have been changed to protect the bla bla...
Regards asaguden