SOAP Web服务不适用于EJB调用

时间:2014-09-11 11:51:33

标签: java web-services java-ee soap ejb

我正在尝试创建一个基于SOAP的Web服务,它将在其他项目中调用无状态EJB。我的配置是Server:WAS 8.5,IDE:RAD 8.5,Java 1.6,EJB 3.1和SOAP 1.1。当我编写一个简单的添加方法时,它正确创建Web服务,WSDL,我可以访问Web服务。但是,当我添加另一个调用EJB的方法时,它不允许我创建服务和WSDL,它会抛出错误弹出窗口:

wsgen期间发生错误。

error: compilation failed, errors should have been reported
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.
Note:   ap round: 1
Problem encountered during annotation processing; 
see stacktrace below for more information.
java.lang.NullPointerException
    at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalType(Unknown Source)
    at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalMethod(Unknown Source)
    at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.methodsAreLegal(Unknown Source)
    at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.isLegalImplementation(Unknown Source)
    at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.shouldProcessWebService(Unknown Source)
    at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceVisitor.visitClassDeclaration(Unknown Source)
    at com.sun.tools.apt.mirror.declaration.ClassDeclarationImpl.accept(Unknown Source)
    at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceAP.buildModel(Unknown Source)
    at com.ibm.jtc.jax.tools.ws.processor.modeler.annotation.WebServiceAP.process(Unknown Source)
    at com.sun.mirror.apt.AnnotationProcessors$CompositeAnnotationProcessor.process(Unknown Source)
    at com.sun.tools.apt.comp.Apt.main(Unknown Source)
    at com.sun.tools.apt.main.AptJavaCompiler.compile(Unknown Source)
    at com.sun.tools.apt.main.Main.compile(Unknown Source)
    at com.sun.tools.apt.main.Main.compile(Unknown Source)
    at com.sun.tools.apt.Main.processing(Unknown Source)
    at com.sun.tools.apt.Main.process(Unknown Source)
    at com.sun.tools.apt.Main.process(Unknown Source)
    at com.ibm.jtc.jax.tools.ws.wscompile.WsgenTool.buildModel(Unknown Source)
    at com.ibm.jtc.jax.tools.ws.wscompile.WsgenTool.run(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at com.ibm.ast.ws.jaxws.emitter.jws22.v85.command.AbstractWsGenCommand.execute(Unknown Source)
    at com.ibm.ast.ws.jaxws.emitter.command.WsGenCommand.execute(Unknown Source)
    ....

这是我的代码,工作正常

public class Operations {
    public int addition(int x, int y){
        return x+y;
    }
    public String Greetings(String name){
        return "happy birthday"+name;
    }
}

当我添加

@EJB
    private transient StatusEJBBeanLocal statusEJBBeanLocal;
    public Product StatusFromProductId(int ProdutoID) {
        Product produto = null;
        produto = this.statusEJBBeanLocal.StatusFromProductId(ProdutoID);
        return produto;
    }

显示错误。请通过一些教程链接帮助我,或告诉我我的代码有什么问题,如何从Web服务调用EJB。提前谢谢。

0 个答案:

没有答案