无法注入WebServiceContext
我很难尝试注入 WebServiceContext。我的代码如下:
@WebService(name = "ISTService", targetNamespace = "com.zinc.my.ist", endpointInterface = "com.zinc.my.ist.RicService", wsdlLocation = "WEB-INF/wsdl/istSoap.wsdl")
@SchemaValidation(handler = SchemaValidationErrorHandler.class)
public class ISTServiceImpl implements ISTService {
@Resource
private WebServiceContext wsContext;
我在其他项目中开发了许多其他网络服务,并且这一直有效,具有相同的 Mvn 依赖项。
在这个特定的情况下,当我在 weblogic 中发布战争时,我得到:
名为“ist-webServices”的模块部署失败。请参阅错误日志视图 了解更多详情。 weblogic.application.ModuleException: javax.naming.NameNotFoundException:尝试查找时 “com.zinc.my.ist.impl.ISTServiceImpl/wsContext”未找到子上下文 'com'。解决了'';剩余名称 'com.zinc.my.ist.impl.ISTServiceImpl/wsContext'
我搜索了相同的问题。我发现有人必须添加 @Resource(name="wsContext")。就我而言,它不起作用。我不知道这是否是某种 CDI 混淆。
有人知道或可以给我提示正在发生的事情吗?
提前致谢
I'm having a hard time trying to make WebServiceContext to be injected. My Code is as follows:
@WebService(name = "ISTService", targetNamespace = "com.zinc.my.ist", endpointInterface = "com.zinc.my.ist.RicService", wsdlLocation = "WEB-INF/wsdl/istSoap.wsdl")
@SchemaValidation(handler = SchemaValidationErrorHandler.class)
public class ISTServiceImpl implements ISTService {
@Resource
private WebServiceContext wsContext;
I've developed many other webservices in other projects, and this has always worked, with same Mvn dependencies.
In this specific when I publish the war in weblogic, I'm getting:
Module named 'ist-webServices' failed to deploy. See Error Log view
for more detail. weblogic.application.ModuleException:
javax.naming.NameNotFoundException: While trying to lookup
'com.zinc.my.ist.impl.ISTServiceImpl/wsContext' didn't find subcontext
'com'. Resolved ''; remaining name
'com.zinc.my.ist.impl.ISTServiceImpl/wsContext'
I've searched for identic issues. I found someone who had to add @Resource(name="wsContext"). In my case it doesn't work. I don't know if this is some kind of CDI mixup.
Someone knows or can give me a hint about what is happening?
Thanks in advance
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有时,这与您尝试使用的资源的情况有关。
通常,人们会重新启动 Web 应用程序,并等待一段时间才能完成 Web 应用程序与外部 Web 服务或 JNDI 资源或微服务公开的资源之间的链接。
更重要的是,它们使用与weblogic环境兼容的JNDI路径。类似于数据源的
"java:comp/env/jdbc/MyDB"
。我敢打赌网络服务也是如此。转到管理控制台并检查您的Web服务的JNDI名称是否引用良好,并使用自己的名称。要访问 Weblogic 管理控制台,您可以看到 官方文档:
http://localhost:7001/console
但有一些步骤可以使其可用。如果部署了任何 WSDL,您可以查看 Web 服务控制台
@see https:// /www.syntax.com/how-to-find-the-elusive-wsdl-urls-in-weblogic/?lang=fr
Sometimes, it is related to the case of the resource you are trying to use.
Very often, people restart their webapplication and wait some time to get the link done between their webapps and the resources exposed by external webservices or JNDI resources or microservices too.
And more important, they use JNDI path compatible with weblogic environment. Something like
"java:comp/env/jdbc/MyDB"
for a datasource. I bet it is the same for webservices. Go to the admin console and check if the JNDI name of your webservice is referenced well, and use its own name.To access the Weblogic admin console you can see the official documentation :
http://localhost:7001/console
but there are some steps to make it available.You can look inside webservices console if any WSDL is deployed
@see https://www.syntax.com/how-to-find-the-elusive-wsdl-urls-in-weblogic/?lang=fr