在java中部署Web服务

时间:2011-03-03 16:40:23

标签: java web-services java-ee glassfish

我有一个java Web服务。它的实际操作并不重要。但重要的是回报价值。它返回了我创建的一个名为GetReturnCapsule的类。


    /**
     * Web service operation
     */
    @WebMethod(operationName = "get")
    public GetReturnCapsule get(@WebParam(name = "company")
    final String company, @WebParam(name = "timeStamp")
    final long timeStamp, @WebParam(name = "hash")
    final int hash)
    {
       ...stuff
    }

这是返回舱代码。它几乎只是一些数据的包装。


public class GetReturnCapsule
{
    long timeStamp;
    List ips;
    int hash;

    public GetReturnCapsule(long timeStamp,Listips,int hash)
    {
        this.timeStamp = timeStamp;
        this.ips = ips;
        this.hash = hash;
    }

    public long getTimeStamp()
    {
        return timeStamp;
    }

    public int getHash()
    {
        return hash;
    }

    public List getIPs()
    {
        return ips;
    }

}

webservice正确编译。但是,当我尝试部署它时,它会从Glashfish中收到以下错误。


SEVERE: Class [ com/compunetix/vsd/stix/server/webservices/GetReturnCapsule ] not found. Error while loading [ class com.compunetix.vsd.stix.server.webservices.GetIp ]
SEVERE: Class [ com/compunetix/vsd/stix/server/webservices/GetReturnCapsule ] not found. Error while loading [ class com.compunetix.vsd.stix.server.webservices.GetIp ]
SEVERE: Exception while invoking class org.glassfish.ejb.startup.EjbDeployer prepare method
SEVERE: Exception while preparing the app
SEVERE: Exception while preparing the app : Unable to load EJB module.  DeploymentContext does not contain any EJB  Check archive to ensure correct packaging for C:\Documents and Settings\dvargo\My Documents\STix1030Netbeans\STixWebService\build\web
SEVERE: Class [ com/compunetix/vsd/stix/server/webservices/GetReturnCapsule ] not found. Error while loading [ class com.compunetix.vsd.stix.server.webservices.GetIp ]
SEVERE: Class [ com/compunetix/vsd/stix/server/webservices/GetReturnCapsule ] not found. Error while loading [ class com.compunetix.vsd.stix.server.webservices.GetIp ]
SEVERE: Exception while invoking class org.glassfish.ejb.startup.EjbDeployer prepare method
SEVERE: Exception while preparing the app
SEVERE: Exception while preparing the app : Unable to load EJB module.  DeploymentContext does not contain any EJB  Check archive to ensure correct packaging for C:\Documents and Settings\dvargo\My Documents\STix1030Netbeans\STixWebService\build\web


我的主要问题是,是否可以使用java Web服务实际返回自定义类。我的第二个问题是,关于如何根据这些错误消息解决这个问题的任何想法?

1 个答案:

答案 0 :(得分:0)

是的,您可以使用java Web服务返回自定义类。 至于你的第二个问题,看起来你错过了依赖你的耳朵。看看这个post