1 2 Previous Next 22 Replies Latest reply on May 31, 2011 3:54 AM by duan xz Branched to a new discussion.

    EAR deployment in jsp the import Class cannot be resolved when library exists

    duan xz Newbie

      Hi,

      my ear to deploy on jboss-5.1.0.GA is ok. When I'm trying to deploy on AS 6.0 Final i am receiving an "org.apache.jasper.JasperException: Unable to compile class for JSP:An error occurred at line: 6 in the generated java file
      The import com.aqqfpo.server cannot be resolved"in the deployment of AEM.war ,although the library exists in the ear lib directory.
      Any help with this will be greatly appreciated.

      The ear format is as follows:
      aqqfposerver.ear
      |
      |---AEM.war
      |
      |---aqqfpo.war
      |
      |---aqqfposervlets.war
      |
      |---aqqfposerver.jar
      |
      |---APP-INF
      |      |
      |      |--classes
      |      |--lib(公用的第三方类struts,aqqfposerver.jar)
      |
      |---META-INF
      |      |
      |      |-- MAINIFEST.MF
      |      |--application.xml

      Here is my application.xml:
      ***********************************
        <module>
          <ejb>aqqfposerver.jar</ejb>
        </module>
        <module>   
          <web>     
            <web-uri>AEM.war</web-uri>     
            <context-root>/AEM</context-root>
          </web> 
        </module>
        <module>   
          <web>     
            <web-uri>aqqfpo.war</web-uri>     
            <context-root>/aqqfpo</context-root>
          </web> 
        </module>
        <module>   
          <web>     
            <web-uri>aqqfposervlets.war</web-uri>     
            <context-root>/servlet</context-root>
          </web> 
        </module>
      **************************************************

        • 1. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
          Wolfgang Knauf Master

          Hi,

           

          does your .war file contain a file "META-INF\MANIFEST.MF" with this content:

           

           

          Manifest-Version: 1.0

          Class-Path: aqqfposerver.jar

           

          Hope this helps

           

          Wolfgang

          • 2. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
            duan xz Newbie

            Thanks, Wolfgang.your help is much appreciated.
            1 made the AEM\META-INF\MANIFEST.MF as you suggested above, when i visit http://localhost:8080/AEM/    still  receiving the same error.
            "org.apache.jasper.JasperException: Unable to compile class for JSP:An error occurred at line: 6 in the generated java file The import com.aqqfpo.server cannot be resolved".

            when visit http://localhost:8080/servlet ,this part is ok.why?

            Any help with this will be greatly appreciated.

            • 3. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
              jaikiran pai Master

              I don't see any .ear/lib/*.jar in the first post of this topic. Where exactly is that jar containing the class located?

              • 4. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
                duan xz Newbie

                Thanks, jaikiran.
                first,I use the command jar-tf with aqqfposerver.ear, the results are as follows.

                E:\localappServer\jboss6.0.0.Final-0517\server\default\deploy>jar -tf aqqfposerver.ear
                META-INF/
                META-INF/MANIFEST.MF
                AEM.war
                APP-INF/
                APP-INF/classes/
                APP-INF/classes/charset.properties
                APP-INF/lib/
                APP-INF/lib/castor-xml.jar
                APP-INF/lib/commons-beanutils.jar
                APP-INF/lib/commons-codec-1.3.jar
                APP-INF/lib/commons-collections.jar
                APP-INF/lib/commons-digester.jar
                APP-INF/lib/commons-fileupload.jar
                APP-INF/lib/commons-httpclient-3.1.jar
                APP-INF/lib/commons-lang.jar
                APP-INF/lib/commons-logging.jar
                APP-INF/lib/commons-validator.jar
                APP-INF/lib/dom4j-1.6.1.jar
                APP-INF/lib/hsqldb.jar
                APP-INF/lib/jaxen-1.1.1.jar
                APP-INF/lib/log4j.jar
                APP-INF/lib/struts.jar
                APP-INF/lib/wsdl4j-1.6.2.jar
                APP-INF/lib/xml-apis-1.3.04.jar
                APP-INF/lib/XmlSchema-1.4.2.jar
                aqqfpo.war
                aqqfposervlets.war
                META-INF/application.xml
                aqqfposerver.jar
                META-INF/jboss-app.xml
                APP-INF/lib/aqqfposerver.jar


                jar -tf aqqfposerver.jar
                .......
                .......
                com/aqqfpo/server/config/AqqfpoConfig.class
                com/aqqfpo/server/config/ApplicationConfig.class
                com/aqqfpo/server/config/ApplicationsConfig.class
                com/aqqfpo/server/config/ApplicationsConfigFacade.clas
                com/aqqfpo/server/config/CleanableItem.class
                com/aqqfpo/server/config/CleanableItems.class
                com/aqqfpo/server/config/ConfigDelegate.class
                com/aqqfpo/server/config/ConfigException.class
                com/aqqfpo/server/config/ConfigHelper.class
                com/aqqfpo/server/config/ConfigObjectsFactory.class
                .......
                .......
                .......
                .......

                in server.log:
                An error occurred at line: 44 in the jsp file: /contentBanner.jsp
                com.aqqfpo.server cannot be resolved
                41: <div style="position:absolute;width:200; top:70px; left:580px;z-index:999;align:right">
                42: <table width="100%" border="0" cellpadding="0" cellspacing="0">
                43:        <tr>
                44:        <td class="version" align="right"><bean:message key="text.welcome.version" /> <%=com.aqqfpo.server.config.AqqfpoConfig.getServerVersion()%>
                45:        </td>
                46:        </tr>
                47: </table>
                =======================================

                Any help with this will be greatly appreciated.

                • 5. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
                  jaikiran pai Master

                  The APP-INF folder isn't a spec specified location. It isn't recognized by JBoss AS. So move all those jars from APP-INF/lib  to .ear/lib.

                  • 6. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
                    duan xz Newbie

                    Thank you jaikiran.
                    I am now at home after work tomorrow I will be the first time in the test as you suggest.

                    • 7. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
                      duan xz Newbie

                      Hi,jaikiran. thanks for your help again.
                      i  changed the directory structure as follow,and add "Class-Path: aqqfposerver.jar" in " AEM\META-INF\MANIFEST.MF".
                      the problem still exists.

                       

                      E:\localappServer\jboss6.0.0.Final-0517\server\default\deploy>jar -tf aqqfposerver.ear
                      META-INF/
                      META-INF/MANIFEST.MF
                      AEM.war
                      aqqfpo.war
                      aqqfposerver.jar
                      aqqfposervlets.war
                      META-INF/application.xml
                      META-INF/weblogic-application.xml
                      lib/
                      lib/aqqfposerver.jar
                      lib/castor-xml.jar
                      lib/commons-beanutils.jar
                      lib/commons-codec-1.3.jar
                      lib/commons-collections.jar
                      lib/commons-fileupload.jar
                      lib/commons-httpclient-3.1.jar
                      lib/commons-lang.jar
                      lib/commons-validator.jar
                      lib/dom4j-1.6.1.jar
                      lib/hsqldb.jar
                      lib/jaxen-1.1.1.jar
                      lib/log4j.jar
                      lib/struts.jar
                      lib/wsdl4j-1.6.2.jar
                      lib/XmlSchema-1.4.2.jar
                      META-INF/jboss-app.xml
                      lib/commons-digester.jar
                      lib/commons-logging.jar

                       

                      META-INF/MANIFEST.MF
                      Manifest-Version: 1.0
                      Created-By: 1.4.1_01-b01 (Sun Microsystems Inc.)
                      Ant-Version: Apache Ant 1.6.1
                      <library-directory>lib/</library-directory>


                      META-INF/jboss-app.xml
                      <?xml version='1.0' encoding='UTF-8'?>
                      <!DOCTYPE jboss-app PUBLIC "-//JBoss//DTD J2EE Application 5.0//EN"
                      "http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd" >
                      <jboss-app>
                      <library-directory>lib</library-directory>
                      </jboss-app>

                      in server.log
                      2011-05-26 09:40:34,340 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/AEM].[jsp]] (http-127.0.0.1-8080-11) Servlet.service() for servlet jsp threw exception: org.apache.jasper.JasperException: Unable to compile class for JSP:

                      An error occurred at line: 6 in the generated java file
                      The import com.aqqfpo.server cannot be resolved

                      • 8. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
                        Wolfgang Knauf Master

                        Hi,

                         

                        you have "aqqfposerver.jar" in two locations of your EAR: at root level (that's correct) and in the "lib" subdirectory. Remove it here.

                         

                        A file "META-INF/weblogic-application.xml" will have no effect for JBoss, so remove it.

                         

                        And the "<library-directory>" xml fragment in "MANIFEST.MF" is also wrong.

                         

                         

                        And now to more questions: could you also post the output of "jar -tf AEM.war"?

                         

                        Best regards

                         

                        Wolfgang

                        • 9. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
                          duan xz Newbie

                          Thanks,Wolfgang.

                          First of all that, this project will be run to the WAS, EAServer, JEUS, the prior i think does not affect deploy under  jbossAS6, so there is no delete weblogic-application.xml.
                          now i removed this(weblogic-application.xml), the configuration files and directory structure as follows:

                          ****************************************************
                          META-INF/MANIFEST.MF:
                          Manifest-Version: 1.0
                          Created-By: 1.4.1_01-b01 (Sun Microsystems Inc.)
                          Ant-Version: Apache Ant 1.6.1

                           

                          META-INF/application.xml
                          <?xml version="1.0" encoding="UTF-8"?>
                          <!DOCTYPE application PUBLIC '-//Sun Microsystems, Inc.//DTD J2EE Application 1.3//EN' 'http://java.sun.com/dtd/application_1_3.dtd'>
                          <application>
                            <display-name>aqqfpoServer</display-name>
                            <description>aqqfpo Server</description>
                            <module>
                              <ejb>aqqfposerver.jar</ejb>
                            </module>
                            <module>   
                              <web>     
                                <web-uri>AEM.war</web-uri>     
                                <context-root>/AEM</context-root>
                              </web> 
                            </module>
                            <module>   
                              <web>     
                                <web-uri>aqqfposervlets.war</web-uri>     
                                <context-root>/servlet</context-root>
                              </web> 
                            </module>
                            <module>   
                              <web>     
                                <web-uri>aqqfpo.war</web-uri>     
                                <context-root>/aqqfpo</context-root>
                              </web> 
                            </module>
                          </application>


                          META-INF/jboss-app.xml
                          <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE jboss-app PUBLIC    "-//JBoss//DTD Java EE Application 5.0//EN"    "http://www.jboss.org/j2ee/dtd/jboss-app_5_0.dtd">
                          <jboss-app>
                          <library-directory>lib</library-directory>
                          </jboss-app>

                           

                          jar -tf::::::

                          E:\localappServer\jboss-6.0.0.Final0526\server\default\deploy>jar -tf aqqfposerver.ear
                          META-INF/
                          META-INF/MANIFEST.MF
                          AEM.war
                          aqqfpo.war
                          aqqfposervlets.war
                          META-INF/application.xml
                          lib/
                          lib/castor-xml.jar
                          lib/commons-beanutils.jar
                          lib/commons-codec-1.3.jar
                          lib/commons-collections.jar
                          lib/commons-fileupload.jar
                          lib/commons-httpclient-3.1.jar
                          lib/commons-lang.jar
                          lib/commons-validator.jar
                          lib/dom4j-1.6.1.jar
                          lib/hsqldb.jar
                          lib/jaxen-1.1.1.jar
                          lib/log4j.jar
                          lib/struts.jar
                          lib/wsdl4j-1.6.2.jar
                          lib/XmlSchema-1.4.2.jar
                          META-INF/jboss-app.xml
                          lib/commons-digester.jar
                          lib/commons-logging.jar
                          aqqfposerver.jar

                          E:\localappServer\jboss-6.0.0.Final0526\server\default\deploy>cd aqqfposerver

                          E:\localappServer\jboss-6.0.0.Final0526\server\default\deploy\aqqfposerver>jar -tf AEM.war
                          .....
                          .....
                          WEB-INF/classes/charset.properties
                          WEB-INF/classes/org/exolab/securityCfg.class
                          WEB-INF/classes/resources/application.properties
                          WEB-INF/classes/resources/application_en.properties
                          WEB-INF/classes/resources/application_ja.properties
                          WEB-INF/classes/resources/application_zh.properties
                          WEB-INF/classes/resources/application_zh_TW.properties
                          WEB-INF/controls.tld
                          WEB-INF/struts-bean.tld
                          WEB-INF/struts-config.xml
                          WEB-INF/struts-html.tld
                          WEB-INF/struts-logic.tld
                          WEB-INF/struts-template.tld
                          WEB-INF/web.xml
                          ......
                          ......

                          *************************************

                          My operation is: AEM.war above extract from the aqqfposerver.ear out, and then jar-tf AEM.war command.

                          Thanks a lot for your help and tips.

                          • 10. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
                            duan xz Newbie

                            hi,Wolfgang.
                            I do not know the above "jar-tf AEM.war" operation is correct,

                            but in the result is not found the class[<%=com.aqqfpo.server.config.AqqfpoConfig.getServerVersion()%>] to be used in JSP files.

                            • 11. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
                              jaikiran pai Master

                              By any chance, are you on a Windows operating system?

                              • 12. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
                                duan xz Newbie

                                Thanks jaikiran。
                                my system info:OS-System: Windows 7 6.1,x86,
                                this project under jboss-5.1.0.GA is ok,i will try in other windows operating system in tomorrow。
                                thank you again.

                                • 13. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
                                  jaikiran pai Master

                                  I think you are running into a case sensitive bug. Do you have com.aqqfpo.Server.class (yes .class) in any of the jars? See this for further information https://community.jboss.org/message/563416#563416

                                  • 14. Re: EAR deployment in jsp the import Class cannot be resolved when library exists
                                    Wolfgang Knauf Master

                                    Hi Duan,

                                     

                                    where is the class "com.aqqfpo.server.config.AqqfpoConfig" found? Probably in "aqqfposerver.jar"?

                                     

                                    By the way: be careful to extract an EAR file in the JBoss deploy folder - the server might consider it an exploded deployment now and deploy some stuff duplicate (with errors). Do this only if the server is stopped, and delete if afterwards.

                                     

                                    One small question about this JAR: it is probably an EJB jar (containig EJBs), or is it a simple utility JAR?

                                    If it is an EJB jar, then all my previous suggestions are OK. If it is an utility JAR, there are differences ;-).

                                     

                                    Your "jar-tf AEM.war" command seems to be correct, but I would like to see some more details:

                                    -is a "WEB-INF\lib" directory present? If yes: please post the content.

                                    -post the content of META-INF\Manifest.mf (just to be sure that there is no typo)

                                     

                                    Best regards

                                     

                                    Wolfgang

                                    1 2 Previous Next