繁体   English   中英

Lotus Notes中的Java代理连接到FileNet P8

[英]Java agent in Lotus notes to connect to FileNet P8

我正在尝试在Lotus Notes中开发一个应用程序以连接到filenetp8,并管理文档。 无论如何,我使用的是Filenet Java API,并确实通过一台Java应用程序从一台远程计算机进行连接。 当谈到莲花时,我卡住了,这是错误输出

log4j:WARN Caught Exception while in Loader.getResource. This may be       innocuous.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
    sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at     sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.apache.log4j.helpers.Loader.getTCL(Loader.java:154)
at org.apache.log4j.helpers.Loader.getResource(Loader.java:92)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:103)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at org.apache.log4j.Logger.getLogger(Logger.java:104)
at com.filenet.apiimpl.util.BaseLogger.getErrorLogger(BaseLogger.java:507)
at com.filenet.apiimpl.util.BaseLogger.info(BaseLogger.java:388)
at com.filenet.apiimpl.util.ConfigValueLookup.<clinit>(ConfigValueLookup.java:1268)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at com.filenet.apiimpl.util.BaseLogger.<clinit>(BaseLogger.java:46)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at com.filenet.api.util.UserContext.<clinit>(UserContext.java:88)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at JavaAgent.<init>(Unknown Source)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1547)
at lotus.domino.AgentInfo.newInstance(Unknown Source)
at lotus.domino.AgentLauncher.run(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
Caused by: java.security.AccessControlException: Access denied (java.lang.RuntimePermission getClassLoader)
at java.security.AccessController.throwACE(AccessController.java:100)
at java.security.AccessController.checkPermission(AccessController.java:174)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:544)
at     COM.ibm.JEmpower.applet.AppletSecurity.superDotCheckPermission(AppletSecurity.java:1449)
at COM.ibm.JEmpower.applet.AppletSecurity.checkRuntimePermission(AppletSecurity.java:1311)
at COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1611)
at     COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1464)
at java.lang.Thread.getContextClassLoader(Thread.java:458)
... 27 more
log4j:WARN Caught Exception while in Loader.getResource. This may be innocuous.
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at     sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)
at java.lang.reflect.Method.invoke(Method.java:611)
at org.apache.log4j.helpers.Loader.getTCL(Loader.java:154)
at org.apache.log4j.helpers.Loader.getResource(Loader.java:92)
at org.apache.log4j.LogManager.<clinit>(LogManager.java:105)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at org.apache.log4j.Logger.getLogger(Logger.java:104)
at com.filenet.apiimpl.util.BaseLogger.getErrorLogger(BaseLogger.java:507)
at com.filenet.apiimpl.util.BaseLogger.info(BaseLogger.java:388)
at com.filenet.apiimpl.util.ConfigValueLookup.<clinit>   (ConfigValueLookup.java:1268)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at com.filenet.apiimpl.util.BaseLogger.<clinit>(BaseLogger.java:46)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at com.filenet.api.util.UserContext.<clinit>(UserContext.java:88)
at java.lang.J9VMInternals.initializeImpl(Native Method)
at java.lang.J9VMInternals.initialize(J9VMInternals.java:200)
at JavaAgent.<init>(Unknown Source)
at java.lang.J9VMInternals.newInstanceImpl(Native Method)
at java.lang.Class.newInstance(Class.java:1547)
at lotus.domino.AgentInfo.newInstance(Unknown Source)
at lotus.domino.AgentLauncher.run(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
Caused by: java.security.AccessControlException: Access denied (java.lang.RuntimePermission getClassLoader)
at java.security.AccessController.throwACE(AccessController.java:100)
at java.security.AccessController.checkPermission(AccessController.java:174)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:544)
at    COM.ibm.JEmpower.applet.AppletSecurity.superDotCheckPermission(AppletSecurity.java:1449)
at COM.ibm.JEmpower.applet.AppletSecurity.checkRuntimePermission(AppletSecurity.java:1311)
at COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1611)
at COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1464)
at java.lang.Thread.getContextClassLoader(Thread.java:458)
... 27 more
log4j:WARN No appenders could be found for logger   (filenet_error.api.com.filenet.apiimpl.util.ConfigValueLookup).
log4j:WARN Please initialize the log4j system properly.
http://172.17.20.155:9080/wsi/FNCEWS40MTOM
FileNetP8WSI
gci_admin
Passw0rd

Invalid login credentials supplied - please try again
com.filenet.api.exception.EngineRuntimeException: FNRCE0040E:     E_NOT_AUTHENTICATED: The user is not authenticated. Message was: Access denied    (javax.security.auth.AuthPermission createLoginContext.FileNetP8WSI)
at       com.filenet.apiimpl.core.UserPasswordToken.getSubject(UserPasswordToken.java:127)
at com.filenet.api.util.UserContext.createSubject(UserContext.java:288)
at JavaAgent.establishConnection(Unknown Source)
at JavaAgent.NotesMain(Unknown Source)
at lotus.domino.AgentBase.runNotes(Unknown Source)
at lotus.domino.NotesThread.run(Unknown Source)
Caused by: java.security.AccessControlException: Access denied (javax.security.auth.AuthPermission createLoginContext.FileNetP8WSI)
at java.security.AccessController.throwACE(AccessController.java:100)
at java.security.AccessController.checkPermission(AccessController.java:174)
at java.lang.SecurityManager.checkPermission(SecurityManager.java:544)
at COM.ibm.JEmpower.applet.AppletSecurity.superDotCheckPermission(AppletSecurity.java:1449)
at COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1617)
at COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1464)
at javax.security.auth.login.LoginContext.init(LoginContext.java:247)
at javax.security.auth.login.LoginContext.<init>(LoginContext.java:426)
at com.filenet.apiimpl.core.UserPasswordToken$1.run(UserPasswordToken.java:147)
at java.security.AccessController.doPrivileged(AccessController.java:327)
at com.filenet.apiimpl.core.UserPasswordToken.getPrivilegedLoginContext(UserPasswordToken.java:152)
at com.filenet.apiimpl.core.UserPasswordToken.getSubject(UserPasswordToken.java:112)
... 5 more

