11 Replies Latest reply on Mar 5, 2013 4:55 PM by Jordan Gallen

    java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList

    Jordan Gallen Newbie

      Hello I am creating a web application. Part of this application uses the JFreeCharts api. I have the jar files required each referenced in my application by putting them in the jboss-deployment-structure.xml file.

       

      For example:

       

      <?xml version="1.0" encoding="UTF-8"?>

      <jboss-deployment-structure>  

        <deployment>       

          <dependencies>        

                <module name="com.jfreechart" />    

                 <module name="com.jcommon" /> 

                 <module name="com.swtgraphics2d" />   

                 <module name="com.gnujaxp" />   

                 <module name="com.itext" /> 

                 <module name="com.servlet"/>

            </dependencies> 

           </deployment>

      </jboss-deployment-structure>

       

       

      When I try run the web application I am getting this error. I believe it has something to do with the swing class in javax.servlet. But I have no idea how to reference this within the application. Any help would be greating appreciated thanks .

       

       

       

      avax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList

      org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862)

      org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)

      org.apache.jsp.update_jsp._jspService(update_jsp.java:342)

      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)

      javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)

      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)

      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)

      javax.servlet.http.HttpServlet.service(HttpServlet.java:847)

       

      root cause

      java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList
           org.jfree.data.general.Series.<init>(Series.java:123)
           org.jfree.data.general.Series.<init>(Series.java:108)
           org.jfree.data.xy.XYSeries.<init>(XYSeries.java:170)
           org.jfree.data.xy.XYSeries.<init>(XYSeries.java:143)
           drawImageChart.singleIssue.setImage(singleIssue.java:36)
           loggedTime.logConversions.getHourDetailsForIssue(logConversions.java:213)
           loggedTime.logConversions.updateLogTime(logConversions.java:53)
           org.apache.jsp.update_jsp._jspService(update_jsp.java:332)
           org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
           org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
           org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)
           org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253)
           javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
        • 1. Re: java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList
          Nicklas Karlsson Master

          Tried a jboss-deployment-structure.xml with

           

                      <dependencies>
                          <system>
                              <paths>
                                  <path name="javax/swing/event"/>

           

          ...

           

          ?

          • 2. Re: java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList
            Jordan Gallen Newbie

            Thank you for the quick reply. I updated my jboss-deployment-structure.xml. So it now looks like this

             

            <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0">

              <deployment>       

                <dependencies>        

                      <module name="com.jfreechart" export="true"/>    

                       <module name="com.jcommon" export="true"/> 

                       <module name="com.swtgraphics2d" export="true" />   

                       <module name="com.gnujaxp" export="true"/>   

                       <module name="com.itext" export="true"/> 

                       <module name="com.servlet" export="true"/>

             

                     <system>

                     <paths>

                            <path name="javax/swing/event"/>

                   </paths>

                    </system>

             

             

                         </dependencies> 

               </deployment>

            </jboss-deployment-structure>

             

            But this wont deploy the application now. it is say that there is a problem with the strucutre. What would be the correct structure? Thank you once again

             

             

            _______________________________

             

            Have it deploying now changed the jboss:deployment-structure:1.0 to jboss:deployment-structure:1.1.

             

            But the problem with the java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList is still showing up when I try to run.

             

            Any ideas?

            • 4. Re: java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList
              Jordan Gallen Newbie

              type Exception report

              message

              description The server encountered an internal error () that prevented it from fulfilling this request.

              exception

              javax.servlet.ServletException: java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) org.apache.jsp.update_jsp._jspService(update_jsp.java:354) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) 

               

              root cause

              java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList org.jfree.data.general.Series.<init>(Series.java:123) org.jfree.data.general.Series.<init>(Series.java:108) org.jfree.data.xy.XYSeries.<init>(XYSeries.java:170) org.jfree.data.xy.XYSeries.<init>(XYSeries.java:143) drawImageChart.singleIssue.setImage(singleIssue.java:20) loggedTime.logConversions.getHourDetailsForIssue(logConversions.java:217) loggedTime.logConversions.updateLogTime(logConversions.java:57) org.apache.jsp.update_jsp._jspService(update_jsp.java:344) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) 

               

              root cause

              java.lang.ClassNotFoundException: javax.swing.event.EventListenerList from [Module "com.jfreechart:main" from local module loader @789144 (roots: C:\Users\Jordan Gallen\Desktop\jboss-as-7.1.1.Final\modules)] org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) org.jfree.data.general.Series.<init>(Series.java:123) org.jfree.data.general.Series.<init>(Series.java:108) org.jfree.data.xy.XYSeries.<init>(XYSeries.java:170) org.jfree.data.xy.XYSeries.<init>(XYSeries.java:143) drawImageChart.singleIssue.setImage(singleIssue.java:20) loggedTime.logConversions.getHourDetailsForIssue(logConversions.java:217) loggedTime.logConversions.updateLogTime(logConversions.java:57) org.apache.jsp.update_jsp._jspService(update_jsp.java:344) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
              • 5. Re: java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList
                Nicklas Karlsson Master

                Strange, I thought that should work. As a workaround, you can edit the path into the module.xml of the jdk module...

                • 6. Re: java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList
                  jaikiran pai Master

                  It's being added to the wrong place. Looking at the stacktrace, the com.jfreechart module is the one which requires that dependency. So adding that <system> element with the relevant paths in the module.xml of com.jfreechart module is what needs to be done.

                  • 7. Re: java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList
                    Jordan Gallen Newbie

                    Cheers you so much for that. Finally I have gotten passed that eventlistenlist problem .

                     

                    But now I am getting a similar problem only this time with org/jfree/chart/plot/Plot

                     

                    type Exception report

                    message

                    description The server encountered an internal error () that prevented it from fulfilling this request.

                    exception

                    javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/jfree/chart/plot/Plot org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:862) org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791) org.apache.jsp.update_jsp._jspService(update_jsp.java:354) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) 

                     

                    root cause

                    java.lang.NoClassDefFoundError: org/jfree/chart/plot/Plot drawImageChart.singleIssue.setImage(singleIssue.java:41) loggedTime.logConversions.getHourDetailsForIssue(logConversions.java:217) loggedTime.logConversions.updateLogTime(logConversions.java:57) org.apache.jsp.update_jsp._jspService(update_jsp.java:344) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) 

                     

                    root cause

                    java.lang.ClassNotFoundException: org.jfree.chart.plot.Plot from [Module "com.jfreechart:main" from local module loader @1893efe (roots: C:\Users\Jordan Gallen\Desktop\jboss-as-7.1.1.Final\modules)] org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190) org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468) org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456) org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423) org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398) org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120) drawImageChart.singleIssue.setImage(singleIssue.java:41) loggedTime.logConversions.getHourDetailsForIssue(logConversions.java:217) loggedTime.logConversions.updateLogTime(logConversions.java:57) org.apache.jsp.update_jsp._jspService(update_jsp.java:344) org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) javax.servlet.http.HttpServlet.service(HttpServlet.java:847) 

                     

                    note The full stack trace of the root cause is available in the JBoss Web/7.0.13.Final logs.

                     

                     

                     

                    I have tried editing the module.xml like before, for example:

                     

                    <?xml version="1.0" encoding="UTF-8"?>

                    <module xmlns="urn:jboss:module:1.1" name="com.jfreechart">  

                         <resources>    

                                <resource-root path="jfreechart.jar"/>    

                             

                                       </resources>

                                          <dependencies>

                                                 <system>

                                                                                         <paths>

                                                                                                <path name="javax/swing/event"/>

                                                                                                <path name="org/jfree/chart/plot"/>

                                                                                       </paths>

                                                                                        </system>      

                                                          </dependencies>

                                       </module>

                     

                     

                    But the error is still coming up. Any ideas? once again thank you

                    • 8. Re: java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList
                      Nicklas Karlsson Master

                      Is there a reason why you make all your libraries modules instead of sticking them into e.g. a WAR lib? Having said that, you shouldn't need any modifications to the jfreechart module.xml (the class missing should be in the jfreechart.jar and the system/paths is for rt.jar). The com.servlet module sounds omnious, what's in it?

                      • 9. Re: java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList
                        Jordan Gallen Newbie

                        The library that I am trying to use is called jfreecharts. From reading online I thought the correct way to implement this was to references the paths for the jars inside an xml document called jboss-deployment-stucture within the WEB-INF folder. The com.servlet module is a jar file which is included with the jfreecharts. Do you know of another way which I could implement this library?

                        • 10. Re: java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList
                          Nicklas Karlsson Master

                          Put all the jars in your WAR lib. Don't include any servlet apis/impls.

                          • 11. Re: java.lang.NoClassDefFoundError: javax/swing/event/EventListenerList
                            Jordan Gallen Newbie

                            Thank you so much, its working now. Drinks are on me!!