Weblogic找不到具有“正确”的资源适配器绑定的JNDI名称 [英] Weblogic could not find resource adapter with "correct" JNDI name for binding

查看:344
本文介绍了Weblogic找不到具有“正确”的资源适配器绑定的JNDI名称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图将WebLogic 10.3.5上的消息驱动Bean与Oracle JCA文件适配器(包含在SOA套件中)进行绑定。所以当有任何.txt文件被移动到特定目录时,我的MDB可以得到通知。

I am trying to bind my message driven bean with Oracle JCA file adapter (which is included in the SOA suite) on Weblogic 10.3.5. So that my MDB can get notified when there is any .txt file is moved to specific directory.

在启动了支持SOA功能的Weblogic域之后,文件适配器将自动部署。在Weblogic控制台上,我可以看到文件适配器被部署为资源适配器,运行状况为OK,状态为Active,如下所示:

After launching a Weblogic domain with SOA features supported, the file adapter is automatically deployed. On Weblogic console I can see the file adapter is deployed as a "Resource Adapter", health is "OK", state is "Active", as shown below:

img src =https://i.stack.imgur.com/c7zIL.jpgalt =Weblogic中部署的文件适配器>

我还运行测试的文件适配器,他们都通过了:

Also I run the tests of the file adapter, and they all passed:

所以我认为文件适配器正确部署,应该是正常的。

So I think the file adapter is correctly deployed and should be functional.

然后我的消息驱动的bean代码如下所示:

Then my message driven bean code looks like this:

import java.util.logging.Logger;
import javax.ejb.MessageDriven;
import javax.resource.ResourceException;
import javax.resource.cci.MessageListener;
import javax.resource.cci.Record;

@MessageDriven
public class FileAdapterClientMDB implements MessageListener {

    private Logger logger = Logger.getLogger(FileAdapterClientMDB.class.getName());

    public FileAdapterClientMDB() {

    }

    @Override
    public Record onMessage(Record record) throws ResourceException {
        logger.info("Received record: " + record);
        return record;
    }
}

以下是我的 ejb- jar.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<ejb-jar xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:ejb="http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd" version="3.0">
  <display-name>MockEJB</display-name>
  <enterprise-beans>
    <message-driven>
      <description>EMessage Driven Bean as File Adapter Client</description>
      <display-name>FileAdapterClientMDB</display-name>
      <ejb-name>FileAdapterClientMDB</ejb-name>
      <ejb-class>com.test.FileAdapterClientMDB</ejb-class>
      <messaging-type>javax.resource.cci.MessageListener</messaging-type>
      <transaction-type>Container</transaction-type>
      <activation-config>
        <activation-config-property>
          <activation-config-property-name>physicalDirectory</activation-config-property-name>
          <activation-config-property-value>C:\dataDir</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>deleteFile</activation-config-property-name>
          <activation-config-property-value>true</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>pollingFrequency</activation-config-property-name>
          <activation-config-property-value>10</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>includeFiles</activation-config-property-name>
          <activation-config-property-value>.*\.txt</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
          <activation-config-property-name>minimumAge</activation-config-property-name>
          <activation-config-property-value>0</activation-config-property-value>
        </activation-config-property>
      </activation-config>
    </message-driven>
  </enterprise-beans>
</ejb-jar>

我的 weblogic-ejb-jar.xml 文件:

<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-ejb-jar xmlns:wls="http://www.bea.com/ns/weblogic/weblogic-ejb-jar" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd http://www.bea.com/ns/weblogic/weblogic-ejb-jar http://www.bea.com/ns/weblogic/weblogic-ejb-jar/1.0/weblogic-ejb-jar.xsd">
    <!--weblogic-version:10.3-->
    <wls:weblogic-enterprise-bean>
        <!--options:RESOURCE_ADAPTER_JNDI-->
        <wls:ejb-name>FileAdapterClientMDB</wls:ejb-name>
        <wls:message-driven-descriptor>
            <wls:resource-adapter-jndi-name>eis/FileAdapter</wls:resource-adapter-jndi-name>
        </wls:message-driven-descriptor>
        <wls:jndi-name>FileAdapterClientMDB</wls:jndi-name>
        <wls:local-jndi-name>FileAdapterClientMDB</wls:local-jndi-name>
    </wls:weblogic-enterprise-bean>
</wls:weblogic-ejb-jar>

在部署EAR项目时,我收到以下消息:

While deploying the EAR project, I got this message:

<20.4.2012 22:42:11 CEST> <Warning> <EJB> <BEA-010221> <The Message-Driven EJB: 
FileAdapterClientMDB is unable to bind to the JCA resource adapter: eis/FileAdapter. 
The Error was: No deployed ResourceAdapter with adapter JNDI name = 'eis/FileAdapter' was found.>

我不知道为什么Weblogic抱怨这一点,因为eis / FileAdapterJNDI名称在官方适配器用户指南。另外我可以在Weblogic的JNDI树中看到它:

I have no idea why Weblogic complain this, since the "eis/FileAdapter" JNDI name is mentioned in the official user guide of the adapter. Also I can see it in Weblogic's JNDI tree:

此外,当我在测试Web服务中运行以下代码时:

What's more, when I run the code below in my testing web service:

try {
    final Context context = new InitialContext();
    final Object obj = context.lookup("eis/FileAdapter");
    System.out.println("eis/FileAdapter => " + obj);
} catch (NamingException e) {
    e.printStackTrace();
}

它打印出 eis / FileAdapter => oracle.tip。 adapter.file.FileConnectionFactory@ff51dc ,这意味着JNDI的名称是正确的!

It prints out "eis/FileAdapter => oracle.tip.adapter.file.FileConnectionFactory@ff51dc", which means the JNDI name is correct!

所以我的问题是,为什么Weblogic找不到资源适配器具有正确的JNDI名称绑定?有人可以给我一些关于如何解决的想法吗?

So my question is, why Weblogic could not find resource adapter with a "correct" JNDI name for binding? Could someone give me some ideas on how to solve it?

感谢高级。

Thanks in advanced.

推荐答案

只要你没有看到这个警告重复你没有什么可担心的。它只是表明,当部署MDB时,无法获得适配器的顺序。请注意,MDB会持续尝试每5秒连接一次,因此如果警告继续填充日志,那意味着MDB无法获取适配器意味着它不工作,如果您只有在安全地忽略该警告后才看到警告,更改部署顺序,稍后推送MDB。

as long as you don't see this warning repeating you have nothing to worry. It just shows that in the order of deployment when the MDB was getting deployed it could not get the adapter. Note an MDB keeps trying to connect every 5 secs so if the warning continues to fill the log then that means the MDB has not been able to get the adapter meaning its not working, if you saw the warning only once you can safely ignore it or change the order of deployment and push the MDB little later.

这篇关于Weblogic找不到具有“正确”的资源适配器绑定的JNDI名称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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