Uploaded image for project: 'Application Server 7'
  1. Application Server 7
  2. AS7-1523

org.springframework.jndi.TypeMismatchNamingException when looking up a bean in JNDI tree if bean is deployed in another ear

XMLWordPrintable

      I have a 2 ear applications. One contains a EJB and the other contains a spring application that loads the EJB as a Spring bean like this

      <bean id="tinglysningService" class="org.springframework.jndi.JndiObjectFactoryBean"
      lazy-init="true">
      <property name="expectedType"
      value="com.csc.etl.kerne.serviceinterface.interfaces.TinglysningService" />
      <property name="jndiName"
      value="kerne.ejb.TinglysningServiceBean#com.csc.etl.kerne.serviceinterface.interfaces.TinglysningService">
      </property>
      <property name="lookupOnStartup">
      <value>false</value>
      </property>
      <property name="proxyInterface">
      <value>com.csc.etl.kerne.serviceinterface.interfaces.TinglysningService</value>
      </property>
      </bean>

      When looking up the bean like this

      org.springframework.context.ApplicationContext context;
      ....
      TinglysningService tinglysningService = (TinglysningService) context.getBean("tinglysningService");

      I get the following error

      09:42:17,635 ERROR [com.csc.etl.sagsportal.beans.forespoerg.tingbogen.DataLoader] (MSC service thread 1-3) JndiObjectTargetSource failed to obtain new target object; nested exception is org.springframework.jndi.TypeMismatchNamingException: Object of type [class com.csc.etl.kerne.serviceinterface.interfaces.TinglysningService$$$view17] available at JNDI location [java:global/kerne/kerne/TinglysningServiceBean] is not assignable to [com.csc.etl.kerne.serviceinterface.interfaces.TinglysningService]: org.springframework.jndi.JndiLookupFailureException: JndiObjectTargetSource failed to obtain new target object; nested exception is org.springframework.jndi.TypeMismatchNamingException: Object of type [class com.csc.etl.kerne.serviceinterface.interfaces.TinglysningService$$$view17] available at JNDI location [java:global/kerne/kerne/TinglysningServiceBean] is not assignable to [com.csc.etl.kerne.serviceinterface.interfaces.TinglysningService]
      at org.springframework.jndi.JndiObjectTargetSource.getTarget(JndiObjectTargetSource.java:138) [spring-2.5.6.SEC01.jar:]
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:184) [spring-2.5.6.SEC01.jar:]
      at $Proxy127.hentAlleEjerLav(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
      at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
      at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307) [spring-2.5.6.SEC01.jar:]
      at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182) [spring-2.5.6.SEC01.jar:]
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149) [spring-2.5.6.SEC01.jar:]
      at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:77) [spring-2.5.6.SEC01.jar:]
      at com.csc.etl.sagsportal.utils.logging.PerformanceLoggingAspect.log(PerformanceLoggingAspect.java:94) [classes:]
      at com.csc.etl.sagsportal.utils.logging.PerformanceLoggingAspect.doPerformanceLogging(PerformanceLoggingAspect.java:50) [classes:]
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [:1.6.0_26]
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [:1.6.0_26]
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [:1.6.0_26]
      at java.lang.reflect.Method.invoke(Method.java:597) [:1.6.0_26]
      at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethodWithGivenArgs(AbstractAspectJAdvice.java:627) [spring-2.5.6.SEC01.jar:]
      at org.springframework.aop.aspectj.AbstractAspectJAdvice.invokeAdviceMethod(AbstractAspectJAdvice.java:616) [spring-2.5.6.SEC01.jar:]
      at org.springframework.aop.aspectj.AspectJAroundAdvice.invoke(AspectJAroundAdvice.java:64) [spring-2.5.6.SEC01.jar:]
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) [spring-2.5.6.SEC01.jar:]
      at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89) [spring-2.5.6.SEC01.jar:]
      at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171) [spring-2.5.6.SEC01.jar:]
      at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204) [spring-2.5.6.SEC01.jar:]
      at $Proxy128.hentAlleEjerLav(Unknown Source) at com.csc.etl.sagsportal.beans.forespoerg.tingbogen.DataLoader.init(DataLoader.java:40) [classes:]
      at com.csc.etl.sagsportal.servlets.AjaxContentProviderServlet.init(AjaxContentProviderServlet.java:49) [classes:]
      at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1202) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1102) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
      at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3631) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:3844) [jbossweb-7.0.1.Final.jar:7.1.0.Alpha1-SNAPSHOT]
      at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentService.java:70) [jboss-as-web-7.1.0.Alpha1-SNAPSHOT.jar:7.1.0.Alpha1-SNAPSHOT]
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
      at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_26]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_26]
      at java.lang.Thread.run(Thread.java:662) [:1.6.0_26]
      Caused by: org.springframework.jndi.TypeMismatchNamingException: Object of type [class com.csc.etl.kerne.serviceinterface.interfaces.TinglysningService$$$view17] available at JNDI location [java:global/kerne/kerne/TinglysningServiceBean] is not assignable to [com.csc.etl.kerne.serviceinterface.interfaces.TinglysningService]
      at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:180) [spring-2.5.6.SEC01.jar:]
      at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:95) [spring-2.5.6.SEC01.jar:]
      at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105) [spring-2.5.6.SEC01.jar:]
      at org.springframework.jndi.JndiObjectTargetSource.getTarget(JndiObjectTargetSource.java:131) [spring-2.5.6.SEC01.jar:]
      ... 36 more

        1. Source.zip
          7 kB
        2. HelloWorldEJB2.jar.zip
          2 kB
        3. HelloWorld.ear.zip
          6 kB

              jgreene@redhat.com Jason Greene
              webmarck_jira Nicolai Ødum (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Created:
                Updated:
                Resolved: