使用Objectify编译Maven项目时找不到ObjectifyFilter类

时间:2015-08-04 08:40:36

标签: eclipse maven google-app-engine google-cloud-datastore objectify

我是GAE的新手,正在根据示例https://cloud.google.com/appengine/docs/java/gettingstarted/usingdatastore开发我的数据存储区应用程序 我的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>DecisionTree</groupId>
 <artifactId>DecisionTree</artifactId>
 <version>0.0.1-SNAPSHOT</version>
 <build>
<sourceDirectory>src</sourceDirectory>
<testSourceDirectory>test</testSourceDirectory>
<resources>
  <resource>
    <directory>src</directory>
    <excludes>
      <exclude>**/*.java</exclude>
    </excludes>
  </resource>
</resources>
<plugins>
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
      <source>1.7</source>
      <target>1.7</target>
    </configuration>
    </plugin>
  </plugins>
 </build>
 <dependencies>
<dependency>
    <groupId>com.googlecode.objectify</groupId>
    <artifactId>objectify</artifactId>
    <version>4.0.1</version>
</dependency>  
<dependency>
<groupId>jstl</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
    </dependency>
  </dependencies>
</project>

我的web.xml是

<?xml version="1.0" encoding="UTF-8"?>
 <web-app 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_2_5.xsd"
     version="2.5"
     xmlns="http://java.sun.com/xml/ns/javaee">
<!-- Servlets -->
<servlet>
<servlet-name>greetServlet</servlet-name>
<servlet- 
class>com.google.gwt.decisiontree.server.GreetingServiceImpl</servlet- 
class>
</servlet>
<servlet-mapping>
<servlet-name>greetServlet</servlet-name>
<url-pattern>/decisiontree/greet</url-pattern>
 </servlet-mapping>

<servlet>
<servlet-name>jsonDecisionTreeData</servlet-name>
<servlet-  
class>com.google.gwt.decisiontree.server.JsonDecisionTreeData</servlet-
class>
</servlet>
  <servlet-mapping>
<servlet-name>jsonDecisionTreeData</servlet-name>
<url-pattern>/decisiontree/jsonData</url-pattern>
</servlet-mapping>

<servlet>
<servlet-name>constructDecisionTree</servlet-name>
<servlet-
 class>com.google.gwt.decisiontree.server.ConstructDecisionTree</servlet-
 class>
</servlet> 
<servlet>
  <servlet-name>insert_attribute_value</servlet-name>
  <servlet-class>com.google.gwt.decisiontree.server.
               InsertAttributeValueServlet</servlet-class>
  </servlet>
  <servlet-mapping>
  <servlet-name>constructDecisionTree</servlet-name>
      <url-pattern>/decisiontree/construct</url-pattern>
   </servlet-mapping>    
  <servlet-mapping>
  <servlet-name>insert_attribute_value</servlet-name>
  <url-pattern>/insert_attribute</url-pattern>
  </servlet-mapping>

<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>DecisionTree.html</welcome-file>
</welcome-file-list>
<!--  for Objectify support, for Google Datastore -->

<filter>
<filter-name>ObjectifyFilter</filter-name>
<filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ObjectifyFilter</filter-name>
<url-pattern>/*</url-pattern>
 </filter-mapping>
 <listener>
<listener-class>com.example.guestbook.OfyHelper</listener-class>
 </listener>
 </web-app>

DecisionTree.html具有以下servlet调用

<a href="decisiontree/construct?action=construct_decision_tree">Construct decision tree</a>
<br/>
<a href="decisiontree/construct?action=construct_svg_decision_tree">Construct SVG decision tree</a>
<br/>
<a href="decisiontree/construct?action=construct_svg_decision_tree_2">Construct SVG decision tree 2</a>
<br/>
<a href="decisiontree/insert_attribute">Insert attribute value</a>

作为编译的结果,我有警告

WARNING: EXCEPTION 
java.lang.ClassNotFoundException:   
 com.googlecode.objectify.ObjectifyFilter
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ....

当我跑http://127.0.0.1:8888/DecisionTree.html时,我得到了

HTTP ERROR: 503

Problem accessing /DecisionTree.html. Reason:

SERVICE_UNAVAILABLE
Powered by Jetty://

我认为Objectify有问​​题。请帮帮我!

1 个答案:

答案 0 :(得分:1)

目前发布的Objectify是5.1.5。你在你的pom中声明4.0.1;那时<UserControl> <UserControl.Resources> <CollectionViewSource Source="{Binding Path=ElementInViewModel}" x:Key="Cvs"> </CollectionViewSource> <HierarchicalDataTemplate DataType="{x:Type DomainModel:YourDomainType}" ItemsSource="{Binding Path=ChildElements}"> <TextBlock Text="{Binding Path=Name}"/> </HierarchicalDataTemplate> <Style TargetType="{x:Type TreeViewItem}"> <Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> </Setter> <Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"> </Setter> </Style> </UserControl.Resources> <DockPanel> <TreeView ItemsSource="{Binding Source={StaticResource Cvs}}"/> </DockPanel> </UserControl> 可能不存在。使用现代版本。