2009-01-24 2 views
1

Maven Cargo Plugin을 사용하여 별도의 프로젝트 모듈에서 일부 통합 테스트를 실행하는 Jetty 웹 컨테이너를 시작합니다.Maven Embedded Jetty Container가 Taglibs를로드하지 못했습니다. TldLocationsCache를 초기화 할 수 없습니다.

나는 JSP 페이지에 taglibs를 추가하고 통합 테스트에서 태그를 쳤을 때 문제가 발생합니다. 부두는이 오류와 함께 실패 페이지를 컴파일하려고 할 때 : 설치된 Tomcat 컨테이너에서 실행 또는 독립형 부두 명령 행에서 받는다는 통해 실행할 때

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

웹 응용 프로그램이 잘 작동을, 그래서 문제가 될 생각합니다 어떻게화물이 부두를 묻히는 지와 부두가 앱을 컴파일하는 방법과 관련이 있습니다.

forkl 및 unforked 모드에서 컨테이너 클래스 경로에 taglibs를 추가하고 web.xml에서 taglibs를 명시 적으로 정의하고 거기에 구성이 없는데 모두 사용하지 않으려 고 시도했습니다.

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> 

그리고 테스트 모듈의 pom.xml :

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

HTTP 여기

내가 디버그에 사용하고 테스트 프로젝트입니다 : //maven.apache.org/maven-v4_0_0.xsd ">

내가 재스퍼의 TldLocationsCache에 다음과 같은 라인이 아래로 추적 한

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) 

:

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

모든 여기

... 

<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> 

오류의 스택 트레이스의 도움이 대단히 감사합니다 !!

답변

관련 문제