这是我的代理代码

import java.util.Iterator;
import java.util.Vector;

import javax.security.auth.Subject;

import com.filenet.api.collection.ObjectStoreSet;
import com.filenet.api.core.Connection; 
import com.filenet.api.core.Domain;
import com.filenet.api.core.Factory;
import com.filenet.api.core.ObjectStore;
import com.filenet.api.exception.EngineRuntimeException;
import com.filenet.api.exception.ExceptionCode;
import com.filenet.api.util.UserContext;

import lotus.domino.*;

public class JavaAgent extends AgentBase {

public Connection con = null;
public UserContext uc = UserContext.get();
Domain dom = null;
String domainName = null;
ObjectStoreSet ost = null;
Vector<String> osnames = new Vector<String>();
boolean isConnected = false;

public void establishConnection(String userName, String password,
        String stanza, String uri) {
    System.out.println("entree");

    con = Factory.Connection.getConnection(uri);

    Subject sub = UserContext
            .createSubject(con, userName, password, stanza);
    System.out.println("sortie");

    uc.pushSubject(sub);
    dom = fetchDomain();
    domainName = dom.get_Name();
    ost = getOSSet();


}

/*
 * Returns Domain object.
 */
public Domain fetchDomain() {
    dom = Factory.Domain.fetchInstance(con, null, null);
    return dom;
}

/*
 * Returns ObjectStoreSet from Domain
 */
public ObjectStoreSet getOSSet() {
    ost = dom.get_ObjectStores();
    return ost;
}

/*
 * Returns vector containing ObjectStore names from object stores available
 * in ObjectStoreSet.
 */
public Vector<String> getOSNames() {
    if (osnames.isEmpty()) {
        Iterator<?> it = ost.iterator();
        while (it.hasNext()) {
            ObjectStore os = (ObjectStore) it.next();
            osnames.add(os.get_DisplayName());
        }
    }
    return osnames;
}

/*
 * Checks whether connection has established with the Content Engine or not.
 */
public boolean isConnected() {
    return isConnected;
}

/*
 * Returns ObjectStore object for supplied object store name.
 */
public ObjectStore fetchOS(String name) {
    ObjectStore os = Factory.ObjectStore.fetchInstance(dom, name, null);
    return os;
}

/*
 * Returns the domain name.
 */
public String getDomainName() {
    return domainName;
}

public void NotesMain() {

    try {
        Session session = getSession();
        AgentContext agentContext = session.getAgentContext();



        String uri = "http://172.17.20.155:9080/wsi/FNCEWS40MTOM";
        String stanza = "FileNetP8WSI";
        String user = "gci_admin";
        String password = "Passw0rd";

        System.out.println(uri);
        System.out.println(stanza);
        System.out.println(user);
        System.out.println(password);
        // (Your code goes here)

        try {

            establishConnection(user, password, stanza, uri);
            System.out.println(getDomainName());
            System.out.println(getOSNames());

        } catch (EngineRuntimeException e) {
            if (e.getExceptionCode() == ExceptionCode.E_NOT_AUTHENTICATED) {
                System.out
                        .println("Invalid login credentials supplied - please try again");
            } else if (e.getExceptionCode() == ExceptionCode.API_UNABLE_TO_USE_CONNECTION) {
                System.out
                        .println("Unable to connect to server.  Please check to see that URL is correct and server is running");
            } else {
                System.out.println(e.getMessage());
            }
            e.printStackTrace();
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
}

}

查看http://www-304.ibm.com/support/knowledgecenter/SSNW2F_5.2.0/com.ibm.p8.ce.dev.ce.doc/gs_concepts_setup_thick_client.htm

您需要查看CEWS传输协议一章。

  1. 检查JAAS配置文件
  2. 检查JVM JAAS参数。

或者,您可以尝试使用IIOP传输...,或者可以开发自己的JAAS登录模块,以从源代码中排除登录名/密码。

我知道这是一个老问题,但是我想因为我已经遇到过同样的问题很多次,所以我不得不在某个地方发布答案,所以就在这里。

ADD 
-Djava.security.auth.login.config=C:\..\..\FileNet\BPMClient\jaas.conf.WebSphere 

服务器的JVM参数

==================================================

通过管理控制台添加JVM ARG的步骤

- In the Administration Console select Servers 
- Expand Server Type and select WebSphere application servers 
- Click on the name of your server 
- Expand Java and Process Management and select Process Definition. 
- Under the Additional Properties section, click Java Virtual Machine. 
- Scroll down and locate the textbox for Generic JVM arguments.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM