【问题标题】:Connecting to Filenet running on Websphere 8.5 via EJB transport using Spring Boot with Embedded Tomcat使用带有嵌入式 Tomcat 的 Spring Boot 通过 EJB 传输连接到在 Websphere 8.5 上运行的 Filenet
【发布时间】:2016-09-01 12:22:34
【问题描述】:

我正在使用带有 EJB 传输的 Filenet CEAPI 开发 Spring Boot 应用程序(Filenet Web Service (CEWS) 连接不是一个选项),但是当我尝试运行我的 spring boot 应用程序时,我收到以下错误并且每一秒都会重来一遍:

NMSV0307E: 使用了 java: URL 名称,但未将命名配置为 处理 java: URL 名称。可能的原因是用户错误地尝试 在非 J2EE 客户端或服务器中指定 java: URL 名称 环境。抛出 ConfigurationException。

我的配置是:

spring.version = 4.2.2.RELEASE

spring.boot.version = 1.2.7.RELEASE
                (I’ve tried 1.4.0.RELEASE, but I got the same results)

Websphere = 8.5 - this runs the Filenet Content Engine

Filenet & CEAPI = 5.2.1 - using EJB connection

我用过教程:http://www.notonlyanecmplace.com/how-to-connect-via-ejb-to-p8-5-2-and-websphere-v8-5/

我已经使用这个 Stackoverflow 条目启用了 Tomcat JNDI 命名:

How to create JNDI context in Spring Boot with Embedded Tomcat Container

虽然在tomcat.enableNaming(); 行添加断点不会停止...

我正在使用这个解决方案的这一部分:

@Bean
public TomcatEmbeddedServletContainerFactory tomcatFactory() {
    return new TomcatEmbeddedServletContainerFactory() {

        @Override
        protected TomcatEmbeddedServletContainer getTomcatEmbeddedServletContainer(
                Tomcat tomcat) {
            tomcat.enableNaming();
            return super.getTomcatEmbeddedServletContainer(tomcat);
        }
    };
}

我不使用其余的,因为我不想通过 JNDI 查找任何内容,因为 Filenet API 会这样做。

总结一下:有人可以告诉我如何使用 Spring Boot 1.2.7 和嵌入式 Tomcat 通过 EJB 传输协议上的 Filenet Java API 连接到在 Websphere 8.5 应用服务器上运行的 Filenet?

编辑:

Filenet API 使用从 Websphere 服务器选择的以下文件:

com.ibm.ws.orb_8.5.0.jar
com.ibm.ws.ejb.thinclient_8.5.0
key.p12
sas.client.props
ssl.client.props
trust.p12

编辑 #2:

在完善日志记录后,我有一组新的日志消息:

