2009-01-24 5 views
1

J'utilise le plug-in Maven Cargo pour démarrer un conteneur Web Jetty pour exécuter des tests d'intégration dans un module de projet distinct.Maven Embedded Jetty Container ne parvient pas à charger Taglibs: Impossible d'initialiser TldLocationsCache

Le problème avec lequel je me bats se produit lorsque j'ai ajouté taglibs dans les pages jsp et essayé de les frapper à partir des tests d'intégration. Lorsque la jetée tente de compiler les pages qu'il échoue avec cette erreur:

org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: null 

L'application web fonctionne bien lorsqu'il est exécuté dans un conteneur Tomcat installé ou exécuté jetée autonome par Maven sur la ligne de commande, donc je pense que le problème doit être à quelque chose à voir avec la façon dont la cargaison embarque la jetée et ensuite comment la jetée compile l'application.

J'ai essayé de fonctionner dans des modes fourchus et non tramés, en ajoutant les taglibs au classpath du conteneur, en définissant explicitement taglibs dans web.xml et n'ayant aucune config là ... tout en vain.

Voici le projet de test j'utilise pour debug:

web.xml

<?xml version='1.0' encoding='UTF-8'?> 
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> 

<display-name>taglibs-test</display-name> 

<jsp-config> 
    <taglib> 
     <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri> 
     <taglib-location>/WEB-INF/tld/c.tld</taglib-location> 
    </taglib> 
</jsp-config> 

Et le module de test pom.xml:

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

http: //maven.apache.org/maven-v4_0_0.xsd ">

... 

<build> 

     <!-- Integration Test Embedded Servlet Container --> 
     <plugin> 
      <groupId>org.codehaus.cargo</groupId> 
      <artifactId>cargo-maven2-plugin</artifactId> 
      <configuration> 
       <wait>false</wait> 
       <container> 
        <containerId>jetty6x</containerId> 
        <type>embedded</type> 
        <log>${project.build.directory}/log</log> 
        <dependencies> 
         <dependency> 
          <groupId>javax.servlet</groupId> 
          <artifactId>jstl</artifactId> 
         </dependency> 
         <dependency> 
          <groupId>taglibs</groupId> 
          <artifactId>standard</artifactId> 
         </dependency> 
        </dependencies> 
        <systemProperties> 
         <DEBUG>true</DEBUG> 
        </systemProperties> 
       </container> 
       <configuration> 
        <properties> 
         <cargo.servlet.port>8090</cargo.servlet.port> 
         <cargo.logging>high</cargo.logging> 
        </properties> 
        <deployables> 
         <deployable> 
          <groupId>test</groupId> 
          <artifactId>web</artifactId> 
          <type>war</type> 
          <properties> 
           <context>taglibs-test</context> 
          </properties> 
         </deployable> 
        </deployables> 
       </configuration> 
      </configuration> 
      <executions> 
       <execution> 
        <id>start-container</id> 
        <phase>test-compile</phase> 
        <goals> 
         <goal>start</goal> 
        </goals> 
       </execution> 
       <execution> 
        <id>stop-container</id> 
        <phase>package</phase> 
        <goals> 
         <goal>stop</goal> 
        </goals> 
       </execution> 
      </executions> 
     </plugin> 
    </plugins> 
</build> 

Voici le stacktrace de l'erreur:

2009-01-24 13:53:06.766::WARN: /taglibs-test/index.jsp: 
org.apache.jasper.JasperException: Unable to initialize TldLocationsCache: null 
    at org.apache.jasper.compiler.TldLocationsCache.init(TldLocationsCache.java:253) 
    at org.apache.jasper.compiler.TldLocationsCache.getLocation(TldLocationsCache.java:224) 
    at org.apache.jasper.JspCompilationContext.getTldLocation(JspCompilationContext.java:526) 
    at org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:422) 
    at org.apache.jasper.compiler.Parser.parseDirective(Parser.java:492) 
    at org.apache.jasper.compiler.Parser.parseElements(Parser.java:1552) 
    at org.apache.jasper.compiler.Parser.parse(Parser.java:126) 
    at org.apache.jasper.compiler.ParserController.doParse(ParserController.java:211) 
    at org.apache.jasper.compiler.ParserController.parse(ParserController.java:100) 
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:155) 
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295) 
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:276) 
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:264) 
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:563) 

J'ai suivi cette baisse aux lignes suivantes dans TldLocationsCache de jaspe:

private void init() throws JasperException { 
     if (initialized) return; 
     try { 
      processWebDotXml(); 
      scanJars(); 
      processTldsInFileSystem("/WEB-INF/"); 
      initialized = true; 
     } catch (Exception ex) { 
      throw new JasperException(Localizer.getMessage(
        "jsp.error.internal.tldinit", ex.getMessage())); 
     } 
    } 

http://svn.apache.org/repos/asf/tomcat/jasper/tc6.0.x/src/share/org/apache/jasper/compiler/TldLocationsCache.java

Tous l'aide est grandement appréciée !!

cam

Répondre

Questions connexes