`
oboaix
  • 浏览: 275253 次
社区版块
存档分类
最新评论

解决一例Was8.0异常java.lang.reflect.InvocationTargetException

    博客分类:
  • JAVA
 
阅读更多

                                                 java.lang.reflect.InvocationTargetException

    最近项目用到WAS8.0,碰到一技术问题,花费了我不短的时间去解决,这里记录下,具体思路问题,应用环境如下:

本地开发环境:

WinXp sp2\Eclipse3.5\Jetty\Jboss5\Maven2.2

开发语言及相关中间件:

Java EE 6\Seam2.2\JSF1.2\EJB3.0\DB2

服务器环境

AIX6.1\WAS8.0\JDK6\DB29.7

由于服务器是分前端、后端;

异常现象:描述本地测试,始终没有问题,而移到正式环境下面测试始终没有通过,

异常代码如下:

 

 

javax.ejb.EJBException: The hk.com.mtr.trs.service.report.impl.TrainMaintenanceReportServiceImpl EJB reference 
in the hk.com.mtr.trs.facade.report.TrainMaintenanceReportFacade component 
in the trsEJB.jar module of the TRS application could not be resolved; nested exception is: java.lang.reflect.InvocationTargetException
Caused by: java.lang.reflect.InvocationTargetException
	at com.ibm.ejs.container.EJSContainer.startBean(EJSContainer.java:1797)
	at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime.startBean(AbstractEJBRuntime.java:2580)
	at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime.initializeDeferredEJBImpl(AbstractEJBRuntime.java:2447)
	at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime.access$300(AbstractEJBRuntime.java:209)
	at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime$1$1.run(AbstractEJBRuntime.java:2333)
	at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime$1$1.run(AbstractEJBRuntime.java:2327)
	at com.ibm.ws.security.auth.ContextManagerImpl.runAs(ContextManagerImpl.java:5367)
	at com.ibm.ws.security.auth.ContextManagerImpl.runAsSystem(ContextManagerImpl.java:5493)
	at com.ibm.ws.security.core.SecurityContext.runAsSystem(SecurityContext.java:255)
	at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime$1.run(AbstractEJBRuntime.java:2326)
	at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime$1.run(AbstractEJBRuntime.java:2300)
	at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63)
	at com.ibm.ws.ejbcontainer.runtime.AbstractEJBRuntime.initializeDeferredEJB(AbstractEJBRuntime.java:2299)
	at com.ibm.ejs.container.HomeRecord.getHomeAndInitialize(HomeRecord.java:404)
	at com.ibm.ejs.container.HomeOfHomes.getHome(HomeOfHomes.java:410)
	at com.ibm.ejs.container.HomeOfHomes.getHomeByInterface(HomeOfHomes.java:906)
	at com.ibm.ws.ejbcontainer.injection.factory.EJBLinkObjectFactory.getObjectInstance(EJBLinkObjectFactory.java:261)
	at com.ibm.ws.ejbcontainer.injection.factory.EJBLinkObjectFactory.getObjectInstance(EJBLinkObjectFactory.java:167)
	at com.ibm.ws.injectionengine.processor.EJBInjectionBinding.getInjectionObject(EJBInjectionBinding.java:1181)
	at com.ibm.wsspi.injectionengine.InjectionBinding.getInjectableObject(InjectionBinding.java:1002)
	at com.ibm.wsspi.injectionengine.InjectionTarget.inject(InjectionTarget.java:198)
	at com.ibm.ws.injectionengine.AbstractInjectionEngine.inject(AbstractInjectionEngine.java:924)
	at com.ibm.ejs.container.StatelessBeanO.initialize(StatelessBeanO.java:293)
	at com.ibm.ejs.container.BeanOFactory.create(BeanOFactory.java:147)
	at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:1229)
	at com.ibm.ejs.container.EJSHome.createBeanO(EJSHome.java:1347)
	at com.ibm.ejs.container.activator.UncachedActivationStrategy.atActivate(UncachedActivationStrategy.java:88)
	at com.ibm.ejs.container.activator.Activator.preInvokeActivateBean(Activator.java:614)
	at com.ibm.ejs.container.EJSContainer.preInvokeActivate(EJSContainer.java:4002)
	at com.ibm.ejs.container.EJSContainer.EjbPreInvoke(EJSContainer.java:3368)
	at hk.com.mtr.trs.facade.report.EJSRemote0SLhk_com_mtr_trs_facade_report_Tra_68f18871.onlineGenerateReport(EJSRemote0SLhk_com_mtr_trs_facade_report_Tra_68f18871.java)
	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 com.ibm.rmi.util.ProxyUtil$4.run(ProxyUtil.java:609)
	at java.security.AccessController.doPrivileged(AccessController.java:254)
	at com.ibm.rmi.util.ProxyUtil.invokeWithClassLoaders(ProxyUtil.java:606)
	at com.ibm.CORBA.iiop.ClientDelegate.invoke(ClientDelegate.java:1177)
	at $Proxy106.onlineGenerateReport(Unknown Source)
	at hk.com.mtr.trs.facade.report._TrainMaintenanceReportFacade_Stub.onlineGenerateReport(_TrainMaintenanceReportFacade_Stub.java)
	at hk.com.mtr.trs.web.report.BaseReportRequestController.onlineGenReport(BaseReportRequestController.java:314)
	at hk.com.mtr.trs.web.report.TrainMaintenanceReportController.toGenReport(TrainMaintenanceReportController.java:127)
	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.jboss.seam.util.Reflections.invoke(Reflections.java:22)
	at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:32)
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
	at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
	at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:77)
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
	at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
	at org.jboss.seam.core.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:32)
	at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
	at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
	at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
	at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
	at hk.com.mtr.trs.web.report.TrainMaintenanceReportController_$$_javassist_seam_7.toGenReport(TrainMaintenanceReportController_$$_javassist_seam_7.java)
	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.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
	at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
	at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
	at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
	at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
	at org.jboss.seam.el.OptionalParameterMethodExpression.invoke(OptionalParameterMethodExpression.java:39)
	at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
	at javax.faces.event.MethodExpressionActionListener.processAction(MethodExpressionActionListener.java:99)
	at javax.faces.event.ActionEvent.processListener(ActionEvent.java:88)
	at javax.faces.component.UIComponentBase.broadcast(UIComponentBase.java:770)
	at javax.faces.component.UICommand.broadcast(UICommand.java:372)
	at org.ajax4jsf.component.AjaxActionComponent.broadcast(AjaxActionComponent.java:55)
	at hk.com.mtr.trs.web.jsf.TrsViewRoot.processEvents(Unknown Source)
	at org.ajax4jsf.component.AjaxViewRoot.broadcastEventsForPhase(AjaxViewRoot.java:304)
	at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:261)
	at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:474)
	at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:82)
	at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:100)
	at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
	at javax.faces.webapp.FacesServlet.service(FacesServlet.java:265)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1147)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:722)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:449)
	at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:125)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:92)
	at hk.com.mtr.trs.jaas.sso.TrsNtlmHttpFilter.doFilter(Unknown Source)
	at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
	at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at hk.com.mtr.trs.web.jsf.TrsFilter.doFilter(Unknown Source)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at org.jboss.seam.web.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:42)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:206)
	at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
	at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
	at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
	at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at org.jboss.seam.web.HotDeployFilter.doFilter(HotDeployFilter.java:53)
	at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
	at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
	at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:192)
	at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:89)
	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:919)
	at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1016)
	at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
	at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:883)
	at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1659)
	at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:195)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:452)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:511)
	at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:305)
	at com.ibm.ws.http.channel.inbound.impl.HttpICLReadCallback.complete(HttpICLReadCallback.java:83)
	at com.ibm.ws.ssl.channel.impl.SSLReadServiceContext$SSLReadCompletedCallback.complete(SSLReadServiceContext.java:1784)
	at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:165)
	at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
	at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
	at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
	at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
	at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
	at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
	at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1648)
Caused by: java.lang.NoClassDefFoundError: org.apache.activemq.util.ByteArrayInputStream
	at java.lang.J9VMInternals.verifyImpl(Native Method)
	at java.lang.J9VMInternals.verify(J9VMInternals.java:77)
	at java.lang.J9VMInternals.initialize(J9VMInternals.java:139)
	at java.lang.J9VMInternals.newInstanceImpl(Native Method)
	at java.lang.Class.newInstance(Class.java:1345)
	at com.ibm.ejs.container.EJSContainer.startBean(EJSContainer.java:1793)
	... 139 more
Caused by: java.lang.ClassNotFoundException: org.apache.activemq.util.ByteArrayInputStream
	at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
	at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:198)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:646)
	at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:113)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:612)
	at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:62)
	at com.ibm.ws.classloader.ProtectionClassLoader.loadClass(ProtectionClassLoader.java:58)
	at com.ibm.ws.classloader.CompoundClassLoader.loadClass(CompoundClassLoader.java:564)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:612)
	... 145 more

 加上又在具体开发的同事误导下,说始终没有改过什么东西,也是按照推测去理解InvocationTargetException异常现象,始终没有找到问题症结点,同时也在对比版本控制文件,也没有发现最近的文档有什么大的差异。一直落入陷阱.....

解决方案:

ClassNotFoundException,从这里入手,WAS服务器不存在这种jar包,而本地又有,后来注意到我们本地是

同JVM,是一个Maven环境,里面的提供了大量的jar包,并且有伺服支持,有大量jar支持,开发人员不小心,提供另一个apache的开源jar包,干扰到了ByteArrayInputStream 的引入,从而出现本地测试始终通过,移到服务器上面而出现异常,找不到jar包,或者是因为提供的jar包同WAS本身自带的jar有冲突。
至此问题解决,还是轻易相信了开发人员的着入点,误入思维方向,版本控制存在多次提交问题,不仅仅以最近的一两次作为比较对象,应该直接从引发异常的地方发散思维。

开发人员应该注意的是,引入的jar下面的类需要绝对的认可,不可任意增加自己认为正确的jar包。

这里权当工作记录,以资共勉,吃一堑长一智.......

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics