我在为 CXF REST 服务 API 项目集成 enunciate 和 ant 时遇到错误。方法 getFeeItemsByCapID() 中存在错误。我试图在源代码中找到答案,但没有结果。谁对错误有任何想法?谢谢你的帮助。如果您有任何提示。
蚂蚁脚本
<path id="enunciate.classpath">
<fileset dir="${enunciate.home}/lib">
<include name="*.jar"/>
</fileset>
<!--include (optional) spring module-->
<fileset dir="${enunciate.home}/lib/modules/cxf">
<include name="*.jar"/>
</fileset>
<fileset dir="${java.home}">
<include name="lib/tools.jar"/>
</fileset>
</path>
<taskdef name="enunciate" classname="org.codehaus.enunciate.main.EnunciateTask">
<classpath refid="enunciate.classpath"/>
</taskdef>
<enunciate basedir="java/" configFile="enunciate.xml">
<include name="**/*.java"/>
<classpath refid="enunciate.classpath"/>
<export artifactId="war.file" destination="d:/myapp.war"/>
<javacArgument argument="-g"/>
</enunciate>
发音.xml
<?xml version="1.0"?>
<enunciate label="test" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://enunciate.codehaus.org/schemas/enunciate-1.26.xsd">
<namespaces>
<namespace id="api" uri="http://api.example.com/" />
<namespace id="link" uri="http://api.example.com/link" />
<namespace id="persona" uri="http://api.example.com/persona" />
</namespaces>
<modules>
<!-- Docs -->
<docs splashPackage="org.codehaus.enunciate.api" title="test" copyright="test.com"/>
<java-client disabled="false"/>
<amf disabled="true"/>
<c disabled="true"/>
<obj-c disabled="true"/>
<csharp disabled="true"/>
<spring-app disabled="false"/>
<cxf disabled="false"/>
<gwt disabled="true"/>
<jaxws-ri disabled="true"/>
<jersey disabled="true"/>
</modules>
Java 代码
@GET
@RecordDetailSecurity(RecordDetailSectionType.FEE)
@Path("/{recordIds}/fees/")
@Produces(MediaType.APPLICATION_JSON)
@JsonView(Views.PublicView.class)
public ResponseModel getFeeItemsByCapID(@PathParam("recordIds") String recordIds,
@QueryParam("fields") @DefaultValue("") String fields) throws Exception
{
例外:
java.lang.IllegalStateException: D:\AA7.2.0\main-dev\biz\modules\rest-apis\java\com\accela\restapis\jaxrs\agency\service\FeeWebService.java:76: the element 'value' must have a value specified.
at net.sf.jelly.apt.decorations.declaration.DecoratedAnnotationMirror.<init>(DecoratedAnnotationMirror.java:66)
at net.sf.jelly.apt.decorations.DeclarationDecorator.decorate(DeclarationDecorator.java:362)
at net.sf.jelly.apt.decorations.DeclarationDecorator.decorateAnnotationMirrors(DeclarationDecorator.java:113)
at net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration.getAnnotationMirrors(DecoratedDeclaration.java:213)
at net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration.getAnnotations(DecoratedDeclaration.java:195)
at net.sf.jelly.apt.decorations.declaration.DecoratedDeclaration.getAnnotation(DecoratedDeclaration.java:225)
at org.codehaus.enunciate.contract.jaxrs.ResourceMethod.<init>(ResourceMethod.java:130)
at org.codehaus.enunciate.contract.jaxrs.Resource.getResourceMethods(Resource.java:143)
at org.codehaus.enunciate.contract.jaxrs.Resource.<init>(Resource.java:69)
at org.codehaus.enunciate.contract.jaxrs.RootResource.<init>(RootResource.java:34)
at org.codehaus.enunciate.apt.EnunciateAnnotationProcessor.getRootModel(EnunciateAnnotationProcessor.java:214)
at org.codehaus.enunciate.apt.EnunciateAnnotationProcessor.process(EnunciateAnnotationProcessor.java:103)
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 org.codehaus.enunciate.main.Enunciate.invokeApt(Enunciate.java:777)
at org.codehaus.enunciate.main.Enunciate.doGenerate(Enunciate.java:366)
at org.codehaus.enunciate.main.Enunciate$Stepper.step(Enunciate.java:1735)
at org.codehaus.enunciate.main.Enunciate$Stepper.stepTo(Enunciate.java:1767)
at org.codehaus.enunciate.main.Enunciate.execute(Enunciate.java:174)
at org.codehaus.enunciate.main.EnunciateTask.execute(EnunciateTask.java:156)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:357)
at org.apache.tools.ant.Target.performTasks(Target.java:385)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
at org.apache.tools.ant.Project.executeTarget(Project.java:1306)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1189)
at org.apache.tools.ant.Main.runBuild(Main.java:758)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:257)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:104)
源代码:
public DecoratedAnnotationMirror(AnnotationMirror delegate) {
if (delegate == null) {
throw new IllegalArgumentException("A delegate must be provided.");
}
this.delegate = delegate;
AnnotationType annotationType = delegate.getAnnotationType();
Collection<AnnotationTypeElementDeclaration> allElements = annotationType.getDeclaration() != null? annotationType.getDeclaration().getMethods() : Collections.<AnnotationTypeElementDeclaration>emptyList();
Map<AnnotationTypeElementDeclaration, AnnotationValue> elementValues = getElementValues();
put("annotationType", annotationType);
put("position", delegate.getPosition());
put("elementValues", elementValues);
allElementValues = new HashMap<String, Object>();
for (AnnotationTypeElementDeclaration element : allElements) {
if (elementValues.containsKey(element)) {
Object value = elementValues.get(element).getValue();
allElementValues.put(element.getSimpleName(), value);
put(element.getSimpleName(), value);
}
else {
AnnotationValue defaultValue = element.getDefaultValue();
if (defaultValue == null) {
throw new IllegalStateException(delegate.getPosition() + ": the element '" + element.getSimpleName() + "' must have a value specified.");
}