使用Spring Boot with Embedded Tomcat通过EJB传输连接到Websphere 8.5上运行的Filenet

时间:2016-09-01 12:22:34

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

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

  

NMSV0307E:使用了java:URL名称,但未将命名配置为   handle 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 appserver上运行的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

2 个答案:

答案 0 :(得分:0)

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

答案 1 :(得分:0)

您可以共享您的代码

但是这里一目了然

如果您将使用嵌入式tomcat,则必须使用WSI,而对于EJB,则不应使用嵌入式tomcat并将其作为WAR部署在Websphere或Jboss或WebLogic中,因为它们支持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();
    }
}

enter image description here

enter image description here

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