[英]Deploying web services in java
我有一个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;
}
}
Web服务正确编译。 但是,当我尝试部署它时,它从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服务实际返回自定义类。 我的第二个问题是,关于如何根据这些错误消息解决此问题的任何想法吗?
是的,您可以使用Java Web服务返回自定义类。 至于第二个问题,似乎您的耳朵里缺少依赖性。 看看这个帖子 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.