8 Replies Latest reply on Jun 25, 2009 6:03 PM by msantana

    Configuration of JExcel API library

    msantana

      Hello everyone!
      I´m having a simple problem, which has a simple solution, but i´m a newbie on seam.


      I have to do an import from an excel file and i am using JExcel API.
      I put it on the classpath, and use it.


      But when i try to do the deploy i get this exception:


      java.lang.NoClassDefFoundError: jxl/read/biff/BiffException.


      I think i am losing some configuration.


      Thanx in advice!

        • 1. Re: Configuration of JExcel API library
          swd847

          Can you post how you have packaged you war/ear and your application.xml if it is an ear deployment. Also are you aware the seam uses jxl for it's excel integration? You have not put the jar on the classpath twice have you?

          • 2. Re: Configuration of JExcel API library
            msantana

            My application.xml:




            <?xml version="1.0" encoding="UTF-8"?>
            <application xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:application="http://java.sun.com/xml/ns/javaee/application_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/application_5.xsd" version="5">
              <display-name>SGAF-ear</display-name>
              <module>
                <web>
                  <web-uri>SGAF.war</web-uri>
                  <context-root>/SGAF</context-root>
                </web>
              </module>
              <module>
                <ejb>SGAF-ejb.jar</ejb>
              </module>
              <module>
                <ejb>jboss-seam.jar</ejb>
              </module>
              <module>
                <java>jboss-seam-debug.jar</java>
              </module>
            </application>
            


            And no, i havent included that library twice.


            The project was generated by seam-gen.
            Another idea?
            Thanx for the quick answer!!!

            • 3. Re: Configuration of JExcel API library
              swd847

              Where is the jxl jar? if it is in the root of your ear you should list it in application.xml as a java module.

              • 4. Re: Configuration of JExcel API library
                msantana

                It is on my ejb proyject.
                I have to move it to my ear?

                • 5. Re: Configuration of JExcel API library
                  swd847

                  What do you mean it is on your ejb project?


                  Try putting it in the root of your ear and adding a reference to it in application.xml


                  • 6. Re: Configuration of JExcel API library
                    msantana

                    Yes that worked!!!
                    But i have a last question.


                    I have put that library on the classpath of the ejb project instead of the ear project.
                    Why that did not work?, If i want to put the library there, why i cannot? Or is it a best practice to put the libraries on ear project.


                    Thank you very much again for your time!!!

                    • 7. Re: Configuration of JExcel API library
                      swd847

                      What do you mean 'on the classpath of the ejb project?' that does not really have any meaning in an ear deployment in an application server.
                      If you are saying you put the jxl jar inside your ejb jar that doesn't work, java does not let you deploy a jar in a jar.


                      If you are talking about the classpath in an ide such as eclipse this has no meaning once you have deployed to the server, the only real point of it is to make the autocomplete etc work inside the ide. The classes that are availible to a given module are defined by the ejb spec, in general for ejb modules this is other java and ejb modules in the ear and jar files in the server/default/lib directory. Web modules also have access to code deployed in WEB-IND/lib and WEB-INF/classes. Have a google for how ear classloading works for more info.


                      • 8. Re: Configuration of JExcel API library
                        msantana

                        Thank you very much dude. You provide me of very interesting information!!!