java.lang.reflect.InvocationTargetException

Apache's JIRA Issue Tracker | pawan bhole | 7 years ago
  1. 0

    i am creating locators only once and storing those in HashMap. And at every service call (by multiple threads parallely) I am just retriving locators from HashMap and using those for creating methode call. Code: public class WsClientRetriever { protected final Log log = LogFactory.getLog(getClass()); protected final HashMap<Class<? extends Service>,Object> servicesMapCache = new HashMap<Class<? extends Service>, Object>(); /** * The url for the services */ private String rootUrl; /** * This generic method will return the WebService class using the given web service locator class * @param serviceLocatorClass * @return * @throws ServiceRetrievalException if the service could not be retrieved in any ways */ public synchronized Object getWebService(Class<? extends Service> serviceLocatorClass) throws ServiceRetrievalException { Object locator = servicesMapCache.get(serviceLocatorClass); Object result = null; // it's not in our cache, we have to get it using reflexion try { if (locator == null) { locator = serviceLocatorClass.newInstance(); servicesMapCache.put(serviceLocatorClass, locator); } Method[] methods = serviceLocatorClass.getMethods(); // we look for the method that needs an URL as parameter and starts with get for (int i = 0; i < methods.length; i++) { Method method = methods[i]; if (method.getName().startsWith("get") && (method.getParameterTypes().length == 1) && (method.getParameterTypes()[0] == URL.class)){ // we found it, we need to call it result = method.invoke(locator, getWSURL(serviceLocatorClass)); } } } catch (Exception e) { throw new ServiceRetrievalException(serviceLocatorClass, e); } // now we are sure to have it return result; } /** * Creates the URL to access the web service * @param serviceLocatorClass service locator class name * @return URL of the service where deployed */ private URL getWSURL(Class<? extends Service> serviceLocatorClass) { String slClassName = serviceLocatorClass.getName(); String serviceClassName = slClassName.substring(slClassName.lastIndexOf('.') + 1, slClassName.lastIndexOf("ServiceLocator")); String serviceURLString = rootUrl + serviceClassName; URL serviceURL = null; try { serviceURL = new URL(serviceURLString); return serviceURL; } catch (MalformedURLException e) { log.debug("caught an exception", e); throw new WebServiceRetrievalException(serviceURLString, e); } } /** * @param rootUrl the rootUrl to set */ public void setRootUrl(String rootUrl) { this.rootUrl = rootUrl; if (this.rootUrl != null && !this.rootUrl.endsWith("/")) { this.rootUrl += "/"; } } } ********************************************************************************************************************************* stack trace : [8/13/09 16:55:21:077 IST] 00000026 ExceptionUtil E CNTR0020E: EJB threw an unexpected (non-declared) exception during invocation of method "onMessage" on bean "BeanId(ProPayEAR#ProPayEJB-1.2-ENGINE-SPR7-IT1-SNAPSHOT.jar#MessageProcessor, null)". Exception data: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at com.ibm.ejs.jms.listener.ServerSessionDispatcher.dispatch(ServerSessionDispatcher.java:37) at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:96) at com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:132) at com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:492) at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497) Caused by: java.lang.RuntimeException: com.te.jpay.exception.EnvironmentalException: Failure trying to get the Call object; nested exception is: java.util.ConcurrentModificationException: concurrent access to HashMap attempted by Thread[MessageListenerThreadPool : 0,5,main] at com.te.jpay.ejb.messagesreceiver.MessagesProcessorBean.onMessage(MessagesProcessorBean.java:62) at com.ibm.ejs.jms.listener.MDBWrapper$PriviledgedOnMessage.run(MDBWrapper.java:302) at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:63) at com.ibm.ejs.jms.listener.MDBWrapper.callOnMessage(MDBWrapper.java:271) at com.ibm.ejs.jms.listener.MDBWrapper.onMessage(MDBWrapper.java:240) at com.ibm.mq.jms.MQSession.run(MQSession.java:1691) at com.ibm.ejs.jms.JMSSessionHandle.run(JMSSessionHandle.java:975) at com.ibm.ejs.jms.listener.ServerSession.connectionConsumerOnMessage(ServerSession.java:957) at com.ibm.ejs.jms.listener.ServerSession.onMessage(ServerSession.java:667) at com.ibm.ejs.jms.listener.ServerSession.dispatch(ServerSession.java:634) ... 9 more Caused by: com.te.jpay.exception.EnvironmentalException: Failure trying to get the Call object; nested exception is: java.util.ConcurrentModificationException: concurrent access to HashMap attempted by Thread[MessageListenerThreadPool : 0,5,main] at com.te.jpay.backendintegration.tietoapps.jdir.CreditMechanismHelperWsImpl.getCreditMechanism(CreditMechanismHelperWsImpl.java:75) at com.te.jpay.backendintegration.tietoapps.jdir.CreditMechanismHelperWsImpl.assignCreditMechanism(CreditMechanismHelperWsImpl.java:101) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:77) at org.perf4j.aop.AbstractTimingAspect.doPerfLogging(AbstractTimingAspect.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:64) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:160) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy73.assignCreditMechanism(Unknown Source) at com.te.jpay.backendintegration.tietoapps.jdir.JDirectoryClientImpl.assignCreditMechanism(JDirectoryClientImpl.java:123) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:77) at org.perf4j.aop.AbstractTimingAspect.doPerfLogging(AbstractTimingAspect.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:64) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:160) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy76.assignCreditMechanism(Unknown Source) at com.te.jpay.processing.InwardDDCollectionReceiverImpl.performGroupLevelProcessing(InwardDDCollectionReceiverImpl.java:110) at com.te.jpay.processing.InwardDDCollectionReceiverImpl.doBusinessLogic(InwardDDCollectionReceiverImpl.java:64) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:77) at org.perf4j.aop.AbstractTimingAspect.doPerfLogging(AbstractTimingAspect.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:64) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:160) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy77.doBusinessLogic(Unknown Source) at com.te.jpay.dispatch.DefaultPaymentDispatcher.dispatchMessageFromBulker(DefaultPaymentDispatcher.java:108) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:77) at org.perf4j.aop.AbstractTimingAspect.doPerfLogging(AbstractTimingAspect.java:69) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627) at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616) at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:64) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:160) at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) at $Proxy78.dispatchMessageFromBulker(Unknown Source) at com.te.jpay.ejb.messagesreceiver.MessagesProcessorBean.onMessage(MessagesProcessorBean.java:49) ... 18 more Caused by: Failure trying to get the Call object; nested exception is: java.util.ConcurrentModificationException: concurrent access to HashMap attempted by Thread[MessageListenerThreadPool : 0,5,main] at com.te.prodirectory.ws.client.mechanism.MechanismWSSoapBindingStub.createCall(MechanismWSSoapBindingStub.java:384) at com.te.prodirectory.ws.client.mechanism.MechanismWSSoapBindingStub.getMechanismParameterByCodeword(MechanismWSSoapBindingStub.java:460) at com.te.jpay.backendintegration.tietoapps.jdir.CreditMechanismHelperWsImpl.getCreditMechanism(CreditMechanismHelperWsImpl.java:73) ... 108 more Caused by: java.util.ConcurrentModificationException: concurrent access to HashMap attempted by Thread[MessageListenerThreadPool : 0,5,main] at java.util.HashMap.onExit(HashMap.java:226) at java.util.HashMap.transfer(HashMap.java:690) at java.util.HashMap.resize(HashMap.java:676) at java.util.HashMap.addEntry(HashMap.java:1049) at java.util.HashMap.put(HashMap.java:561) at org.apache.axis.encoding.TypeMappingImpl.internalRegister(TypeMappingImpl.java:263) at org.apache.axis.encoding.TypeMappingImpl.register(TypeMappingImpl.java:221) at org.apache.axis.encoding.TypeMappingDelegate.register(TypeMappingDelegate.java:73) at org.apache.axis.client.Call.registerTypeMapping(Call.java:2285) at org.apache.axis.client.Call.registerTypeMapping(Call.java:2322) at com.te.prodirectory.ws.client.mechanism.MechanismWSSoapBindingStub.createCall(MechanismWSSoapBindingStub.java:369) ... 110 more

    Apache's JIRA Issue Tracker | 7 years ago | pawan bhole
    java.lang.reflect.InvocationTargetException
  2. 0

    MQSeries.net :: View topic - Receiving JMSException during invocation of MDB

    mqseries.net | 1 year ago
    java.lang.reflect.InvocationTargetException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    MQSeries.net :: View topic - Problem with MQ Export binding

    mqseries.net | 1 year ago
    java.lang.reflect.InvocationTargetException
  5. 0

    MDB listener stop automatically

    Google Groups | 9 years ago | sangeet...@nordstrom.com
    java.lang.reflect.InvocationTargetException

  1. bmacedo 8 times, last 2 weeks ago
  2. aldrinleal 1 times, last 1 month ago
  3. ajinkya_w 96 times, last 2 months ago
  4. davidvanlaatum 4 times, last 2 months ago
  5. Handemelindo 2 times, last 2 months ago
17 more registered users
78 unregistered visitors
Not finding the right solution?
Take a tour to get the most out of Samebug.

Tired of useless tips?

Automated exception search integrated into your IDE

Root Cause Analysis

  1. java.lang.reflect.InvocationTargetException

    No message provided

    at sun.reflect.NativeMethodAccessorImpl.invoke0()
  2. Java RT
    Method.invoke
    1. sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    2. sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
    3. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    4. java.lang.reflect.Method.invoke(Method.java:618)
    4 frames
  3. com.ibm.ejs
    ServerSession.run
    1. com.ibm.ejs.jms.listener.ServerSessionDispatcher.dispatch(ServerSessionDispatcher.java:37)
    2. com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:96)
    3. com.ibm.ejs.container.MDBWrapper.onMessage(MDBWrapper.java:132)
    4. com.ibm.ejs.jms.listener.ServerSession.run(ServerSession.java:492)
    4 frames
  4. com.ibm.ws
    ThreadPool$Worker.run
    1. com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1497)
    1 frame