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

解决一例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包。

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

 

 

分享到:
评论

相关推荐

    解决axis2-CodegenWizardPluginBUG- java.lang.reflect.InvocationTargetException

    标题中的“解决axis2-CodegenWizardPluginBUG- java.lang.reflect.InvocationTargetException”指的是在使用Apache Axis2的CodegenWizardPlugin工具时遇到的一个错误。这个工具是Axis2框架的一部分,用于自动生成...

    scrcpy投屏 AssertionError: java.lang.reflect.InvocationTargetExcep

    标题中的问题“scrcpy投屏 AssertionError: java.lang.reflect.InvocationTargetException”是用户在尝试使用Scrcpy时遇到的一个常见错误。这个错误通常意味着在执行某个方法时,Java运行时环境遇到了未预期的情况。...

    MyEclipse axis2 wsdl java.lang.reflect.invocationtargetexception

    MyEclipse axis2 wsdl java.lang.reflect.invocationtargetexception code gen 大家要注意一定要仔细,这个问题基本上缺少包引起的,而且一定要clean 如果需要axis2插件 以及这个plugins中的包在我的其他资源里面有

    axis2 InvocationTargetException

    标题 "axis2 InvocationTargetException" 描述的是一个与Apache Axis2框架相关的编程问题,该问题通常在执行服务调用时出现,提示"InvocationTargetException"。这可能是由于多种原因引起的,包括但不限于错误的服务...

    java.lang.reflect.Proxy 学习资料 讲解 例子 源码

    java.lang.reflect.Proxy 学习资料 讲解 例子 源码 java.lang.reflect.Proxy 学习资料 讲解 例子 源码 java.lang.reflect.Proxy 学习资料 讲解 例子 源码

    Java.lang.reflect 包下常用的类及方法简介

    在Java编程语言中,`java.lang.reflect`包是核心库的一部分,它提供了运行时访问类、接口、字段和方法的能力。这个包对于理解和操作对象的动态特性至关重要,尤其是在实现反射机制时。反射允许我们在程序运行期间...

    Java reflect 机制详解

    免费共享,很详细的介绍了反射机制的原理,适合追根究底的java学习者

    WebLogic错误 java.lang.AssertionError: Registered more than one

    在WebLogic Server 9.2至10.0版本中,用户可能会遇到一个特定的错误,即“java.lang.AssertionError: Registered more than one instance with the same objectName”。这个错误主要表现为服务器启动后,在Admin ...

    wsdl生成java客户端报错

    java.lang.reflect.invocationtargetexception问题的解决方法之一

    反编译软件.NET Reflector 8.0.1.308主程序+注册机+破解说明

    反编译软件.NET Reflector 8.0.1.308主程序+注册机+破解说明 1.下载安装原程序,然后运行 Reflector.exe 2.运行注册机,点击 Generate 获得序列号 3.把序列号填写到 Reflector 软件上 4.断开网络,点击 Activate ...

    wsdl生成java客户端报错问题解决方法

    解决使用wsdl生成java客户端报错:java.lang.reflect.invocationtargetexception的方法之一

    webservice启动没有问题,通过自动生成的客户端报错

    faultString: java.lang.reflect.InvocationTargetException faultActor: faultNode: faultDetail: {http://xml.apache.org/axis/}stackTrace: AxisFault faultCode: {...

    commons-lang3-3.1jar:org.apache.commons.lang3.StringUtils等.

    Apache Commons Lang 是一个Java工具包,它提供了对Java核心库的补充,特别是在字符串处理、反射、日期和时间操作等方面。`commons-lang3-3.1.jar`是这个库的一个版本,其中包含了多个实用类和方法,有助于简化和...

    uiautomatorviewer更新文件.rar

    解决uiautomatorviewer报错问题,分享给大家。 Unexpected error while obtaining UI hierarchy # 点击Details java.lang.reflect.InvocationTargetException

    BEWINDOWEB#bewindoweb.github.io#00078-编写basedao的时候报错:java.lang.C

    编写basedao的时候报错:java.lang.Class cannot be cast to java.lang.reflect.Parameterized

    jaxen.jar和dom4j.jar

    at java.lang.reflect.Method.invoke(Unknown Source) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44) at org.junit.internal.runners.model.ReflectiveCallable.run...

    ireport测试

    在IT行业中,报表生成是企业应用中不可或缺的一部分,而`iReport`则是一款强大的报表设计工具,它与MyEclipse、Struts2等框架结合,能够帮助开发者轻松创建复杂的业务报表。本文将深入探讨`iReport`在Java开发中的...

    JAVA的WebService支持

    Java的Web服务支持是Java平台在企业级应用开发中的一项重要功能,它允许不同系统间的应用程序通过网络交换数据,实现跨平台的互操作性。Web服务基于开放的标准,如XML(可扩展标记语言)、WSDL(Web服务描述语言)和...

Global site tag (gtag.js) - Google Analytics