在websphere 8.5.5中使用parent_last类加载器模式运行launchclient

时间:2017-10-29 01:43:02

标签: java client websphere classloader

我在Websphere应用程序server 8.5.5中使用启动客户端来启动一个独立的java程序。它正常工作,默认为classLoaderMode(PARENT_FIRST)。

但是,当我将其更改为PARENT_LAST并且无法初始化应用程序组件时。这是命令

>         File to launch          = C:\workspace\myapp.ear
>         CC Property File        = null
>         Client Jar File         = <default>
>         Alternate DD            = null
>         BootstrapHost           = localhost
>         BootstrapPort           = 2809
>         Trace enabled           = false
>         Tracefile               = null
>         Init only               = false
>         Classpath Parameter     = myjar.jar
>         Security Manager        = disable
>         Security Manager Class  = Not used. -CCsecurityManager=disable
>         Security Manager Policy = Not used. -CCsecurityManager=disable
>         Exit VM                 = true
>         Soap Connector Port     = null
>         Application Parameters  = --name abc
>         Provider URL            = null
>         Dump Java Name Space    = long
>         Admin Connector Host    = null
>         Admin Connector Port    = null
>         Admin Connector Type    = null
>         Admin Connector User    = null
>         PARENT_LAST mode        = true

这是例外:

  

WSCL0910I:初始化组件:   com.ibm.ejs.jms.JMSClientRegistration WSCL0911I:组件已初始化   成功。 [10/28/17 19:41:10:901 EDT] 00000001 W UOW =   源= com.ibm.websphere.naming.genericURLInitialContextFactory   螺纹= [P = 69444:O = 0:CT]             NMSV0907E:无法调用方法&#34; getObjectInstance&#34;对象类型&#34; com.ibm.ws.naming.urlns.genericURLContextFactory&#34;。   [10/28/17 19:41:11:145 EDT] 00000001 W UOW = null   source = com.ibm.ws.naming.util.CommonHelpers org = IBM prod = WebSphere   component = Application Server thread = [P = 69444:O = 0:CT]             NMSV0303E:该方案的NamingManager.getURLContext发生异常:&#34; services&#34;。 [10/28/17 19:41:11:169 EDT] 00000001 E.   UOW = null source = com.ibm.ws.activity.ActivityServiceClientComponentImpl   org = IBM prod = WebSphere组件= Application Server   螺纹= [P = 69444:O = 0:CT]             WACT0001E:该方法从类com.ibm.ws.activity.ActivityServiceClientComponentImpl开始收到   意外的异常;以下是异常堆栈跟踪:   javax.naming.ConfigurationException:无法调用方法   com.ibm.ws.naming.ur类型的对象上的getObjectInstance   lns.genericURLContextFactory。 [根本例外是   java.lang.reflect.InvocationTargetException]       在com.ibm.websphere.naming.genericURLInitialContextFactory.getAndInvokeMethod(genericURLInitialContextFactory.java:483)       在com.ibm.websphere.naming.genericURLContextFactory.getObjectInstance(genericURLContextFactory.java:162)       在javax.naming.spi.NamingManager.getURLContext(NamingManager.java:706)       在com.ibm.ws.naming.util.CommonHelpers.getContextIfUrlName(CommonHelpers.java:477)       在com.ibm.ws.naming.util.CommonHelpers.getContextIfUrlName(CommonHelpers.java:438)       在com.ibm.websphere.naming.JndiHelper.recursiveBind(JndiHelper.java:503)       在com.ibm.websphere.naming.JndiHelper.recursiveRebind(JndiHelper.java:391)       在com.ibm.ws.activity.ActivityServiceClientComponentImpl.start(ActivityServiceClientComponentImpl.java:106)       在com.ibm.ws.runtime.component.ContainerHelper.startComponents(ContainerHelper.java:540)       在com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:627)       在com.ibm.ws.client.applicationclient.ClientComponentInitImpl.start(ClientComponentInitImpl.java:77)       在com.ibm.ws.client.applicationclient.ClientContainer.startComponents(ClientContainer.java:1945)       在com.ibm.ws.client.applicationclient.ClientContainer.init(ClientContainer.java:326)       在com.ibm.ws.client.applicationclient.launchClient.createContainerAndLaunchApp(launchClient.java:749)       在com.ibm.ws.client.applicationclient.launchClient.main(launchClient.java:495)       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)       在java.lang.reflect.Method.invoke(Method.java:611)       在com.ibm.wsspi.bootstrap.WSLauncher.launchMain(WSLauncher.java:234)       在com.ibm.wsspi.bootstrap.WSLauncher.main(WSLauncher.java:96)       在com.ibm.wsspi.bootstrap.WSLauncher.run(WSLauncher.java:77)       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:60)       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37)       在java.lang.reflect.Method.invoke(Method.java:611)       在org.eclipse.equinox.internal.app.EclipseAppContainer.callMethodWithException(EclipseAppContainer.java:587)       在org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:198)       在org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)       在org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)       在org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)       在org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)   com.ibm.ws.exception.RuntimeError:   javax.naming.ConfigurationException:无法调用方法   类型对象的getObjectInstance   com.ibm.ws.naming.urlns.genericURLContextFactory。 [根本例外是   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)       在java.lang.reflect.Method.invoke(Method.java:611)       在org.eclipse.core.launcher.Main.invokeFramework(Main.java:340)       在org.eclipse.core.launcher.Main.basicRun(Main.java:282)       在org.eclipse.core.launcher.Main.run(Main.java:981)       在com.ibm.wsspi.bootstrap.WSPreLauncher.launchEclipse(WSPreLauncher.java:406)       在com.ibm.wsspi.bootstrap.WSPreLauncher.main(WSPreLauncher.java:169)       在com.ibm.websphere.client.applicationclient.launchClient.main(launchClient.java:246)   引起: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)       在java.lang.reflect.Method.invoke(Method.java:611)       在com.ibm.websphere.naming.genericURLInitialContextFactory.getAndInvokeMethod(genericURLInitialContextFactory.java:469)       ... 41更多引起:javax.naming.ConfigurationException:URL方案没有名称空间&#34; services&#34;。       在com.ibm.ws.naming.urlns.genericURLContextFactory.isNameSpaceAccessable(genericURLContextFactory.java:99)       at com.ibm.ws.naming.urlbase.UrlContextFactory.getObjectInstance(UrlContextFactory.java:85)       ......还有46个

使用PARENT_LAST类加载器模式导致IBM启动客户端加载和失败的原因是什么?我想知道它是否是一个Websphere应用程序Server 8.5.5。或者我只是错误地运行它。

提前致谢。

1 个答案:

答案 0 :(得分:0)

我可以自己解决这个问题。问题是我不小心在classpath中包含了websphere库。它导致websphere使用classpath来初始化我的客户端应用程序并且无法查找jndi。为了使用PARENT_LAST模式运行launchclient,我必须删除classpath中的websphere jar文件。该过程正确启动并初始化,没有任何问题。

如果有人遇到同样的问题,请发布我在这里的方法。