2011-03-03 144 views
1

我有一個java web服務。它的實際操作並不重要。但重要的是回報價值。它正在返回我創建的名爲GetReturnCapsule的課程。用java部署web服務

 

    /** 
    * 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服務的自定義類。我的第二個問題是,關於如何根據這些錯誤消息解決此問題的任何想法?

回答

0

是的,你可以返回自定義類與Java Web服務。 至於你的第二個問題,看起來你錯過了依賴關係。看看這個post