Announcement Announcement Module
Collapse
No announcement yet.
how to register EJB into OC4J JNDI tree on app server start Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • how to register EJB into OC4J JNDI tree on app server start

    Hi,

    I am having trouble deploying a Spring app into OC4J 904. I have an EAR with a war and an ejb component bundled together.

    Problem is I cannot register my business interface classes in the web app with an EJB via JNDI on startup. Here is my Spring config in the web app:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans>
    <!--
    // Provides an interface to the Business tier via EJB.
    -->
    <bean id="applicationManager" class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="proxyInterfaces" value="com.screening.ApplicationManager"/>
    <property name="interceptorNames">
    <list>
    <value>applicationManagerInterceptor</value>
    </list>
    </property>
    </bean>
    <bean id="applicationManagerInterceptor" class="com.screening.ApplicationManagerInterceptor ">
    <property name="methodInvoker" ref="applicationManagerEJB"/>
    </bean>
    <bean id="applicationManagerEJB" class="org.springframework.ejb.access.SimpleRemote StatelessSessionProxyFactoryBean">
    <property name="jndiName" value="screening/ejb/applicationManager"/>
    <property name="businessInterface" value="com.common.ejb.MethodInvoker"/>
    </bean>
    </beans>


    However when I access the index.jsp I get this stack trace:

    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'applicationManagerInterceptor' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Can't resolve reference to bean 'applicationManagerEJB' while setting property 'methodInvoker'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'applicationManagerEJB' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is javax.naming.NamingException: Error creating home instance: class java.lang.InstantiationException (Value not set)
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'applicationManagerEJB' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is javax.naming.NamingException: Error creating home instance: class java.lang.InstantiationException (Value not set)
    javax.naming.NamingException: Error creating home instance: class java.lang.InstantiationException (Value not set)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ejb.DelayedHomeBinding.getInstance(Delayed HomeBinding.java:97)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIBinding.getValue(RMIBinding.java:33 )
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIContext.getBinding(RMIContext.java: 934)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIContext.lookupLocalObject(RMIContex t.java:701)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIContext.lookup(RMIContext.java:89)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ApplicationContext.lookup(ApplicationConte xt.java:248)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ApplicationContext.lookup(ApplicationConte xt.java:119)
    at javax.naming.InitialContext.lookup(InitialContext. java:345)
    at org.springframework.jndi.JndiTemplate$1.doInContex t(JndiTemplate.java:123)
    at org.springframework.jndi.JndiTemplate.execute(Jndi Template.java:85)
    at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:121)
    at org.springframework.jndi.JndiLocatorSupport.lookup (JndiLocatorSupport.java:71)
    at org.springframework.jndi.JndiObjectLocator.lookup( JndiObjectLocator.java:106)
    at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.refreshHome(AbstractSlsbInvokerInterce ptor.java:102)
    at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.afterPropertiesSet(AbstractSlsbInvoker Interceptor.java:90)
    at org.springframework.ejb.access.LocalStatelessSessi onProxyFactoryBean.afterPropertiesSet(LocalStatele ssSessionProxyFactoryBean.java:83)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1003)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:348)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:176)
    at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:105)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:957)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:768)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:330)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
    at org.springframework.aop.framework.ProxyFactoryBean .createAdvisorChain(ProxyFactoryBean.java:340)
    at org.springframework.aop.framework.ProxyFactoryBean .setBeanFactory(ProxyFactoryBean.java:216)
    at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:343)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
    at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
    at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:269)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
    at org.springframework.web.context.support.AbstractRe freshableWebApplicationContext.refresh(AbstractRef reshableWebApplicationContext.java:134)
    at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:230)
    at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:156)
    at org.springframework.web.context.ContextLoaderServl et.init(ContextLoaderServlet.java:81)
    at javax.servlet.GenericServlet.init(GenericServlet.j ava:258)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.loadServlet(HttpAppli cation.java:2094)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.findServlet(HttpAppli cation.java:4523)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.initPreloadServlets(H ttpApplication.java:4617)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.initDynamic(HttpAppli cation.java:765)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.<init>(HttpApplicatio n.java:497)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.Application.getHttpApplication(Application .java:886)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpServer.getHttpApplication(HttpSer ver.java:688)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpSite.getApplication(HttpSite.java :420)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(Htt pRequestHandler.java:422)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHan dler.java:270)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHan dler.java:112)
    at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.ru n(ReleasableResourcePooledExecutor.java:186)
    at java.lang.Thread.run(Thread.java:479)


    Now I am very suspicious that OC4J does not bind EJB to JNDI on server start up (the server starts far too fast!) and hence my web app cannot find the EJB in the JNDI tree. So my question is how can I force OC4J to bind an EJB to JNDI on start up. Or is there a way I can tell the web app to wait until the EJB is deployed via Spring?

    Thanks in advance!
    J

  • #2
    Did you try to set the "lookupHomeOnStartup" property of your SimpleRemoteStatelessSessionProxyFactoryBean to false? This way initialization will happen on access only. Maybe it helps.

    Regards,
    Andreas

    Comment


    • #3
      Hi Andreas. Yes I've tried that. I think it might have fixed that issue but we still have an issue related to the fact that the beanfactory on the web tier is trying to initialise before the EJB has been bound to the target JNDI.

      Now when I read the javadoc in Spring's SimpleRemoteStatelessSessionProxyFactoryBean class it says:

      "In a bean container, this class is normally best used as a singleton. However, if that bean container pre-instantiates singletons (as do the XML ApplicationContext variants) you may have a problem if the bean container is loaded before the EJB container loads the target EJB. That is because by default the JNDI lookup will be performed in the init method of this class and cached, but the EJB will not have been bound at the target location yet. The best solution is to set the lookupHomeOnStartup property to false, in which case the home will be fetched on first access to the EJB."

      So I see where you are coming from with your previous post. However this issue persists!

      Here is the most recent stack trace:

      org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'applicationManagerInterceptor' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Can't resolve reference to bean 'applicationManagerEJB' while setting property 'methodInvoker'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'applicationManagerEJB' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is javax.naming.NamingException: Error creating home instance: class java.lang.InstantiationException (Value not set)
      org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'applicationManagerEJB' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is javax.naming.NamingException: Error creating home instance: class java.lang.InstantiationException (Value not set)
      javax.naming.NamingException: Error creating home instance: class java.lang.InstantiationException (Value not set)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ejb.DelayedHomeBinding.getInstance(Delayed HomeBinding.java:97)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIBinding.getValue(RMIBinding.java:33 )
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIContext.getBinding(RMIContext.java: 934)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIContext.lookupLocalObject(RMIContex t.java:701)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIContext.lookup(RMIContext.java:89)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ApplicationContext.lookup(ApplicationConte xt.java:248)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ApplicationContext.lookup(ApplicationConte xt.java:119)
      at javax.naming.InitialContext.lookup(InitialContext. java:345)
      at org.springframework.jndi.JndiTemplate$1.doInContex t(JndiTemplate.java:123)
      at org.springframework.jndi.JndiTemplate.execute(Jndi Template.java:85)
      at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:121)
      at org.springframework.jndi.JndiLocatorSupport.lookup (JndiLocatorSupport.java:71)
      at org.springframework.jndi.JndiObjectLocator.lookup( JndiObjectLocator.java:106)
      at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.lookup(AbstractRemoteSlsbInvoker Interceptor.java:93)
      at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.refreshHome(AbstractSlsbInvokerInterce ptor.java:102)
      at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.afterPropertiesSet(AbstractSlsbInvoker Interceptor.java:90)
      at org.springframework.ejb.access.SimpleRemoteStatele ssSessionProxyFactoryBean.afterPropertiesSet(Simpl eRemoteStatelessSessionProxyFactoryBean.java:95)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1003)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:348)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
      at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:176)
      at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:105)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:957)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:768)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:330)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
      at org.springframework.aop.framework.ProxyFactoryBean .createAdvisorChain(ProxyFactoryBean.java:340)
      at org.springframework.aop.framework.ProxyFactoryBean .setBeanFactory(ProxyFactoryBean.java:216)
      at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:343)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
      at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
      at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:269)
      at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
      at org.springframework.web.context.support.AbstractRe freshableWebApplicationContext.refresh(AbstractRef reshableWebApplicationContext.java:134)
      at org.springframework.web.context.ContextLoader.crea teWebApplicationContext(ContextLoader.java:230)
      at org.springframework.web.context.ContextLoader.init WebApplicationContext(ContextLoader.java:156)
      at org.springframework.web.context.ContextLoaderServl et.init(ContextLoaderServlet.java:81)
      at javax.servlet.GenericServlet.init(GenericServlet.j ava:258)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.loadServlet(HttpAppli cation.java:2094)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.findServlet(HttpAppli cation.java:4523)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.initPreloadServlets(H ttpApplication.java:4617)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.initDynamic(HttpAppli cation.java:765)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.<init>(HttpApplicatio n.java:497)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.Application.getHttpApplication(Application .java:886)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpServer.getHttpApplication(HttpSer ver.java:688)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpSite.getApplication(HttpSite.java :420)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(Htt pRequestHandler.java:422)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHan dler.java:270)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHan dler.java:112)
      at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.ru n(ReleasableResourcePooledExecutor.java:186)
      at java.lang.Thread.run(Thread.java:479)


      Even if I could tell OC4J to deploy the EJB on server startup that would help. The thing is OC4J starts in approx 3 seconds (so it's obviously not doing stuff like binding beans to the JNDI tree - e.g. WebLogic takes minutes). I've deployed the little web app at http://developers.sun.com/sw/buildin...ditree_ug.html to display the JNDI tree to display what Oc4J has deployed but java:comp jas nothing bound to it.

      Any other ideas anyone?

      Thanks!
      J

      Comment


      • #4
        Apologies, the latest stack trace is:

        500 Internal Server Error
        org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'documentLogController' defined in ServletContext resource [/WEB-INF/controller-servlet.xml]: Can't resolve reference to bean 'cachedData' while setting property 'cachedData'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'cachedData' defined in ServletContext resource [/WEB-INF/controller-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.remoting.RemoteLookupFailureEx ception: Failed to locate remote EJB [screening/ejb/applicationManager]; nested exception is javax.naming.NamingException: Error creating home instance: class java.lang.InstantiationException (Value not set)
        org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'cachedData' defined in ServletContext resource [/WEB-INF/controller-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.remoting.RemoteLookupFailureEx ception: Failed to locate remote EJB [screening/ejb/applicationManager]; nested exception is javax.naming.NamingException: Error creating home instance: class java.lang.InstantiationException (Value not set)
        org.springframework.remoting.RemoteLookupFailureEx ception: Failed to locate remote EJB [screening/ejb/applicationManager]; nested exception is javax.naming.NamingException: Error creating home instance: class java.lang.InstantiationException (Value not set)
        javax.naming.NamingException: Error creating home instance: class java.lang.InstantiationException (Value not set)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ejb.DelayedHomeBinding.getInstance(Delayed HomeBinding.java:97)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIBinding.getValue(RMIBinding.java:33 )
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIContext.getBinding(RMIContext.java: 934)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIContext.lookupLocalObject(RMIContex t.java:701)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIContext.lookup(RMIContext.java:89)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ApplicationContext.lookup(ApplicationConte xt.java:248)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.ApplicationContext.lookup(ApplicationConte xt.java:119)
        at javax.naming.InitialContext.lookup(InitialContext. java:345)
        at org.springframework.jndi.JndiTemplate$1.doInContex t(JndiTemplate.java:123)
        at org.springframework.jndi.JndiTemplate.execute(Jndi Template.java:85)
        at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:121)
        at org.springframework.jndi.JndiLocatorSupport.lookup (JndiLocatorSupport.java:71)
        at org.springframework.jndi.JndiObjectLocator.lookup( JndiObjectLocator.java:106)
        at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.lookup(AbstractRemoteSlsbInvoker Interceptor.java:93)
        at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.getHome(AbstractSlsbInvokerInterceptor .java:144)
        at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.create(AbstractSlsbInvokerInterceptor. java:168)
        at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.newSessionBeanInstance(AbstractR emoteSlsbInvokerInterceptor.java:202)
        at org.springframework.ejb.access.SimpleRemoteSlsbInv okerInterceptor.getSessionBeanInstance(SimpleRemot eSlsbInvokerInterceptor.java:108)
        at org.springframework.ejb.access.SimpleRemoteSlsbInv okerInterceptor.doInvoke(SimpleRemoteSlsbInvokerIn terceptor.java:74)
        at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.invoke(AbstractRemoteSlsbInvoker Interceptor.java:114)
        at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :144)
        at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:174)
        at $Proxy0.invoke(Unknown Source)
        at au.com.screening.ApplicationManagerInterceptor.inv oke(ApplicationManagerInterceptor.java:41)
        at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :144)
        at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:174)
        at $Proxy1.getAllUsers(Unknown Source)
        at au.com.screening.CachedApplicationDataManager.relo ad(CachedApplicationDataManager.java:42)
        at java.lang.reflect.Method.invoke(Native Method)
        at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeCustomInitMethod( AbstractAutowireCapableBeanFactory.java:1037)
        at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1007)
        at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:348)
        at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
        at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
        at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:176)
        at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:105)
        at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:957)
        at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:768)
        at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:330)
        at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
        at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
        at org.springframework.context.support.AbstractApplic ationContext.getBean(AbstractApplicationContext.ja va:548)
        at org.springframework.web.servlet.handler.AbstractUr lHandlerMapping.registerHandler(AbstractUrlHandler Mapping.java:186)
        at org.springframework.web.servlet.handler.SimpleUrlH andlerMapping.initApplicationContext(SimpleUrlHand lerMapping.java:96)
        at org.springframework.context.support.ApplicationObj ectSupport.setApplicationContext(ApplicationObject Support.java:79)
        at org.springframework.context.support.ApplicationCon textAwareProcessor.postProcessBeforeInitialization (ApplicationContextAwareProcessor.java:84)
        at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyBeanPostProcessors BeforeInitialization(AbstractAutowireCapableBeanFa ctory.java:240)
        at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:347)
        at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
        at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
        at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:275)
        at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:317)
        at org.springframework.web.context.support.AbstractRe freshableWebApplicationContext.refresh(AbstractRef reshableWebApplicationContext.java:134)
        at org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:3 05)
        at org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:250 )
        at org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:219)
        at org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:111)
        at javax.servlet.GenericServlet.init(GenericServlet.j ava:258)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.loadServlet(HttpAppli cation.java:2094)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.findServlet(HttpAppli cation.java:4523)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.getRequestDispatcher( HttpApplication.java:2969)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.getRequestDispatcher( HttpApplication.java:2748)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.getRequestDispatcher( HttpApplication.java:2308)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(Htt pRequestHandler.java:640)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHan dler.java:270)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHan dler.java:112)
        at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.ru n(ReleasableResourcePooledExecutor.java:186)
        at java.lang.Thread.run(Thread.java:479)



        Please disregard the one in the previous post.

        Comment


        • #5
          more info

          Would that fact that we are deploying it in the same container and using Remote EJB support rather than local be of any importance? I've added in some jndi props into my web app config for this:

          <?xml version="1.0" encoding="UTF-8"?>
          <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
          <beans>
          <!--
          // Provides an interface to the Business tier via EJB.
          -->
          <bean id="applicationManager" class="org.springframework.aop.framework.ProxyFact oryBean">
          <property name="proxyInterfaces" value="au.com.marsh.screening.ApplicationManager"/>
          <property name="interceptorNames">
          <list>
          <value>applicationManagerInterceptor</value>
          </list>
          </property>
          </bean>
          <bean id="applicationManagerInterceptor" class="com.screening.ApplicationManagerInterceptor ">
          <property name="methodInvoker" ref="applicationManagerEJB"/>
          </bean>
          <bean id="applicationManagerEJB" class="org.springframework.ejb.access.SimpleRemote StatelessSessionProxyFactoryBean">
          <property name="jndiName" value="screening/ejb/applicationManager"/>
          <property name="businessInterface" value="com.common.ejb.MethodInvoker"/>
          <property name="lookupHomeOnStartup" value="false"/>

          <property name="jndiEnvironment">
          <props>
          <prop key="java.naming.factory.initial">com.evermind.ser ver.rmi.RMIInitialContextFactory</prop>
          <prop key="java.naming.provider.url">ormi://localhost:8888</prop>
          <prop key="java.naming.security.principal">admin</prop>
          <prop key="java.naming.security.credentials">password</prop>
          </props>
          </property>

          </bean>
          </beans>


          and now i get a null pointer on the JNDI lookup:

          500 Internal Server Error
          org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'documentLogController' defined in ServletContext resource [/WEB-INF/controller-servlet.xml]: Can't resolve reference to bean 'cachedData' while setting property 'cachedData'; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'cachedData' defined in ServletContext resource [/WEB-INF/controller-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.remoting.RemoteLookupFailureEx ception: Failed to locate remote EJB [screening/ejb/applicationManager]; nested exception is javax.naming.NamingException: Lookup error: java.lang.NullPointerException; nested exception is: java.lang.NullPointerException
          org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'cachedData' defined in ServletContext resource [/WEB-INF/controller-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.remoting.RemoteLookupFailureEx ception: Failed to locate remote EJB [screening/ejb/applicationManager]; nested exception is javax.naming.NamingException: Lookup error: java.lang.NullPointerException; nested exception is: java.lang.NullPointerException
          org.springframework.remoting.RemoteLookupFailureEx ception: Failed to locate remote EJB [screening/ejb/applicationManager]; nested exception is javax.naming.NamingException: Lookup error: java.lang.NullPointerException; nested exception is: java.lang.NullPointerException
          javax.naming.NamingException: Lookup error: java.lang.NullPointerException; nested exception is: java.lang.NullPointerException. Root exception is java.lang.NullPointerException
          at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIConnection.lookup(RMIConnection.jav a:1698)
          at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIServer.lookup(RMIServer.java:727)
          at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.rmi.RMIContext.lookup(RMIContext.java:134)
          at javax.naming.InitialContext.lookup(InitialContext. java:345)
          at org.springframework.jndi.JndiTemplate$1.doInContex t(JndiTemplate.java:123)
          at org.springframework.jndi.JndiTemplate.execute(Jndi Template.java:85)
          at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:121)
          at org.springframework.jndi.JndiLocatorSupport.lookup (JndiLocatorSupport.java:74)
          at org.springframework.jndi.JndiObjectLocator.lookup( JndiObjectLocator.java:104)
          at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.lookup(AbstractRemoteSlsbInvoker Interceptor.java:93)
          at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.getHome(AbstractSlsbInvokerInterceptor .java:144)
          at org.springframework.ejb.access.AbstractSlsbInvoker Interceptor.create(AbstractSlsbInvokerInterceptor. java:168)
          at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.newSessionBeanInstance(AbstractR emoteSlsbInvokerInterceptor.java:202)
          at org.springframework.ejb.access.SimpleRemoteSlsbInv okerInterceptor.getSessionBeanInstance(SimpleRemot eSlsbInvokerInterceptor.java:108)
          at org.springframework.ejb.access.SimpleRemoteSlsbInv okerInterceptor.doInvoke(SimpleRemoteSlsbInvokerIn terceptor.java:74)
          at com.common.util.weblogic.RemoteStatelessSessionPro xyFactoryBean.doInvoke(RemoteStatelessSessionProxy FactoryBean.java:30)
          at org.springframework.ejb.access.AbstractRemoteSlsbI nvokerInterceptor.invoke(AbstractRemoteSlsbInvoker Interceptor.java:114)
          at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :144)
          at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:174)
          at $Proxy0.invoke(Unknown Source)
          at com.screening.ApplicationManagerInterceptor.invoke (ApplicationManagerInterceptor.java:26)
          at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :144)
          at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:174)
          at $Proxy1.getAllUsers(Unknown Source)
          at com.screening.CachedApplicationDataManager.reload( CachedApplicationDataManager.java:54)
          at java.lang.reflect.Method.invoke(Native Method)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeCustomInitMethod( AbstractAutowireCapableBeanFactory.java:1092)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1062)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:363)
          at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
          at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
          at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveReference(BeanDefinitio nValueResolver.java:176)
          at org.springframework.beans.factory.support.BeanDefi nitionValueResolver.resolveValueIfNecessary(BeanDe finitionValueResolver.java:105)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyPropertyValues(Abs tractAutowireCapableBeanFactory.java:1012)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.populateBean(AbstractAu towireCapableBeanFactory.java:823)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:345)
          at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
          at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
          at org.springframework.context.support.AbstractApplic ationContext.getBean(AbstractApplicationContext.ja va:553)
          at org.springframework.web.servlet.handler.AbstractUr lHandlerMapping.registerHandler(AbstractUrlHandler Mapping.java:186)
          at org.springframework.web.servlet.handler.SimpleUrlH andlerMapping.initApplicationContext(SimpleUrlHand lerMapping.java:96)
          at org.springframework.context.support.ApplicationObj ectSupport.setApplicationContext(ApplicationObject Support.java:79)
          at org.springframework.context.support.ApplicationCon textAwareProcessor.postProcessBeforeInitialization (ApplicationContextAwareProcessor.java:84)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.applyBeanPostProcessors BeforeInitialization(AbstractAutowireCapableBeanFa ctory.java:248)
          at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:362)
          at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:226)
          at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:147)
          at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:275)
          at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:318)
          at org.springframework.web.context.support.AbstractRe freshableWebApplicationContext.refresh(AbstractRef reshableWebApplicationContext.java:134)
          at org.springframework.web.servlet.FrameworkServlet.c reateWebApplicationContext(FrameworkServlet.java:3 05)
          at org.springframework.web.servlet.FrameworkServlet.i nitWebApplicationContext(FrameworkServlet.java:250 )
          at org.springframework.web.servlet.FrameworkServlet.i nitServletBean(FrameworkServlet.java:219)
          at org.springframework.web.servlet.HttpServletBean.in it(HttpServletBean.java:112)
          at javax.servlet.GenericServlet.init(GenericServlet.j ava:258)
          at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.loadServlet(HttpAppli cation.java:2094)
          at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.findServlet(HttpAppli cation.java:4523)
          at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.getRequestDispatcher( HttpApplication.java:2969)
          at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.getRequestDispatcher( HttpApplication.java:2748)
          at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpApplication.getRequestDispatcher( HttpApplication.java:2308)
          at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.processRequest(Htt pRequestHandler.java:640)
          at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHan dler.java:270)
          at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].server.http.HttpRequestHandler.run(HttpRequestHan dler.java:112)
          at com.evermind[Oracle Application Server Containers for J2EE 10g (9.0.4.0.0)].util.ReleasableResourcePooledExecutor$MyWorker.ru n(ReleasableResourcePooledExecutor.java:186)
          at java.lang.Thread.run(Thread.java:479)

          Comment


          • #6
            It looks like there is an issue with your deployed bean. Both InstantiationException and the NullPointerException happen on accessing the home interface.
            However what exactly goes wrong I cannot tell.

            Regards,
            Andreas

            Comment


            • #7
              You definitely should not set the InitailContext properties (jndiEnvironment) when the web app and ejb's are co-located (the container sets them behind these scenes), this is only required for remote communication between two JVM's.

              There is no problem using SimpleRemoteStatelessSessionProxyFactoryBean (except performance).

              To prevent the Spring context doing the JNDI lookup when it is intialized, which may be before the JNDI tree is populated, you should set 'lazy-init':

              Code:
              <bean id="petStore" class="org.springframework.ejb.access.LocalStatelessSessionProxyFactoryBean" lazy-init="true">
              	  <property name="jndiName"><value>java&#58;comp/env/PetStore</value></property>
                  <property name="businessInterface"><value>org.springframework.samples.jpetstore.domain.logic.PetStoreFacade</value></property>
              </bean>
              You may also have to set this attribute on all the beans which wrap your "applicationManagerEJB" bean.

              regards,
              Chris

              Comment

              Working...
              X