users@glassfish.java.net

Problems with Glassfish v3 preview classloader

From: <glassfish_at_javadesktop.org>
Date: Tue, 27 Oct 2009 08:10:41 PDT

Hello to all.

I have some problems with (maybe)classloading in glassfish v3 preview latest release.

I have eclipse galileo Build id: 20090920-1017.

I installed glassfish eclipse plug-in version 1.0.37.

Here is the structure of my project which works with [b]NO[/b] problems in glassfish v2.1.

SimpleEJB is an Eclipse EJB Project which contains one file:

[b]SimpleBean.java[/b]

[code]
@Stateless(mappedName = "simple.SimpleBean")
public class SimpleBean implements SimpleBeanRemote {

    public SimpleBean() {

    }

    @Override
    public String test() {
        SimpleCommons.test();
        return "Hello, glassfish 3";
    }

}
[/code]

SimpleEJBInterface is EJB projects that holds remote interface:

[b]SimpleBeanRemote[/b]

[code]
@Remote
public interface SimpleBeanRemote {

    public String test();
}
[/code]

SimpleCommon is a java project whose idea is to share Common tasks.

[b]SimpleCommons.java[/b]

[code]
public class SimpleCommons {

    public static final void test() {
        //Something...
    }
}
[/code]

All this three projects are packed in [b]EAR[/b] and deployed to glassfish with no problems.

I have a SimpleClient java project to test the deployed EAR.

[b]SimpleClient[/b]

[code]
public class SimpleClient {

    public static void main(String[] args) throws NamingException {


        InitialContext initialContext = new InitialContext();
        SimpleBeanRemote simpleBeanRemote = (SimpleBeanRemote) initialContext.lookup("simple.SimpleBean");

        simpleBeanRemote.test();
    }
}
[/code]

When I run the example code the [b]test[/b] method in SimpleBean calls the [b]test[/b] method in SimpleCommons.

[b] The problem:[/b]

Glassfish throws this exception:[code]
WARNING: A system exception occurred during an invocation on EJB SimpleBean
javax.ejb.EJBException
        at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:4852)
        at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:4750)
...

Caused by: java.lang.NoClassDefFoundError: com/isp/simple/common/SimpleCommons
        at com.isp.simple.SimpleBean.test(SimpleBean.java:17)
[/code]

Why this happens? If I export SimpleCommon as a jar and put it in glassfish domains/domain1/lib dir everything is fine. What is the trouble here? Any help will be welcome.
[Message sent by forum member 'dpandulev' (deyan.pandulev_at_gmail.com)]

http://forums.java.net/jive/thread.jspa?messageID=369483