我試圖執行wsgen命令來創建一個Web服務。我的命令行是:wsgen和App Engine
PATH=%path%;C:\Program Files\Java\jdk1.6.0_24\bin
wsgen -cp ".\war\WEB-INF\classes" -wsdl -keep -r ".\war" -d ".\war\WEB-INF\classes" - s ".\war" "com.example.prototipo21.Greeting"
而且出現這個錯誤: 警告:對於javax.jdo.annotations類文件:在類型「javax.jdo.annotations.Persisten」無法找到標註方法「valueStrategy()」。持久未找到。 錯誤:找不到類文件com.example.prototipo21.Greeting 1錯誤 1警告 錯誤:編譯失敗,錯誤應該已報告
我認爲這個問題可以我整合數據存儲應用在一個Web服務應用程序中,所以我的類有不同的註釋。例如:
@WebService
public class Greeting {
@PrimaryKey
@Persistent (valueStrategy = IdGeneratorStrategy.IDENTITY)
private Key key;
@Persistent
private User author;
...
@WebMethod
public Key getKey() {
return key;
}
@WebMethod
public User getAuthor(){
return author;
....
你知道我是什麼意思?任何想法都會非常有用!謝謝!
這些都是我的命令,整個跟蹤:
c:\Users\...\Desktop\....\Eclipse\Prototipo_21>PATH=%pa
th%;C:\Program Files\Java\jdk1.7.0_03\bin
c:\Users\...\Desktop\....\Eclipse\Prototipo_21>wsgen -c
p ".\war\WEB-INF\classes" -wsdl -keep -r ".\war" -d ".\war\WEB-INF\classes" -s "
.\war" "com.example.prototipo21.Greeting"
warning: The apt tool and its associated API are planned to be
removed in the next major JDK release. These features have been
superseded by javac and the standardized annotation processing API,
javax.annotation.processing and javax.lang.model. Users are
recommended to migrate to the annotation processing features of
javac; see the javac man page for more information.
.\war\WEB-INF\classes\com\example\prototipo21\Greeting.class: warning: Cannot fi
nd annotation method 'valueStrategy()' in type 'Persistent': class file for java
x.jdo.annotations.Persistent not found
warning: unknown enum constant IdGeneratorStrategy.IDENTITY
reason: class file for javax.jdo.annotations.IdGeneratorStrategy not found
error: Could not create declaration for annotation type javax.jdo.annotations.Pr
imaryKey
error: Could not create declaration for annotation type javax.jdo.annotations.Pe
rsistent
Problem encountered during annotation processing;
see stacktrace below for more information.
com.sun.tools.internal.ws.processor.modeler.ModelerException: modeler error: Cla
sses annotated with @javax.jws.WebService must have a public default constructor
. Class: com.example.prototipo21.Greeting
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.o
nError(WebServiceAP.java:229)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisi
tor.isLegalImplementation(WebServiceVisitor.java:515)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisi
tor.shouldProcessWebService(WebServiceVisitor.java:322)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisi
tor.visitClassDeclaration(WebServiceVisitor.java:113)
at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(Clas
sDeclarationImpl.java:113)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.b
uildModel(WebServiceAP.java:319)
at com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.p
rocess(WebServiceAP.java:260)
at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.
process(AnnotationProcessors.java:84)
at com.sun.tools.apt.comp.Apt.main(Apt.java:480)
at com.sun.tools.apt.main.AptJavaCompiler.compile(AptJavaCompiler.java:2
70)
at com.sun.tools.apt.main.Main.compile(Main.java:1127)
at com.sun.tools.apt.main.Main.compile(Main.java:989)
at com.sun.tools.apt.Main.processing(Main.java:113)
at com.sun.tools.apt.Main.process(Main.java:103)
at com.sun.tools.apt.Main.process(Main.java:85)
at com.sun.tools.internal.ws.wscompile.WsgenTool.buildModel(WsgenTool.ja
va:207)
at com.sun.tools.internal.ws.wscompile.WsgenTool.run(WsgenTool.java:111)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:120)
at com.sun.tools.internal.ws.WsGen.main(WsGen.java:42)
error: compilation failed, errors should have been reported
嗯,我已經改變了JDK的路徑,現在在CMD的錯誤是:警告:apt工具及其相關API的計劃在下一個主要的JDK版本中被刪除[....更多警告...]錯誤:無法爲註釋類型javax.jdo.annotations創建聲明。首要的關鍵。錯誤:無法爲annontation類型javax.jdo.annotation.Persistent [...]創建聲明。任何想法??謝謝!! =) –
你能發佈完整的錯誤嗎?細節不足以說明任何內容 –
是的,我編輯我的主要問題添加逗號和警告和錯誤,請看看那裏,請!謝謝!! –