You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by Christopher Riley <cr...@hkmconsultingllc.com> on 2012/03/13 14:55:51 UTC

Should JPA Annotations prevent wsgen from working?

Hi guys,

I have a class that is annotated with JPA annotations like:

*package example;*
*
*
*import java.io.Serializable;
*
*import java.util.Date;*
*import java.util.UUID;*
*
*
*import javax.persistence.Column;*
*import javax.persistence.Entity;*
*import javax.persistence.EnumType;*
*import javax.persistence.Enumerated;*
*import javax.persistence.GeneratedValue;*
*import javax.persistence.GenerationType;*
*import javax.persistence.Id;*
*import javax.persistence.SequenceGenerator;*
*import javax.persistence.Table;*
*import javax.persistence.Temporal;*
*import javax.persistence.TemporalType;*
*import javax.persistence.Transient;*
*
*
*
*
*
*
*@Entity*
*@Table(name = "Table1", schema = "GeneralSchema")*
*public class SampleJPA implements Serializable {*
*
*
* private static final long serialVersionUID = 1L;*
*
*
* @Id*
* @SequenceGenerator(allocationSize=1, name="KEY_GENERATOR",
sequenceName="GeneralSchema.KEY_SEQ")*
* @GeneratedValue(strategy=GenerationType.SEQUENCE,
generator="KEY_GENERATOR")*
* @Column(name="SAMPLE_KEY")*
* private long sampleKey;*

.....

When running wsgen against this to eventually deploy into CXF I am getting
the following exception/stack trace:

*wsgen -cp . example.SampleJPAService -wsdl -r ../src -s ../src*
*./example/SampleJPA.class: warning: Cannot find annotation method 'name()'
in type 'javax.persistence.Table': class file for javax.persistence.Table
not found*
*./example/SampleJPA.class: warning: Cannot find annotation method
'schema()' in type 'javax.persistence.Table'*
*./example/SampleJPA.class: warning: Cannot find annotation method
'allocationSize()' in type 'javax.persistence.SequenceGenerator': class
file for javax.persistence.SequenceGenerator not found*
*./example/SampleJPA.class: warning: Cannot find annotation method 'name()'
in type 'javax.persistence.SequenceGenerator'*
*./example/SampleJPA.class: warning: Cannot find annotation method
'sequenceName()' in type 'javax.persistence.SequenceGenerator'*
*./example/SampleJPA.class: warning: Cannot find annotation method
'strategy()' in type 'javax.persistence.GeneratedValue': class file for
javax.persistence.GeneratedValue not found*
*Problem encountered during annotation processing; *
*see stacktrace below for more information.*
*java.lang.NullPointerException*
* at
com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.isLegalType(WebServiceVisitor.java:770)
*
* at
com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.isLegalMethod(WebServiceVisitor.java:618)
*
* at
com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.methodsAreLegal(WebServiceVisitor.java:588)
*
* at
com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.isLegalImplementation(WebServiceVisitor.java:506)
*
* at
com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.shouldProcessWebService(WebServiceVisitor.java:309)
*
* at
com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(WebServiceVisitor.java:112)
*
* at
com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(ClassDeclarationImpl.java:95)
*
* at
com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.buildModel(WebServiceAP.java:315)
*
* at
com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.process(WebServiceAP.java:256)
*
* at
com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
*
* at com.sun.tools.apt.comp.Apt.main(Apt.java:454)*
* at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:258)*
* at com.sun.tools.apt.main.Main.compile(Main.java:1102)*
* at com.sun.tools.apt.main.Main.compile(Main.java:964)*
* at com.sun.tools.apt.Main.processing(Main.java:95)*
* at com.sun.tools.apt.Main.process(Main.java:85)*
* at com.sun.tools.apt.Main.process(Main.java:67)*
* at
com.sun.tools.internal.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:209)
*
* at com.sun.tools.internal.ws.wscompile.WsgenTool.run(WsgenTool.java:112)*
* at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)*
* at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
*
* at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
*
* at java.lang.reflect.Method.invoke(Method.java:597)*
* at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:111)*
* at com.sun.tools.internal.ws.WsGen.main(WsGen.java:41)*
*error: compilation failed, errors should have been reported*

I cannot provide the actual classes for this example as it is confidential
so hopefully the above points to something. I haven't found anything in
particular that points to conflicts with other annotations. My current
workaround is to comment out the JPA annotations and generate via wsgen.
This works fine if I follow that approach.

Thanks
Chris

-- 
Chris Riley, Partner
HKM Consulting LLC
(o)  774.553.5314
(m) 508.273.3102
(f)   774.553.5316

Re: Should JPA Annotations prevent wsgen from working?

Posted by Christopher Riley <cr...@hkmconsultingllc.com>.
Hi guys,

Lack of sleep and a third person's examination pointed out to the simple
problem below which was the classpath not including the persistence jar.

Sorry for the post!

Chris

On Tue, Mar 13, 2012 at 9:55 AM, Christopher Riley <
criley@hkmconsultingllc.com> wrote:

