2012-05-15 2 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" 

그리고이 오류가 나타납니다 경고 : javax.jdo.annotations에 대한 클래스 파일 : 'javax.jdo.annotations.Persisten'유형의 주석 방법 'valueStrategy을()'찾을 수 없습니다. 지속적이지 않음. 오류 : 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

오류가 당신이 작성한 코드와 아무 문제가 없습니다 :

내 명령과 전체 추적합니다. 문제는 클래스 경로에 있습니다.

클래스가 wsgen의에 사용할 수 있도록 클래스 경로를 수정

com.example.prototipo21.Greeting1

에 대한 클래스 파일을 찾을 수 없습니다 당신은 한발 앞서를 얻을 수 있습니다 오류를 검사하는 경우 당신은 분명히 볼 수 있습니다 다음 오류 세트에서 비틀 거림 :) 행운을 빌어 요.

+0

(그냥 따라 디렉토리 경로 변경) : 경고 : apt 툴 및 관련 API 것이 예정이다 다음 주요 JDK 릴리스에서 제거 [.... more warnings ...] 오류 : 주석 유형 javax.jdo.annotations에 대한 선언을 만들 수 없습니다. PrimaryKey. 오류 : annontation 형식 javax.jdo.annotation.Persistent [...]에 대한 선언을 만들 수 없습니다. 어떤 생각 ?? 감사!! =) –

+0

전체 오류를 게시 할 수 있습니까? 세부 사항만으로는 아무 말도하지 못합니다. –

+0

예, 내 주 질문을 편집하여 경고문과 오류를 추가하십시오. 저기 봐주세요! 고맙습니다!! –

0

동일한 오류가 발생했습니다. 이 오류가 발생하는 이유는 GAE가 사용하는 라이브러리에 대한 참조를 wsgen에 제공해야하기 때문입니다.

클래스 경로를 수정하여 다른 jar 파일을 포함하면됩니다. Unix에서는 콜론 ":"을 사용하여 디렉토리를 구분하고 Windows에서는 세미콜론 ";"을 사용합니다.

글쎄, 내가 JDK의 경로를 변경 한하고 cmd를 이제 오류가 있었다

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