java call filenet ejb api
来源:互联网 发布:java.long.ill 编辑:程序博客网 时间:2024/06/06 05:14
filenet api有ejb和webservice
项目里使用的是filenet ejb api,自己写了一个test类for test filenet login and take the session,花了很长时间才成功,当中遇到了很多错误,记录一下。
filenet service deploy in websphere server, so the program demo is for websphere 6。
连接filenet的代码很简单,复杂的是它的环境设置,先记录它的环境设置
copy AppClient 去到本地
jar file:
com.ibm.ws.admin.client_6.1.0.jar,
com.ibm.ws.runtime_6.1.0.jar,
commons-codec.jar,
commons-collections.jar,
commons-logging-1.0.4.jar,
commons-logging.jar,
Jace.jar,
javaapi.jar,
log4j-1.2.14.jar,
ws_runtime.jar
config file:
jaas.conf.Websphere,
sas.client.props,
ssl.client.props,
log4j.xml,
copy all the file from:%{was_home}%\AppServer\profiles\AppSrv01\etc
(里面是trust文件和key文件,把它们拷贝到本地,如:C:\testetc)
修改
ssl.client.props
user.root=C:\testetc
sas.client.props
com.ibm.CORBA.securityServerHost=XXX.XX.XXX.XXX
com.ibm.CORBA.securityServerPort=2809(我滴BOOTSTRAP_ADDRESS port)
确定 jaas.conf.Websphere
FileNetP8Engine {
com.ibm.ws.security.common.auth.module.proxy.WSLoginModuleProxy required
delegate=com.ibm.ws.security.common.auth.module.WSLoginModuleImpl;
};
设置was
一切都准备好了
开始代码
建立一个JAVA工程,把以上的jar导到工程里,建一个类包,拷贝
jaas.conf.Websphere,
sas.client.props,
ssl.client.props,
log4j.xml进类包里
建立一个类:FileNetSession.java
建立一个方法:
public Session getSession(String userId, String password)
{
try {
System.setProperty("java.naming.factory.initial","com.ibm.websphere.naming.WsnInitialContextFactory");
System.setProperty("java.naming.provider.url","iiop://XXX.XXX.XXX.XXX:2809");
System.setProperty("com.ibm.CORBA.ConfigURL","file:ert/sas.client.props");
System.setProperty("java.security.auth.login.config","file:ert/jaas.conf.Websphere");
System.setProperty("com.ibm.SSL.ConfigURL","file:ert/ssl.client.props");
Session myCESession = ObjectFactory.getSession(appId,Session.DEFAULT, userId, password);
myCESession.verify();
return myCESession;
} catch (Exception e) {
e.printStackTrace();
returnnull;
}
}
建立一个search方法
public void testSearch(Session filnetSession)
{
//objectStoreName是我们在filenet里做的一个项目对象
//from XXXX 是在对象里做的不同的类,比如一个类叫XXXX,条件是这个类里我们生成的属性,比如有属性是submissionid,
//u can find all the column in filenet database docversion also.
String str = "ApplicationLicenceNumber = 'E201002844'";
String objectStoreName="XXXX";
StringBuffer sql = new StringBuffer("select ScannedDate from XXXX where " + str +
" and SubmissionID = 'XXXXX' and ContentSize is not null" +
" order by ScannedDate desc");
String xmlreq ="<request>" +
"<objectstores mergeoption=\"union\">" +
"<objectstore id=\"" + objectStoreName +"\"/>" +
"</objectstores>" +
"<querystatement>" + sql.toString() +"</querystatement>" +
"<options cursorlocation=\"client\"/>" +
"</request>";
Search search = ObjectFactory.getSearch(filnetSession);
Documents docs = (Documents)search.singleObjectTypeExecute(xmlreq,BaseObject.TYPE_DOCUMENT);
System.out.println(docs.size());
if(docs !=null && docs.size() > 0){
Document tmp = (Document)docs.get(0);
String id = tmp.getVersionSeries().getId();
System.out.println(id);
}
}
注意:
运行的环境必须是websphere自己的JAVA jre。可以在AppClient里找到。
ERROR api.BadReferenceException: [throw] com.filenet.api.exception.EngineRuntimeException;Requested item not found. Principal UNAUTHENTICATED not found. [Code=null]; OMFC/TheNetwork/NoOp//E_OBJECT_NOT_FOUND
com.filenet.wcm.api.BadReferenceException: com.filenet.api.exception.EngineRuntimeException;Requested item not found. Principal UNAUTHENTICATED not found. [Code=null]; OMFC/TheNetwork/NoOp//E_OBJECT_NOT_FOUND
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:67).....
一般这样的错误是环境配置没完成,缺少config file造成的,以上所提到的config file一定要在filenet server的server上拷贝下来,file要一致
- java call filenet ejb api
- java call filenet ejb api
- IBM FileNet Content Java API 简介
- IBM FileNet Content Java API 简介
- IBM FileNet Content Java API 简介
- FileNet-API培训
- 如何通过 JAVA Security API 来定性 IBM FileNet P8 内容查询和存储的安全
- FileNet
- FileNet
- Pro EJB 3: Java Persistence API (Pro)
- How to call API in Java
- 使用 EJB 3.0 Java Persistence API 设计企业应用程序
- 使用 EJB 3.0 Java Persistence API 设计企业应用程序
- 使用 EJB 3.0 Java Persistence API 设计企业应用程序
- 使用 EJB 3.0 Java Persistence API 设计企业应用程序
- 使用 EJB 3.0 Java Persistence API 设计企业应用程序
- 使用 EJB 3.0 Java Persistence API 设计企业应用程序
- 使用 EJB 3.0 Java Persistence API 设计企业应用程序
- 【JS事件】input文本内容改变可使用的事件
- static 用法
- 设置myeclipse容器的编码
- 决斗 dp, spoj196 Musketeers
- 视频解码器和render之间增加一个内容透传的filter,需要处理颜色空间的差异及显卡内存自动对齐问题
- java call filenet ejb api
- InfoPath中重复表的操作+repeat+table+operation
- Android开发指南-用户界面-创建菜单
- windows 2003上安装测试管理工具TestDirector 8.0,访问页面显示HTML代码的解决方法
- 奇偶校验算法
- MVP, MVC, MVVM, 傻傻分不清楚~
- Android开发指南-用户界面-菜单特性
- Android的Intent和IntentFilter应用说明一例
- DPInst.exe