1

我有一个问题 openxava+maven+tomcat7 集成。Openxava 的库集成在 MAVEN proyect 中。我从 ECLIPSE 运行应用程序并抛出这个执行:

Grave: El Servlet.service() for servlet jsp throws a Exception
java.lang.NoSuchMethodError: javax.persistence.EntityManager.getMetamodel()Ljavax/persistence/metamodel/Metamodel;
at org.openxava.annotations.parse.AnnotatedClassParser.obtainManagedClassNamesUsingJPA(AnnotatedClassParser.java:2558)
at org.openxava.annotations.parse.AnnotatedClassParser.getManagedClassNames(AnnotatedClassParser.java:2473)
at org.openxava.annotations.parse.AnnotatedClassParser.getClassNameFor(AnnotatedClassParser.java:2425)
at org.openxava.annotations.parse.AnnotatedClassParser.parse(AnnotatedClassParser.java:67)
at org.openxava.component.ComponentParser.parseAnnotatedClass(ComponentParser.java:47)
at org.openxava.component.ComponentParser.parse(ComponentParser.java:36)
at org.openxava.component.MetaComponent.get(MetaComponent.java:58)
at org.openxava.component.MetaComponent.exists(MetaComponent.java:70)
at org.openxava.application.meta.MetaApplication.existsModel(MetaApplication.java:151)
at org.openxava.application.meta.MetaApplication.getMetaModule(MetaApplication.java:140)
at org.openxava.controller.ModuleManager.getMetaModule(ModuleManager.java:1115)
at org.openxava.controller.ModuleManager.setupModuleControllers(ModuleManager.java:273)
at org.openxava.controller.ModuleManager.setModuleName(ModuleManager.java:1088)
at org.apache.jsp.xava.module_jsp._jspService(module_jsp.java:174)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:749)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:487)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:412)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:339)
at org.openxava.web.servlets.ModuleServlet.doGet(ModuleServlet.java:24)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:409)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1044)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:315)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)

该应用程序与 MySQL 数据库连接。我已经在 TOMCAT 7 上部署了同样的应用程序,但这次它是用 ANT(NO MAVEN)和 WORKS 构建的!为什么不行家?!OPENXAVA+MAVEN 集成的说明是这个站点:http ://code.google.com/p/openxava-maven/wiki/SampleOXMavenProject 。

谢谢

4

2 回答 2

0

您可以在这里找到问题的答案: https ://sourceforge.net/p/openxava/discussion/437013/thread/c6fa8d07/

于 2014-01-30T12:42:43.293 回答
0

为您的项目使用下一个 pom:

<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/maven-v4_0_0.xsd">
      <modelVersion>4.0.0</modelVersion>
      <groupId>org.openxava</groupId>
      <artifactId>myschool-appfog</artifactId>
      <packaging>war</packaging>
      <version>1.0-SNAPSHOT</version>
      <name>MySchool OpenXava Sample Project for AppFog</name>
      <dependencies>

        <dependency>
          <groupId>org.openxava</groupId>
          <artifactId>openxava</artifactId>
          <version>4.8-SNAPSHOT</version>
        </dependency>
        <dependency>
          <groupId>org.hsqldb</groupId>
          <artifactId>hsqldb</artifactId>
          <version>2.2.6</version>
        </dependency>

        <!-- ¿Mover a openxava? Pues sí -->
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-entitymanager</artifactId>
          <version>3.6.10.Final</version>
        </dependency>

        <!-- ¿Mover a openxava? Pues sí -->
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-validator</artifactId>
          <version>4.1.0.Final</version>
        </dependency>

        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-commons-annotations</artifactId>
          <version>3.2.0.Final</version>
        </dependency>

        <dependency>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-jdk14</artifactId>
          <version>1.6.1</version>
        </dependency>
      </dependencies>
    </project>

