2012-05-15 6 views
1

Я пытаюсь выполнить команду wsgen для создания веб-службы. Мои командные строки являются: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" 

И появляется эта ошибка: предупреждение: Не удается найти метод аннотаций «valueStrategy()» в тип «javax.jdo.annotations.Persisten»: файл класса для javax.jdo.annotations. Стойкий не найден. ошибка: Не удается найти файл класса для com.example.prototipo21.Greeting 1 ошибка 1 предупреждение ошибка: компиляция не удалась, ошибки должны были сообщены

Я думаю, что проблема может быть я интегрирование Датастора приложения в приложении веб-службы, поэтому мой класс имеет разные аннотации. Например:

@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 

ответ

0

ошибка не имеет никаких проблем с кодом вы написали. Проблема связана с classpath. Если проанализировать ошибки вы можете отчетливо видеть:

Не удалось найти файл класса для com.example.prototipo21.Greeting1

Исправьте путь к классам, так что класс доступен для wsgen и вы можете получить на шаг вперед и споткнуться в следующем наборе ошибок :) Удачи

+0

Ну, я изменил путь к JDK и теперь ошибки в ЦМД были: предупреждение: АПП инструмент и связанный с ним API планируется удаляться в следующей крупной версии JDK [.... more warnings ...] error: Не удалось создать объявление для типа аннотации javax.jdo.annotations. Основной ключ. error: Не удалось создать объявление для типа annontation javax.jdo.annotation.Persistent [...]. Есть идеи?? БЛАГОДАРЯ!! =) –

+0

Не могли бы вы заполнить полную ошибку? Подробности недостаточно, чтобы что-то сказать правильно –

+0

Да, я редактирую свой основной вопрос, чтобы добавить комады, предупреждения и ошибки, посмотрите там, пожалуйста! Спасибо!! –

0

У меня была такая же ошибка. Причина, по которой вы получаете эту ошибку, заключается в том, что вы должны дать wsgen ссылку на библиотеки, которые использует GAE.

Просто измените путь к классу, чтобы включить другие файлы jar. Обратите внимание, что в Unix мы используем двоеточие «:» для разделения каталогов, а в Windows мы используем «двоеточие» «;».

(Просто изменить путь к каталогу соответственно)

class=com.sample.MyWebService 
clpth='./war/WEB-INF/classes:/Applications/eclipse_jee/plugins/com.google.appengine.eclipse.sdkbundle_1.7.0/appengine-java-sdk-1.7.0/lib/opt/user/datanucleus/v2/jdo-api-3.1-SNAPSHOT-20110926.jar:/Applications/eclipse_jee/plugins/com.google.appengine.eclipse.sdkbundle_1.7.0/appengine-java-sdk-1.7.0/lib/user/appengine-api-1.0-sdk-1.7.0.jar' 
resourcedir='./war' 
outsourcedir='./src' 
outdir='./war/WEB-INF/classes' 
wsgen -cp "$clpth" -wsdl -keep -r "$resourcedir" -d "$outdir" -s "$outsourcedir" $class