将Glassfish web.xml servlet映射到@WebService会得到ClassCastException [英] Glassfish web.xml servlet mapping to @WebService gets ClassCastException

查看:104
本文介绍了将Glassfish web.xml servlet映射到@WebService会得到ClassCastException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在部署到Glassfish(最好是TomEE)时控制Web服务的URL端点。

我有一个类:

  @Stateless 
@WebService(
targetNamespace =http://foo.net/doc/2012- 08-01,
name =FooService,
portName =FooPort,
serviceName =FooService)
public class FooSoapService extends SoapBase {
。 ..
}

和一个web.xml:

 < servlet> 
< description>用于Foo操作的SOAP Endpoint。< / description>
< servlet-name> Foo< / servlet-name>
< servlet-class> com.foo.FooSoapService< / servlet-class>
< / servlet>
< servlet-mapping>
< servlet-name> FooPack< / servlet-name>
< url-pattern> / soap / FooPack< / url-pattern>
< / servlet-mapping>

如果我在Glassfish中部署时访问/ context-root / soap / FooPack?wsdl, :

  java.lang.ClassCastException:com.foo.FooSoapService无法转换为javax.servlet.Servlet 

除了一些jax-rs外,web.xml中几乎没有其他东西。



有什么想法?

解决方案

glassfish 4.0也具备此功能。该配置可以无错地部署。


Am trying to gain control over the URL endpoints of my web services when deployed to Glassfish (and preferably to TomEE too).

I have a class:

@Stateless
@WebService(
    targetNamespace = "http://foo.net/doc/2012-08-01",
    name = "FooService",
    portName = "FooPort",
    serviceName = "FooService")
public class FooSoapService extends SoapBase {
...
}

And a web.xml:

<servlet>
    <description>SOAP Endpoint for Foo operations.</description>
    <servlet-name>Foo</servlet-name>
    <servlet-class>com.foo.FooSoapService</servlet-class>
</servlet>
<servlet-mapping>
    <servlet-name>FooPack</servlet-name>
    <url-pattern>/soap/FooPack</url-pattern>
</servlet-mapping>

If I visit /context-root/soap/FooPack?wsdl when deployed in Glassfish I end up with:

java.lang.ClassCastException: com.foo.FooSoapService cannot be cast to javax.servlet.Servlet

There's virtually nothing else in the web.xml excepting some jax-rs stuff.

Any ideas?

解决方案

glassfish 4.0 has this capability too. The configuration is deployable without errors.

这篇关于将Glassfish web.xml servlet映射到@WebService会得到ClassCastException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