> Hi guys,
>
> I have a class that is annotated with JPA annotations like:
>
> *package example;*
> *
> *
> *import java.io.Serializable;
> *
> *import java.util.Date;*
> *import java.util.UUID;*
> *
> *
> *import javax.persistence.Column;*
> *import javax.persistence.Entity;*
> *import javax.persistence.EnumType;*
> *import javax.persistence.Enumerated;*
> *import javax.persistence.GeneratedValue;*
> *import javax.persistence.GenerationType;*
> *import javax.persistence.Id;*
> *import javax.persistence.SequenceGenerator;*
> *import javax.persistence.Table;*
> *import javax.persistence.Temporal;*
> *import javax.persistence.TemporalType;*
> *import javax.persistence.Transient;*
> *
> *
> *
> *
> *
> *
> *@Entity*
> *@Table(name = "Table1", schema = "GeneralSchema")*
> *public class SampleJPA implements Serializable {*
> *
> *
> * private static final long serialVersionUID = 1L;*
> *
> *
> * @Id*
> * @SequenceGenerator(allocationSize=1, name="KEY_GENERATOR",
> sequenceName="GeneralSchema.KEY_SEQ")*
> * @GeneratedValue(strategy=GenerationType.SEQUENCE,
> generator="KEY_GENERATOR")*
> * @Column(name="SAMPLE_KEY")*
> * private long sampleKey;*
>
> .....
>
> When running wsgen against this to eventually deploy into CXF I am getting
> the following exception/stack trace:
>
> *wsgen -cp . example.SampleJPAService -wsdl -r ../src -s ../src*
> *./example/SampleJPA.class: warning: Cannot find annotation method
> 'name()' in type 'javax.persistence.Table': class file for
> javax.persistence.Table not found*
> *./example/SampleJPA.class: warning: Cannot find annotation method
> 'schema()' in type 'javax.persistence.Table'*
> *./example/SampleJPA.class: warning: Cannot find annotation method
> 'allocationSize()' in type 'javax.persistence.SequenceGenerator': class
> file for javax.persistence.SequenceGenerator not found*
> *./example/SampleJPA.class: warning: Cannot find annotation method
> 'name()' in type 'javax.persistence.SequenceGenerator'*
> *./example/SampleJPA.class: warning: Cannot find annotation method
> 'sequenceName()' in type 'javax.persistence.SequenceGenerator'*
> *./example/SampleJPA.class: warning: Cannot find annotation method
> 'strategy()' in type 'javax.persistence.GeneratedValue': class file for
> javax.persistence.GeneratedValue not found*
> *Problem encountered during annotation processing; *
> *see stacktrace below for more information.*
> *java.lang.NullPointerException*
> * at
> com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.isLegalType(WebServiceVisitor.java:770)
> *
> * at
> com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.isLegalMethod(WebServiceVisitor.java:618)
> *
> * at
> com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.methodsAreLegal(WebServiceVisitor.java:588)
> *
> * at
> com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.isLegalImplementation(WebServiceVisitor.java:506)
> *
> * at
> com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.shouldProcessWebService(WebServiceVisitor.java:309)
> *
> * at
> com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(WebServiceVisitor.java:112)
> *
> * at
> com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(ClassDeclarationImpl.java:95)
> *
> * at
> com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.buildModel(WebServiceAP.java:315)
> *
> * at
> com.sun.tools.internal.ws.processor.modeler.annotation.WebServiceAP.process(WebServiceAP.java:256)
> *
> * at
> com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(AnnotationProcessors.java:60)
> *
> * at com.sun.tools.apt.comp.Apt.main(Apt.java:454)*
> * at com.sun.tools.apt.main.JavaCompiler.compile(JavaCompiler.java:258)*
> * at com.sun.tools.apt.main.Main.compile(Main.java:1102)*
> * at com.sun.tools.apt.main.Main.compile(Main.java:964)*
> * at com.sun.tools.apt.Main.processing(Main.java:95)*
> * at com.sun.tools.apt.Main.process(Main.java:85)*
> * at com.sun.tools.apt.Main.process(Main.java:67)*
> * at
> com.sun.tools.internal.ws.wscompile.WsgenTool.buildModel(WsgenTool.java:209)
> *
> * at com.sun.tools.internal.ws.wscompile.WsgenTool.run(WsgenTool.java:112)
> *
> * at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)*
> * at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
> *
> * at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
> *
> * at java.lang.reflect.Method.invoke(Method.java:597)*
> * at com.sun.tools.internal.ws.Invoker.invoke(Invoker.java:111)*
> * at com.sun.tools.internal.ws.WsGen.main(WsGen.java:41)*
> *error: compilation failed, errors should have been reported*
>
> I cannot provide the actual classes for this example as it is confidential
> so hopefully the above points to something. I haven't found anything in
> particular that points to conflicts with other annotations. My current
> workaround is to comment out the JPA annotations and generate via wsgen.
> This works fine if I follow that approach.
>
> Thanks
> Chris
>
> --
> Chris Riley, Partner
> HKM Consulting LLC
> (o)  774.553.5314
> (m) 508.273.3102
> (f)   774.553.5316
>
>
>


-- 
Chris Riley, Partner
HKM Consulting LLC
(o)  774.553.5314
(m) 508.273.3102
(f)   774.553.5316