Tapestry + JDO + GAE

时间:2012-03-10 23:04:22

标签: java google-app-engine jdo tapestry

我试图在GAE上运行Tapestry。过了一段时间,我能够解决最后的错误,至少显示一个简单的页面。但是,说实话,某种数据存储会很好。 我试图使用tapestry-jdo,但有我的问题:我无法使用JDO的任何部分,我已经尝试了好几天。

我将发布我工作过的pom.xml。我为版本号尝试了很多组合,但是大多数测试JDO的actionlink都失败了,因为找不到org.datanucleus.store.appengine.jdo.DatastoreJDOPersistenceManagerFactory。  剩下的时间里,我从tapestry那里得到了一个未被捕获的异常,这是由另一个缺少的JDO类引起的,但这次不是在构建JDOEntityManagerSource时,而是在更深的地方。

我没有学过编程,我自学了,所以我的专业知识有限。 这个pom.xml可能包含针条目。

如果我用maven构建它,我会在某些情况下获得Could not transfer metadata asm:asm/maven-metadata.xml from/to local.repository (file:../../local.repository/trunk): No connector available to access repository local.repository

<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.example</groupId>
    <artifactId>Example</artifactId>
    <version>0.1</version>
    <packaging>war</packaging>
    <name>Example</name>
    <dependencies>
        <dependency>
            <groupId>org.apache.tapestry</groupId>
            <artifactId>tapestry-core</artifactId>
            <version>${tapestry-release-version}</version>
        </dependency>


        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-api-labs</artifactId>
            <version>${gae.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-api-1.0-sdk</artifactId>
            <version>${gae.version}</version>
        </dependency>

        <dependency>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-java-sdk</artifactId>
            <version>${gae.version}</version>
            <type>pom</type>
        </dependency>

        <dependency>
            <groupId>javax.jdo</groupId>
            <artifactId>jdo2-api</artifactId>
            <version>2.3-eb</version>
        </dependency>

        <dependency>
            <groupId>com.google.appengine.orm</groupId>
            <artifactId>datanucleus-appengine</artifactId>
            <version>2.0.0-RC3</version>
        </dependency>


        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-rdbms</artifactId>
            <version>${datanucleus.version}</version>
        </dependency>

        <dependency>
            <groupId>org.datanucleus</groupId>
            <artifactId>datanucleus-core</artifactId>
            <version>${datanucleus.version}</version>
        </dependency>
        <dependency>
            <groupId>org.tynamo</groupId>
            <artifactId>tapestry-jdo</artifactId>
            <version>0.0.1</version>
        </dependency>

        <!-- Provided by the servlet container, but sometimes referenced in the application code. -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>

    </dependencies>
    <build>
        <finalName>Example</finalName>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <optimize>true</optimize>
                </configuration>
            </plugin>
            <plugin>
                <groupId>net.kindleit</groupId>
                <artifactId>maven-gae-plugin</artifactId>
                <version>0.6.0</version>
                <configuration>
                    <serverId>appengine.google.com</serverId>
                </configuration>
            </plugin>

            <!--
                        This plug-in "enhances" your domain model objects (i.e.
                        makes them persistent for datanucleus)
                    -->
            <plugin>
                <groupId>org.datanucleus</groupId>
                <artifactId>maven-datanucleus-plugin</artifactId>
                <version>1.1.4</version>

                <configuration>
                    <mappingIncludes>**/entities/*.class</mappingIncludes><!--*/ just to stop formatig the rest of the code as comment-->
                    <verbose>true</verbose>
                    <enhancerName>ASM</enhancerName>
                    <api>JDO</api>

                </configuration>
                <executions>
                    <execution>
                        <phase>compile</phase>
                        <goals>
                            <goal>enhance</goal>
                        </goals>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.datanucleus</groupId>
                        <artifactId>datanucleus-core</artifactId>
                        <version>${datanucleus.version}</version>
                        <exclusions>
                            <exclusion>
                                <groupId>javax.transaction</groupId>
                                <artifactId>transaction-api</artifactId>
                            </exclusion>
                        </exclusions>
                    </dependency>
                    <dependency>
                        <groupId>org.datanucleus</groupId>
                        <artifactId>datanucleus-rdbms</artifactId>
                        <version>${datanucleus.version}</version>
                    </dependency>
                    <dependency>
                        <groupId>org.datanucleus</groupId>
                        <artifactId>datanucleus-enhancer</artifactId>
                        <version>1.1.4</version>
                    </dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>


    <repositories>
        <repository>
            <id>tapestry-snapshots</id>
            <url>http://repository.apache.org/snapshots/</url>
        </repository>

        <repository>
            <id>codehaus.snapshots</id>
            <url>http://snapshots.repository.codehaus.org</url>
        </repository>

        <repository>
            <id>maven-gae-plugin-repo</id>
            <name>Maven Google App Engine Repository</name>
            <url>http://maven-gae-plugin.googlecode.com/svn/repository/</url>
        </repository>

        <repository>
            <id>data-nucleus</id>
            <url>http://www.datanucleus.org/downloads/maven2/</url>
        </repository>
    </repositories>

    <pluginRepositories>
        <pluginRepository>
            <id>tapestry-snapshots</id>
            <url>http://repository.apache.org/snapshots/</url>
        </pluginRepository>
        <pluginRepository>
            <id>maven-gae-plugin-repo</id>
            <name>maven-gae-plugin repository</name>
            <url>http://maven-gae-plugin.googlecode.com/svn/repository</url>
        </pluginRepository>

    </pluginRepositories>

    <properties>
        <tapestry-release-version>5.3.2</tapestry-release-version>
        <gae.version>1.6.3</gae.version>
        <datanucleus.version>1.1.5</datanucleus.version>
    </properties>
</project>

1 个答案:

答案 0 :(得分:1)

datanucleus-appengine插件v2应该与DataNucleus jars v3.0。*和javax.jdo jdo-api v3.0.1一起使用...根据GAE的文档 http://code.google.com/p/datanucleus-appengine/wiki/UpgradingToVersionTwo