Discussions

EJB programming & troubleshooting: java.lang.NoClassDefFoundError - updated

  1. java.lang.NoClassDefFoundError - updated (5 messages)

    Hi There!
    I am trying to run my first EJB and I am stuck on my last step (possibly). I builded and deployed the EJB successfully.
    Even I can find datasource name and My Remote Interface on Jndi tree. But when I try to compile my client class I am getting the following error:
    Exception in thread "main" java.lang.NoClassDefFoundError: com/titan/clients/Client_41
    I don't know where I am going wrong. I am having my client class files under com.titan.clients
    and Interfaces and entity bean under com.titan.cabin
    And both these structures are under applications/titanapp/webapp/WEB-INF/classes

    Any ideas about where my code is falling over. Do I need to mention about client classes anywhere in .xml files for lookup. Thanks in advance.

    -Manasvi
    ----------------------------------------------------
    I have noticed that in my tmp_xxx_xxx-xxx directory under WEB-INF is almost empty with two empty jsp_servlet and WEB-INF directories. I don't have the slightest idea where I am going wrong. Where should I keep my jar file?? Under applications or under applications/titanapp (titanapp - enterprise application)?? I kept my jar underthe later dir. Is that where I am going wrong?? Any ideas??? Please let me know....

    Thanks
    -M
  2. Hi Manasvi,
    This looks your classpath issues. check your classpath correctly. You said you have deployed EJB but you have given any info about what your client(JSP/servlet/JavaClass). Thats still ok.
    But looking at your message I could under stand that you are trying run a class which doesn't have public static void main(Strig arg[]) method defined.

    Any further information can be use ful for sloving furher.
    with regs
    viswa deep veguru
  3. Hi Manasvi,
    This looks your classpath issues. check your classpath correctly. You said you have deployed EJB but you have not given any info about what your client(JSP/servlet/JavaClass). Thats still ok.
    But looking at your message I could under stand that you are trying run a class which doesn't have public static void main(Strig arg[]) method defined.

    Any further information can be use ful for sloving furher.
    with regs
    viswa deep veguru
  4. Hi Viswa Deep!
    Thanks for UR reply. My Client is a java class and sure it has main method in it.
    I was wondering whether it has something to do with my
    tmp_xxx-xxx folder under WEB-INF. I guess it's created by weblogic while deployment. And that folder was empty, as I said before. Any clues where I am going wrong??? I will look forward for UR reply.

    Thanks once again
    -Manasvi
  5. Definately sounds like a classloader issue. Your EJB's will be loaded by one classloader, while the interfaces in your Web app will be loaded by another classloader. Are you running the EJBs and the WebApp in the same JVM? If so, then although the class will be the same they will effectively be different because the JVM will load them via different class loaders.

    If you are running all in the one JVM, then either convert to using an EAR file with your EJBs and WebApps all together (watch your manifest file entries), or just put all your classes in the system classpath (yuck!).

    Good luck,
    Darren.
  6. Thanks for all UR replies. But, I am still getting that problem and I posted it again here with more details. Hope U could help with it.
    Thanks
    -M