2013-09-25 6 views
1

Я пытаюсь предварительно скомпилировать страницы .jsp для сервлетов и запускать их на I-jetty на Android.I-Jetty и JSP с jetty-jspc: Servlet не инициализирован

Однако все это я получаю: Servlet Not Initialized

Я проверил сгенерированный материал в web.xml, и это выглядит хорошо для меня. Нормальный сервлет-сервлет хорошо работает.

Образец JSP Я пытаюсь с:

<html> 
<body align='center'> 
    <h1>Hello World</h1>  
    <h1>from jsp</h1> 
</body> 
</html> 

Он генерирует следующее web.xml:

<?xml version="1.0" encoding="ISO-8859-1"?> 

<web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" version="3.0"> 

<!-- 
Automatically created by JspC. 
Place this fragment in the web.xml before all icon, display-name, 
description, distributable, and context-param elements. 
--> 

    <servlet> 
     <servlet-name>jsp.simple_jsp</servlet-name> 
     <servlet-class>jsp.simple_jsp</servlet-class> 
    </servlet> 

    <servlet-mapping> 
     <servlet-name>jsp.simple_jsp</servlet-name> 
     <url-pattern>/simple.jsp</url-pattern> 
    </servlet-mapping> 

<!-- 
All session-config, mime-mapping, welcome-file-list, error-page, taglib, 
resource-ref, security-constraint, login-config, security-role, 
env-entry, and ejb-ref elements should follow this fragment. 
--> 
</web-app> 

Я использую следующий pom.xml для его генерации:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 
    <modelVersion>4.0.0</modelVersion> 

    <groupId>com.bogus</groupId> 
    <artifactId>test</artifactId> 
    <version>1.0-SNAPSHOT</version> 
    <packaging>war</packaging> 

    <name>test</name> 

    <dependencies> 

    </dependencies> 

    <build> 

<plugins> 
<plugin> 
    <groupId>org.apache.maven.plugins</groupId> 
    <artifactId>maven-war-plugin</artifactId> 
    <configuration> 
    <webXml>${basedir}/target/web.xml</webXml> 
    </configuration> 
</plugin> 
<plugin> 
    <groupId>org.mortbay.jetty</groupId> 
    <artifactId>jetty-jspc-maven-plugin</artifactId> 
    <version>8.1.0.RC5</version> 
    <executions> 
    <execution> 
     <id>jspc</id> 
     <goals> 
     <goal>jspc</goal> 
     </goals> 
     <configuration> 
     </configuration> 
    </execution> 
    </executions> 
</plugin> 

       <plugin> 
     <groupId>org.apache.maven.plugins</groupId> 
     <artifactId>maven-dependency-plugin</artifactId> 
     <version>2.3</version> 
     <executions>  
      <execution> 
      <id>unpack-dependencies</id> 
      <phase>generate-sources</phase> 
      <goals> 
       <goal>unpack-dependencies</goal> 
      </goals> 
      <configuration> 
       <failOnMissingClassifierArtifact>false</failOnMissingClassifierArtifact> 
       <excludeArtifactIds>servlet-api,android</excludeArtifactIds> 
       <excludeTransitive>true</excludeTransitive> 
       <outputDirectory>${project.build.directory}/generated-classes</outputDirectory> 
      </configuration> 
      </execution> 
     </executions> 
     </plugin> 

     <plugin> 
     <groupId>org.codehaus.mojo</groupId> 
     <artifactId>exec-maven-plugin</artifactId> 
     <version>1.2</version> 
     <executions> 
      <!-- Convert the compiled classes into a clases.dex. --> 
      <execution> 
      <id>generate-dex</id> 
      <phase>process-classes</phase> 
      <goals> 
       <goal>exec</goal> 
      </goals> 
      <configuration> 
       <executable>java</executable> 
       <arguments> 
       <argument>-jar</argument> 
       <argument>C:\Android\adt-bundle-windows-x86_64-20130917\sdk\build-tools\android-4.3\lib\dx.jar</argument> 
       <argument>--dex</argument> 
       <argument>--verbose</argument> 
       <argument>--core-library</argument> 
       <argument>--output=${project.build.directory}/classes.dex</argument> 
       <argument>--positions=lines</argument> 
       <argument>${project.build.directory}/classes/</argument> 
       </arguments> 
      </configuration> 
      </execution> 
     </executions> 
     </plugin> 

     <plugin> 
     <artifactId>maven-antrun-plugin</artifactId> 
     <version>1.6</version> 
     <executions> 
      <execution> 
      <id>copydex</id> 
      <phase>process-classes</phase> 
      <goals> 
       <goal>run</goal> 
      </goals> 
      <configuration> 
       <tasks> 
       <mkdir 
        dir="${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/lib" /> 
       <jar 
        basedir="${project.build.directory}" 
        update="true" 
        includes="classes.dex" 
        destfile="${project.build.directory}/${project.artifactId}-${project.version}/WEB-INF/lib/classes.jar" /> 
       </tasks> 
      </configuration> 
      </execution> 
     </executions> 
     </plugin> 

     </plugins> 
    </build> 



</project> 

ответ

0

Мы отменили проект. Это невозможно.

0

Предварительно скомпилированные сервлеты JSP для Apache Jasper требуют Jasper и других библиотек. Но они должны быть адаптированы для Android. Я разрешаю эту проблему. См. https://sourceforge.net/projects/beigeerp