当采用jotm事务的项目部署至weblogic时,报错信息如下:
java.lang.IllegalArgumentException:JNDI naming exception: javax.naming.NoInitialContextException: Cannot instantiate class: org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory [Root exception is java.lang.ClassNotFoundException: org.objectweb.carol.jndi.spi.MultiOrbInitialContextFactory]
at weblogic.management.logging.DomainLogHandler.getMBeanHome(DomainLogHa
ndler.java:183)
at weblogic.management.logging.DomainLogHandler.subscribeToServer(Domain
LogHandler.java:508) at .......//(后续错误略)
原因:ow_carol.jar包加载时没有找到其配置文件
解决方案:复制carol.properties、jndi.properties、jotm.properties等配置文件到项目src目录下
附carol.properties内容如下:
# rmi activation (iiop, irmi, jrmp)
carol.protocols=jrmp
# RMI IRMI URL
carol.irmi.url=rmi://localhost:1099
# RMI JRMP URL
carol.jrmp.url=rmi://localhost:1099
# RMI IIOP URL
carol.iiop.url=iiop://localhost:1196
######################################################################
# Advanced Configuration for JRMP
######################################################################
# If true, local call with jrmp are optimized. If you get "ClassCastException
# with 2 beans in different jars, you should set it at "false".
carol.jvm.rmi.local.call=false
# If true a local Naming context is used (to be used only with a collocated registry)
carol.jvm.rmi.local.registry=false
# 不使用CAROL的JNDI封装器
#让JOTM不使用CAROL JNDI wrapper,从而可以避免类装载错误的发生。
carol.start.jndi=false
#不启用命名服务器
carol.start.ns=false
# 命名工厂类
carol.jndi.java.naming.factory.url.pkgs=org.apache.naming
jndi.properties内容如下:
#LDAP JNDI配置
# Sample Application Resource File for use with AppList, GetEnv examples.
#java.naming.factory.object=com.sun.jndi.ldap.AttrsToCorba:com.wiz.from.Person
#java.naming.factory.state=com.sun.jndi.ldap.CorbaToAttrs:com.wiz.from.Person
#java.naming.factory.control=com.sun.jndi.ldap.ResponseControlFactory
#java.naming.factory.initial=com.sun.jndi.ldap.LdapCtxFactory
#java.naming.provider.url=ldap://localhost:389/o=jnditutorial
#com.sun.jndi.ldap.netscape.schemaBugs=true
#WEBLOGIC JNDI配置
#JNDI工厂
java.naming.factory.initial = weblogic.jndi.WLInitialContextFactory
#URL
java.naming.provider.url = t3://localhost:7001
#用户名
java.naming.security.principal = weblogic
#密码
java.naming.security.credentials = weblogic
jotm.properties内容如下:
# ------------------------------------------
# Jotm properties
#
# see: org.objectweb.howl for description of
# howl properties.
# ------------------------------------------
jotm.recovery.Enabled false
jotm.appserver.Enabled false
howl.log.ListConfiguation false
howl.log.BufferSize 4
howl.log.MinimumBuffers 16
howl.log.MaximumBuffers 16
howl.log.MaximumBlocksPerFile 200
howl.log.FileDirectory c:/logs
howl.log.FileName howl
howl.log.MaximumFiles 2
以上在jotm2.0.10/weblogic8.x/9.x均调试通过