2016-09-02 10:45:37.581 DEBUG 8820 --- [P=678944:O=0:CT] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'context.listener.classes' in [servletConfigInitParams]
2016-09-02 10:45:37.597 DEBUG 8820 --- [P=678944:O=0:CT] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'context.listener.classes' in [servletContextInitParams]
2016-09-02 10:45:37.597 DEBUG 8820 --- [P=678944:O=0:CT] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'context.listener.classes' in [jndiProperties]
2016-09-02 10:45:37.597 DEBUG 8820 --- [P=678944:O=0:CT] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [java:comp/env/context.listener.classes]
2016-09-02 10:45:37.598 ERROR 8820 --- [P=678944:O=0:CT] c.i.w.naming.java.javaURLContextFactory  : javaAccessorNotSet
2016-09-02 10:45:37.598 DEBUG 8820 --- [P=678944:O=0:CT] o.s.jndi.JndiLocatorDelegate             : Converted JNDI name [java:comp/env/context.listener.classes] not found - trying original name [context.listener.classes]. javax.naming.ConfigurationException: Name space accessor for the java: name space has not been set. Possible cause is that the user is specifying a java: URL name in a JNDI Context method call but is not running in a J2EE client or server environment.
2016-09-02 10:45:37.599 DEBUG 8820 --- [P=678944:O=0:CT] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [context.listener.classes]
2016-09-02 10:45:38.623 DEBUG 8820 --- [P=678944:O=0:CT] o.s.jndi.JndiPropertySource              : JNDI lookup for name [context.listener.classes] threw NamingException with message: Could not obtain an initial context due to a communication failure. Since no provider URL was specified, the default provider URL of "corbaloc:iiop:1.0@<MY_COMPUTERS_ADDRESS>:2809/NameService" was used.  Make sure that any bootstrap address information in the URL is correct and that the target name server is running.  Possible causes other than an incorrect bootstrap address or unavailable name server include the network environment and workstation network configuration.. Returning null.
2016-09-02 10:45:38.623 DEBUG 8820 --- [P=678944:O=0:CT] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'context.listener.classes' in [systemProperties]
2016-09-02 10:45:38.623 DEBUG 8820 --- [P=678944:O=0:CT] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'context.listener.classes' in [systemEnvironment]
2016-09-02 10:45:38.624 DEBUG 8820 --- [P=678944:O=0:CT] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'context.listener.classes' in [random]
2016-09-02 10:45:38.624 DEBUG 8820 --- [P=678944:O=0:CT] o.s.c.e.PropertySourcesPropertyResolver  : Searching for key 'context.listener.classes' in [applicationConfigurationProperties]
2016-09-02 10:45:38.624 DEBUG 8820 --- [P=678944:O=0:CT] o.s.c.e.PropertySourcesPropertyResolver  : Could not find key 'context.listener.classes' in any property source. Returning [null]
2016-09-02 10:45:38.625 DEBUG 8820 --- [P=678944:O=0:CT] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [java:comp/env/spring.mandatoryFileEncoding]
2016-09-02 10:45:38.627 ERROR 8820 --- [P=678944:O=0:CT] c.i.w.naming.java.javaURLContextFactory  : javaAccessorNotSet
2016-09-02 10:45:38.627 DEBUG 8820 --- [P=678944:O=0:CT] o.s.jndi.JndiLocatorDelegate             : Converted JNDI name [java:comp/env/spring.mandatoryFileEncoding] not found - trying original name [spring.mandatoryFileEncoding]. javax.naming.ConfigurationException: Name space accessor for the java: name space has not been set. Possible cause is that the user is specifying a java: URL name in a JNDI Context method call but is not running in a J2EE client or server environment.
2016-09-02 10:45:38.627 DEBUG 8820 --- [P=678944:O=0:CT] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [spring.mandatoryFileEncoding]
2016-09-02 10:45:39.634 DEBUG 8820 --- [P=678944:O=0:CT] o.s.jndi.JndiPropertySource              : JNDI lookup for name [spring.mandatoryFileEncoding] threw NamingException with message: Could not obtain an initial context due to a communication failure. Since no provider URL was specified, the default provider URL of "corbaloc:iiop:1.0@<MY_COMPUTERS_ADDRESS>:2809/NameService" was used.  Make sure that any bootstrap address information in the URL is correct and that the target name server is running.  Possible causes other than an incorrect bootstrap address or unavailable name server include the network environment and workstation network configuration.. Returning null.
2016-09-02 10:45:39.635 DEBUG 8820 --- [P=678944:O=0:CT] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [java:comp/env/spring.mandatory_file_encoding]
2016-09-02 10:45:39.636 ERROR 8820 --- [P=678944:O=0:CT] c.i.w.naming.java.javaURLContextFactory  : javaAccessorNotSet
2016-09-02 10:45:39.636 DEBUG 8820 --- [P=678944:O=0:CT] o.s.jndi.JndiLocatorDelegate             : Converted JNDI name [java:comp/env/spring.mandatory_file_encoding] not found - trying original name [spring.mandatory_file_encoding]. javax.naming.ConfigurationException: Name space accessor for the java: name space has not been set. Possible cause is that the user is specifying a java: URL name in a JNDI Context method call but is not running in a J2EE client or server environment.
2016-09-02 10:45:39.637 DEBUG 8820 --- [P=678944:O=0:CT] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [spring.mandatory_file_encoding]
2016-09-02 10:45:40.645 DEBUG 8820 --- [P=678944:O=0:CT] o.s.jndi.JndiPropertySource              : JNDI lookup for name [spring.mandatory_file_encoding] threw NamingException with message: Could not obtain an initial context due to a communication failure. Since no provider URL was specified, the default provider URL of "corbaloc:iiop:1.0@<MY_COMPUTERS_ADDRESS>:2809/NameService" was used.  Make sure that any bootstrap address information in the URL is correct and that the target name server is running.  Possible causes other than an incorrect bootstrap address or unavailable name server include the network environment and workstation network configuration.. Returning null.
2016-09-02 10:45:40.646 DEBUG 8820 --- [P=678944:O=0:CT] org.springframework.jndi.JndiTemplate    : Looking up JNDI object with name [java:comp/env/spring.mandatory-file-encoding]
2016-09-02 10:45:40.646 ERROR 8820 --- [P=678944:O=0:CT] c.i.w.naming.java.javaURLContextFactory  : javaAccessorNotSet

【问题讨论】:

  • FileNet 有大量样本:www-01.ibm.com/support/…
  • 谢谢,但问题在于 Spring Boot - 我能够编写独立的非 Spring Boot Java 应用程序。
  • @Kumite 你是如何解决这个问题的?我也有类似的问题。

标签: spring-boot websphere-8 filenet-p8 filenet


【解决方案1】:

正如NMSV0307E WebSphere 错误所说,您不能在托管环境(应用程序服务器或应用程序客户端)之外使用java: 命名空间。您需要找到 EJB 的实际绑定名称,例如通过在包含 EJB 的 WebSphere Application Server 的 SystemOut.log 中查找相关的CNTR0167I 消息,然后使用该名称进行查找。

【讨论】:

    【解决方案2】:

    你能分享你的代码吗

    但这里一目了然

    如果您将使用嵌入式 tomcat,则必须使用 WSI,而对于 EJB,您不应使用嵌入式 tomcat 并将其部署为 Websphere 或 Jboss 或 WebLogic 中的 WAR,因为它们支持 EJB 传输,例如与 WSI 的连接

    public static final String CE_URI_WSI = "http://localhost:9080/wsi/FNCEWS40MTOM";
        public static final String CE_URI_EJB = "iiop://localhost:9080/FileNet/Engine";
        public static final String stanzaWSI= "FileNetP8WSI";
        public static final String STANZA_EJB = "FileNetP8";
    
    
    public void connCPE_WSI() {
        // Get the connection
        conn = Factory.Connection.getConnection(CE_URI_WSI);
        // Get the user context
        uc = UserContext.get();
        uc.pushSubject(UserContext.createSubject(conn, username, password, stanzaWSI));
        try {
            // Get the default domain
            Domain domain = Factory.Domain.getInstance(conn, null);
            // Get an object store
            ObjectStore os = Factory.ObjectStore.fetchInstance(domain, osName, null);
            System.out.println("Con OKAY WSI");
            System.out.println(os.get_DisplayName());
        } finally {
            // Pop the subject off the UserContext stack
            uc.popSubject();
        }
    }
    

    更多信息,这是一本很棒的书 FileNet P8 API

    【讨论】:

      猜你喜欢
      • 2020-04-06
      • 2017-09-14
      • 2015-11-03
      • 2019-05-06
      • 1970-01-01
      • 1970-01-01
      • 2017-10-21
      • 2015-07-31
      • 2015-04-18
      相关资源
      最近更新 更多