mavenized openxava 的下一个 pom:

    <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>org.openxava</groupId>
      <artifactId>openxava</artifactId>
      <version>4.8-SNAPSHOT</version>
      <packaging>jar</packaging>

      <name>OpenXava Framework</name>

      <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
      </properties>

      <dependencies>

        <!-- Persistence -->
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-core</artifactId>
          <version>3.6.10.Final</version>
        </dependency>

        <!-- Validators -->
        <dependency>
          <groupId>org.hibernate</groupId>
          <artifactId>hibernate-classic-validator</artifactId>
          <version>3.1.0.GA</version>
        </dependency>

        <dependency>
          <groupId>javax.validation</groupId>
          <artifactId>validation-api</artifactId>
          <version>1.0.0.GA</version>
        </dependency>

        <!-- Web -->
        <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>servlet-api</artifactId>
          <version>2.4</version>
          <scope>provided</scope>
        </dependency>

        <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>jsp-api</artifactId>
          <version>2.0</version>
          <scope>provided</scope>
        </dependency>

        <dependency>
          <groupId>org.directwebremoting</groupId>
          <artifactId>dwr</artifactId>
          <version>2.0.10</version>
        </dependency>

        <dependency>
          <groupId>javax.servlet</groupId>
          <artifactId>jstl</artifactId>
          <version>1.0.3</version>
          <scope>runtime</scope>
        </dependency>

        <dependency>
          <groupId>taglibs</groupId>
          <artifactId>standard</artifactId>
          <version>1.0.3</version>
          <scope>runtime</scope>
        </dependency>

        <!-- Portlets -->
        <dependency>
          <groupId>portlet-api</groupId>
          <artifactId>portlet-api</artifactId>
          <version>1.0</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>com.liferay.portal</groupId>
          <artifactId>portal-service</artifactId>
          <version>5.2.3</version>
          <scope>provided</scope>
        </dependency>
        <dependency>
          <groupId>com.liferay.portal</groupId>
          <artifactId>portal-kernel</artifactId>
          <version>5.2.3</version>
          <scope>provided</scope>
        </dependency>

        <!-- Logging -->
        <dependency>
          <groupId>commons-logging</groupId>
          <artifactId>commons-logging</artifactId>
          <version>1.1.1</version>
        </dependency>

        <!-- IOC -->
        <dependency>
          <groupId>javax.inject</groupId>
          <artifactId>javax.inject</artifactId>
          <version>1</version>
        </dependency>

        <!-- Apache Commons -->
        <dependency>
          <groupId>commons-codec</groupId>
          <artifactId>commons-codec</artifactId>
          <version>1.4</version>
        </dependency>

        <dependency>
          <groupId>commons-fileupload</groupId>
          <artifactId>commons-fileupload</artifactId>
          <version>1.2.2</version>
        </dependency>

        <dependency>
          <groupId>commons-beanutils</groupId>
          <artifactId>commons-beanutils</artifactId>
          <version>1.5</version>
        </dependency>

        <dependency>
          <groupId>commons-validator</groupId>
          <artifactId>commons-validator</artifactId>
          <version>1.3.1</version>
        </dependency>

        <!-- Others -->
        <dependency>
          <groupId>net.sourceforge.htmlunit</groupId>
          <artifactId>htmlunit</artifactId>
          <version>2.9</version>
        </dependency>

        <dependency>
          <groupId>javax.ejb</groupId>
          <artifactId>ejb-api</artifactId>
          <version>3.0</version>
        </dependency>

        <dependency>
          <groupId>javax.mail</groupId>
          <artifactId>mail</artifactId>
          <version>1.4.1</version>
        </dependency>

        <dependency>
          <groupId>jasperreports</groupId>
          <artifactId>jasperreports</artifactId>
          <version>3.5.3</version>
        </dependency>

        <dependency>
          <groupId>junit</groupId>
          <artifactId>junit</artifactId>
          <version>3.8.2</version>
        </dependency>

        <dependency>
          <groupId>org.apache.pdfbox</groupId>
          <artifactId>pdfbox</artifactId>
          <version>1.7.1</version>
        </dependency>

      </dependencies>

    </project>
于 2014-01-30T12:47:45.047 回答