0

May be this is a duplicate question. Solutions on the already posted questions did't help me to solve the issue. thats why i'm re-posting it

I have 2 Java projects. say 1.ibz and 2.Mailer ibz is a web application and Mailer contains some java classes. I need some classes in mailer to access from ibz. tried following steps

right click on ibz project > Properties > Java build Path > Projects > Add > Selected Mailer project > Ok > Ok

but when i'm trying to start the server it shows the following exception


    SEVERE: Critical error during deployment: 
    java.lang.NoClassDefFoundError: Lcom/ibz/mailer/MailClass;
        at java.lang.Class.getDeclaredFields0(Native Method)
        at java.lang.Class.privateGetDeclaredFields(Class.java:2499)
        at java.lang.Class.getDeclaredFields(Class.java:1811)
        at com.sun.faces.application.annotation.ManagedBeanConfigHandler.collectAnnotatedFields(ManagedBeanConfigHandler.java:242)
        at com.sun.faces.application.annotation.ManagedBeanConfigHandler.getBeanInfo(ManagedBeanConfigHandler.java:151)
        at com.sun.faces.application.annotation.ManagedBeanConfigHandler.process(ManagedBeanConfigHandler.java:137)
        at com.sun.faces.application.annotation.ManagedBeanConfigHandler.push(ManagedBeanConfigHandler.java:123)
        at com.sun.faces.application.annotation.AnnotationManager.applyConfigAnnotations(AnnotationManager.java:234)
        at com.sun.faces.config.processor.AbstractConfigProcessor.processAnnotations(AbstractConfigProcessor.java:402)
        at com.sun.faces.config.processor.ManagedBeanConfigProcessor.process(ManagedBeanConfigProcessor.java:244)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.ValidatorConfigProcessor.process(ValidatorConfigProcessor.java:120)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.ConverterConfigProcessor.process(ConverterConfigProcessor.java:126)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.ComponentConfigProcessor.process(ComponentConfigProcessor.java:117)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:344)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:116)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:239)
        at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:435)
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:221)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4770)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.ClassNotFoundException: com.ibz.mailer.MailClass
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1295)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1147)
        ... 33 more

    Jul 06, 2015 12:35:38 PM org.apache.catalina.core.StandardContext listenerStart
    SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
    java.lang.RuntimeException: java.lang.NoClassDefFoundError: Lcom/ibz/mailer/MailClass;
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:280)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4770)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5196)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
        at java.util.concurrent.FutureTask.run(FutureTask.java:262)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
        at java.lang.Thread.run(Thread.java:745)
    Caused by: java.lang.NoClassDefFoundError: Lcom/ibz/mailer/MailClass;
        at java.lang.Class.getDeclaredFields0(Native Method)
        at java.lang.Class.privateGetDeclaredFields(Class.java:2499)
        at java.lang.Class.getDeclaredFields(Class.java:1811)
        at com.sun.faces.application.annotation.ManagedBeanConfigHandler.collectAnnotatedFields(ManagedBeanConfigHandler.java:242)
        at com.sun.faces.application.annotation.ManagedBeanConfigHandler.getBeanInfo(ManagedBeanConfigHandler.java:151)
        at com.sun.faces.application.annotation.ManagedBeanConfigHandler.process(ManagedBeanConfigHandler.java:137)
        at com.sun.faces.application.annotation.ManagedBeanConfigHandler.push(ManagedBeanConfigHandler.java:123)
        at com.sun.faces.application.annotation.AnnotationManager.applyConfigAnnotations(AnnotationManager.java:234)
        at com.sun.faces.config.processor.AbstractConfigProcessor.processAnnotations(AbstractConfigProcessor.java:402)
        at com.sun.faces.config.processor.ManagedBeanConfigProcessor.process(ManagedBeanConfigProcessor.java:244)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.ValidatorConfigProcessor.process(ValidatorConfigProcessor.java:120)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.ConverterConfigProcessor.process(ConverterConfigProcessor.java:126)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.ComponentConfigProcessor.process(ComponentConfigProcessor.java:117)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.ApplicationConfigProcessor.process(ApplicationConfigProcessor.java:344)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.LifecycleConfigProcessor.process(LifecycleConfigProcessor.java:116)
        at com.sun.faces.config.processor.AbstractConfigProcessor.invokeNext(AbstractConfigProcessor.java:152)
        at com.sun.faces.config.processor.FactoryConfigProcessor.process(FactoryConfigProcessor.java:239)
        at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:435)
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:221)
        ... 9 more
    Caused by: java.lang.ClassNotFoundException: com.ibz.mailer.MailClass
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1295)
        at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1147)
        ... 33 more

    Jul 06, 2015 12:35:38 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Error listenerStart
    Jul 06, 2015 12:35:38 PM org.apache.catalina.core.StandardContext startInternal
    SEVERE: Context [/ibzerp] startup failed due to previous errors
    Jul 06, 2015 12:35:38 PM org.apache.catalina.core.ApplicationContext log
    INFO: Closing Spring root WebApplicationContext
    Jul 06, 2015 12:35:38 PM org.springframework.web.context.support.XmlWebApplicationContext doClose
    INFO: Closing Root WebApplicationContext: startup date [Mon Jul 06 12:35:32 IST 2015]; root of context hierarchy
    Jul 06, 2015 12:35:38 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
    WARNING: The web application [ibzerp] registered the JDBC driver [com.mysql.jdbc.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
    Jul 06, 2015 12:35:38 PM org.apache.catalina.loader.WebappClassLoaderBase clearReferencesThreads
    WARNING: The web application [ibzerp] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
     java.lang.Object.wait(Native Method)
     java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:135)
     com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:41)
    Jul 06, 2015 12:35:39 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["http-nio-8080"]
    Jul 06, 2015 12:35:39 PM org.apache.coyote.AbstractProtocol start
    INFO: Starting ProtocolHandler ["ajp-nio-8009"]
    Jul 06, 2015 12:35:39 PM org.apache.catalina.startup.Catalina start
    INFO: Server startup in 10391 ms

Other information

  • Eclipse LSR 1(4.4.1)
  • Tomcat 8.0

Does anybody know what I am doing wrong/have missed out?

Dev
  • 21
  • 5

1 Answers1

0

I assume you're talking about Eclipse, right? You should mention this because there are a lot of other Java IDEs.

Right click on you ibz project / Properties / Deployment Assembly and click "Add". Choose "Project" and clickt "Next". Then select project Mailer and click "Finished". There should be a new entry in your Web Deployment Assembly list with source: Mailer and Deploy Path: WEB-INF/lib/Mailer.jar. Then click OK to close the properties windows and restart your servlet container.

vanje
  • 10,180
  • 2
  • 31
  • 47
  • i have already tried this one, still same error. after adding the project it shows WEB-INF/lib/Mailer.war not WEB-INF/lib/Mailer.jar – Dev Jul 06 '15 at 09:05