Google Application Engine Google App Engine GAE
<bean class="com.intersult.jsf2.PersistenceAnnotationBeanPostProcessor"/>
public class ObjectifyTest { private static LocalServiceTestHelper helper; @BeforeClass public static void setupClass() { LocalDatastoreServiceTestConfig config = new LocalDatastoreServiceTestConfig(); helper = new LocalServiceTestHelper(config); ObjectifyService.register(User.class); } @Before public void setUp() { helper.setUp(); } @After public void tearDown() { helper.tearDown(); } @Test public void test() { Objectify objectify = ObjectifyService.begin(); User user = objectify.find(User.class, 1); }
Um die Libs zur Verfügung zu stellen, wird das maven-war-plugin auf exploded umgestellt:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <version>2.1.1</version> <configuration> <webResources> <resource> <directory>src/main/webapp</directory> <filtering>true</filtering> <includes> <include>**/appengine-web.xml</include> </includes> </resource> </webResources> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>exploded</goal> </goals> </execution> </executions> </plugin>
<dependency> <groupId>javax.el</groupId> <artifactId>el-api</artifactId> <version>2.2</version> </dependency> <dependency> <groupId>org.jboss.el</groupId> <artifactId>jboss-el</artifactId> <version>1.0_02.CR6</version> </dependency> <repository> <id>jboss</id> <name>Jboss Maven Repository</name> <url>https://repository.jboss.org/nexus/content/repositories/releases</url> </repository>
In der web.xml:
<context-param> <param-name>com.sun.faces.expressionFactory</param-name> <param-value>org.jboss.el.ExpressionFactoryImpl</param-value> </context-param>
Die GAE-Runtime prüft im Netzwerk auf Update. Beim Starten aus Maven oder Eclipse, ist das Proxy in die Launch-Config einzutragen:
-DproxyHost=<host> -DproxyPort=<port>
oder in Maven
<plugin> <groupId>net.kindleit</groupId> <artifactId>maven-gae-plugin</artifactId> <version>0.9.2</version> <dependencies> <dependency> <groupId>net.kindleit</groupId> <artifactId>gae-runtime</artifactId> <version>${version.gae}</version> <type>pom</type> </dependency> </dependencies> <configuration> <proxy>host:port</proxy> </configuration> </plugin>
Exception in thread "main" java.lang.ExceptionInInitializerError at com.google.appengine.tools.util.Logging.initializeLogging(Logging.java:35) at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:82) Caused by: java.lang.RuntimeException: Unable to discover the Google App Engine SDK root. This code should be loaded from the SDK directory, but was instead loaded from file:/C:/Users/<profile>/.m2/repository/com/google/appengine/appengine-tools-sdk/1.6.0/appengine-tools-sdk-1.6.0.jar. Specify -Dappengine.sdk.root to override the SDK location. at com.google.appengine.tools.info.SdkInfo.findSdkRoot(SdkInfo.java:102) at com.google.appengine.tools.info.SdkInfo.init(SdkInfo.java:194) at com.google.appengine.tools.info.SdkInfo.getSdkRoot(SdkInfo.java:149) at com.google.appengine.tools.info.SdkImplInfo.<clinit>(SdkImplInfo.java:19) ... 2 more
Lösung: Es befindet sich ein Projekt im Deployment-Assembly mit einer Abhängigkeit zur Google-Engine. Entweder das Projekt herausnehmen oder die Abhängigkeit ändern, sodass sie nicht im Deployment-Assembly erscheint.