我创建了一个简单的CMP,是基于数据库中的一个表的。
创建过程和部署过程都很正常,但我在向应用服务器(WebSphere)发布时却出现以下报错:
[06-4-27 11:59:52:531 CST] 3e725b31 Helpers W NMSV0605W: 使用名称“
comp/PM/WebSphereCMPConnectionFactory”从上下文“java:”中查找的引用对象发送到
JNDI 命名管理器并且导致异常。引用数据如下:
引用工厂类名:com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory
引用工厂类位置 URL:<null>
Reference Class Name: java.lang.Object
Type: JndiLookupInfo
Content: JndiLookupInfo: jndiName="jdbc/Default"; providerURL="";
initialContextFactory=""
异常数据如下:
javax.naming.NameNotFoundException: Context:
localhost/nodes/localhost/servers/server1, name: jdbc/Default: First
component in name Default not found. Root exception is
org.omg.CosNaming.NamingContextPackage.NotFound:
IDL:omg.org/CosNaming/NamingContext/NotFound:1.0
at
com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(Ws
nOptimizedNamingImpl.java:968)
at
com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info
(WsnOptimizedNamingImplBase.java:1399)
at
com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(Unknow
n Source)
at
com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:3491
)
at
com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1519)
at
com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1480)
at
com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1187)
at
com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory$1.run(IndirectJndiL
ookupObjectFactory.java:372)
at
com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.ja
va:111)
at
com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory.getObjectInstanceEx
t(IndirectJndiLookupObjectFactory.java:221)
at
com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers
.java:868)
at
com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(Url
ContextHelper.java:152)
at
com.ibm.ws.naming.java.javaURLContextRoot.processBoundObjectForLookup(java
URLContextRoot.java:398)
at
com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1278)
at
com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:1
96)
at
com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:1
37)
at javax.naming.InitialContext.lookup(InitialContext.java:360)
at
com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanClassExtensionImpl.lo
okup(Unknown Source)
at
com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanClassExtensionImpl.ge
tConnectionFactory(Unknown Source)
at
com.ibm.ws.ejbpersistence.beanextensions.PMModuleCookieImpl.beanInstall(Un
known Source)
at
com.ibm.ws.ejbpersistence.beanextensions.PersistenceManagerImpl.beanInstal
l(Unknown Source)
at
com.ibm.ejs.container.EJSContainer.loadBeanMetaData(EJSContainer.java:1367
)
at
com.ibm.ejs.container.EJSContainer.getHomeWrapperCommon(EJSContainer.java:
1012)
at
com.ibm.ejs.container.EJSContainer.getHomeInstance(EJSContainer.java:934)
at
com.ibm.ejs.container.EJSContainer.startBean(EJSContainer.java:913)
at
com.ibm.ws.runtime.component.EJBContainerImpl.startBean(EJBContainerImpl.j
ava:1301)
at
com.ibm.ws.runtime.component.EJBContainerImpl.install(EJBContainerImpl.jav
a:1034)
at
com.ibm.ws.runtime.component.EJBContainerImpl.start(EJBContainerImpl.java:
1508)
at
com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.j
ava:505)
at
com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectSta
rt(DeployedApplicationImpl.java:808)
at
com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.j
ava:354)
at
com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplica
tionImpl.java:578)
at
com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(Applicati
onMgrImpl.java:299)
at
com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.j
ava:256)
at
com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.j
ava:536)
at
com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
at
com.ibm.ws.runtime.component.ApplicationServerImpl.start(ApplicationServer
Impl.java:128)
at
com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.j
ava:536)
at
com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
at
com.ibm.ws.runtime.component.ServerImpl.start(ServerImpl.java:183)
at com.ibm.ws.runtime.WsServer.start(WsServer.java:128)
at com.ibm.ws.runtime.WsServer.main(WsServer.java:225)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:
79)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorIm
pl.java:41)
at java.lang.reflect.Method.invoke(Method.java:386)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:105)
at
com.ibm.etools.websphere.tools.runner.api.ServerRunnerV5$1.run(ServerRunne
rV5.java:97)
从报错信息中看出好像是CMP的连接初始化工厂配置有问题。由于我刚上手使用Eclipse +
WebSphere(以前使用的是Jbuilder + Weblogic),但我有一个疑问:
在部署成功后发布时怎么会出现初始化工厂的问题呢?我还没有调用这个CMP啊?只是发布到
WebSphere而已(相当于发布到Weblogic应用服务器),为什么会初始化环境工厂呢?以我的
经验只有在发布成功后,客户端调用CMP时才会涉及到这个问题吧!
我实在弄不明白。难道这两个应用服务期在这一点上有区别?
另外,如果发布时进行初始化环境工厂,那我创建的SessionBean为什么就没有这个问题,部署
发布都很正常,不知道为什么?
问题困扰我很久了。期望解决方案!