2012-08-08 53 views
0

編組站谷歌的AppEngine關鍵我嘗試使用Google App EngineJaxb2Marshaller我有以下代碼:與Jaxb2Marshaller

@Entity 
@XmlRootElement 
public class Incident { 
    @Id 
    @GeneratedValue(strategy = GenerationType.IDENTITY) 
    private Key incidentId; 

我試圖用@XmlJavaTypeAdapter批註與我的具體適配器或@XMLTransiet簡單地跳過這一領域,但我仍然收到以下錯誤消息。我該如何解決這個問題?

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'appView' defined in ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]: Cannot resolve reference to bean 'jaxbMarshaller' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxbMarshaller' defined in ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Lcom/google/appengine/api/datastore/Key; 
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328) 
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106) 
at org.springframework.beans.factory.support.ConstructorResolver.resolveConstructorArguments(ConstructorResolver.java:630) 
at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:148) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireConstructor(AbstractAutowireCapableBeanFactory.java:1035) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:939) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) 
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) 
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) 
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) 
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585) 
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913) 
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464) 
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:631) 
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:588) 
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:645) 
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:508) 
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:449) 
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:133) 
at javax.servlet.GenericServlet.init(GenericServlet.java:212) 
at org.mortbay.jetty.servlet.ServletHolder.initServlet(ServletHolder.java:440) 
at org.mortbay.jetty.servlet.ServletHolder.doStart(ServletHolder.java:263) 
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) 
at org.mortbay.jetty.servlet.ServletHandler.initialize(ServletHandler.java:685) 
at org.mortbay.jetty.servlet.Context.startContext(Context.java:140) 
at org.mortbay.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1250) 
at org.mortbay.jetty.handler.ContextHandler.doStart(ContextHandler.java:517) 
at org.mortbay.jetty.webapp.WebAppContext.doStart(WebAppContext.java:467) 
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) 
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) 
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) 
at org.mortbay.jetty.handler.HandlerWrapper.doStart(HandlerWrapper.java:130) 
at org.mortbay.jetty.Server.doStart(Server.java:224) 
at org.mortbay.component.AbstractLifeCycle.start(AbstractLifeCycle.java:50) 
at com.google.appengine.tools.development.JettyContainerService.startContainer(JettyContainerService.java:197) 
at com.google.appengine.tools.development.AbstractContainerService.startup(AbstractContainerService.java:241) 
at com.google.appengine.tools.development.DevAppServerImpl.start(DevAppServerImpl.java:148) 
at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:259) 
at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:48) 
at com.google.appengine.tools.development.DevAppServerMain.<init>(DevAppServerMain.java:162) 
at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:138) 

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jaxbMarshaller' defined in ServletContext resource [/WEB-INF/spring/appServlet/servlet-context.xml]: Invocation of init method failed; nested exception is java.lang.NoClassDefFoundError: Lcom/google/appengine/api/datastore/Key; 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1455) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519) 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) 
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294) 
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225) 
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291) 
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193) 
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322) 
... 42 more 

Caused by: java.lang.NoClassDefFoundError: Lcom/google/appengine/api/datastore/Key; 
at java.lang.Class.getDeclaredFields0(Native Method) 
at java.lang.Class.privateGetDeclaredFields(Class.java:2291) 
at java.lang.Class.getDeclaredFields(Class.java:1743) 
at com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator.getDeclaredFields(ReflectionNavigator.java:238) 
at com.sun.xml.internal.bind.v2.model.nav.ReflectionNavigator.getDeclaredFields(ReflectionNavigator.java:47) 
at com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl.findFieldProperties(ClassInfoImpl.java:359) 
at com.sun.xml.internal.bind.v2.model.impl.ClassInfoImpl.getProperties(ClassInfoImpl.java:290) 
at com.sun.xml.internal.bind.v2.model.impl.RuntimeClassInfoImpl.getProperties(RuntimeClassInfoImpl.java:165) 
at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:232) 
at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:89) 
at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:70) 
at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getClassInfo(ModelBuilder.java:198) 
at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:84) 
at com.sun.xml.internal.bind.v2.model.impl.RuntimeModelBuilder.getClassInfo(RuntimeModelBuilder.java:70) 
at com.sun.xml.internal.bind.v2.model.impl.ModelBuilder.getTypeInfo(ModelBuilder.java:304) 
at com.sun.xml.internal.bind.v2.model.impl.TypeRefImpl.calcRef(TypeRefImpl.java:81) 
at com.sun.xml.internal.bind.v2.model.impl.TypeRefImpl.getTarget(TypeRefImpl.java:58) 
at com.sun.xml.internal.bind.v2.model.impl.RuntimeTypeRefImpl.getTarget(RuntimeTypeRefImpl.java:47)  
+0

我也有這個問題,我加了./war/WEB-INF/lib/*.jar;./war/WEB-INF/classes ;.在我的-cp參數,仍然是同樣的問題,希望有人可以幫助.. – 2012-10-29 14:40:12

回答

0

我設法讓我的工作通過將appengine-api-1.0-sdk-1.7.3.jar添加到jaxb類路徑。滑稽的* .jar沒有工作,所以我必須指定完整的.jar

以下添加到您的類路徑ARG

;appengine-api-1.0-sdk-1.7.3.jar 

希望幫助, 我的CMD arg是:

wsgen -cp "./war/WEB-INF/classes;PATH_TO_YOUR_JAR/appengine-api-1.0-sdk-1.7.3.jar" -wsdl -keep -r "./war" -d "./war/WEB-INF/classes" -s "./src" com.example 

確保您指定正確的罐子名字,在我的情況下,它是appengine-api-1.0-sdk-1.7.3.jar

乾杯 Babajide

相關問題