I got 6 beans in applicationContext-hibernate.xml ,they are :
Code:<beans> <bean id="messageSource" class="org.springframework.context.support.ResourceBundleMessageSource"> <property name="basename"> <value>messages</value> </property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate.LocalSessionFactoryBean"> <property name="mappingResources"> <list> <value>UserBase.hbm.xml</value> </list> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">net.sf.hibernate.dialect.OracleDialect</prop> <prop key="hibernate.query.substitutions">true=1 false=0</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.connection.driver_class">oracle.jdbc.driver.OracleDriver</prop> <prop key="hibernate.connection.url">jdbc:oracle:thin:@DN2003:1521:V250BUN</prop> <prop key="hibernate.connection.username">EXAMPLE</prop> <prop key="hibernate.connection.password">EXAMPLE</prop> </props> </property> </bean> <bean id="transactionManager" class="org.springframework.orm.hibernate.HibernateTransactionManager"> <property name="sessionFactory"> <ref local="sessionFactory"/> </property> </bean> <bean id="userBaseDao" class="example.dao.UserBaseDAO"> <property name="sessionFactory"><ref local="sessionFactory"/></property> </bean> <bean id="userBOTarget" class="example.business.UserBO"> <property name="userBaseDao"><ref local="userBaseDao"/></property> </bean> <bean id="userBO" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"> <property name="transactionManager"><ref local="transactionManager"/></property> <property name="target"><ref local="userBOTarget"/></property> <property name="transactionAttributes"> <props> <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="load*">PROPAGATION_REQUIRED,readOnly</prop> <prop key="store*">PROPAGATION_REQUIRED</prop> </props> </property> </bean> </beans>
in my struts action I use
to get the userBO bean.Code:(UserBO) getWebApplicationContext().getBean("userBO")
It works fine in tomcat. but in Macromedia JRUN 4,
It seems initialize ok what I can see from the following log,
but throwing the following exception when I got the userBO bean reference.Code:08/27 16:05:20 debug [axis] Loading bean definitions 08/27 16:05:20 debug [axis] Default lazy init 'false' 08/27 16:05:20 debug [axis] Default dependency check 'none' 08/27 16:05:20 debug [axis] Default autowire 'no' 08/27 16:05:17 debug jrunx.kernel.JRunServiceDeployer.invokeOnServices start 上で RI Web Application Factory を呼び出し中 08/27 16:05:20 debug [axis] Registering bean definition with id 'messageSource' 08/27 16:05:21 debug [axis] Registering bean definition with id 'sessionFactory' 08/27 16:05:17 debug jrunx.kernel.JRunServiceDeployer.invokeOnServices start 上で RI Enterprise Application Factory を呼び出し中 08/27 16:05:21 debug [axis] Registering bean definition with id 'transactionManager' 08/27 16:05:21 debug [axis] Registering bean definition with id 'userBaseDao' 08/27 16:05:21 debug [axis] Registering bean definition with id 'userBOTarget' 08/27 16:05:21 debug [axis] Registering bean definition with id 'userBO' 08/27 16:05:21 debug [axis] Found 6 <bean> elements defining beans 08/27 16:05:21 info [axis] Bean factory for application context [Root XmlWebApplicationContext]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource,sessionFactory,transactionManager,userBaseDao,userBOTarget,userBO]; Root of BeanFactory hierarchy 08/27 16:05:21 info [axis] 6 beans defined in ApplicationContext [Root XmlWebApplicationContext] 08/27 16:05:21 info [axis] Creating shared instance of singleton bean 'messageSource' 08/27 16:05:21 debug [axis] Creating instance of bean 'messageSource' with merged definition [Root bean with class [org.springframework.context.support.ResourceBundleMessageSource] defined in resource [/WEB-INF/applicationContext-hibernate.xml] of ServletContext] 08/27 16:05:21 debug [axis] Using cached introspection results for class [org.springframework.context.support.ResourceBundleMessageSource] 08/27 16:05:21 debug [axis] About to invoke write method [public void org.springframework.context.support.ResourceBundleMessageSource.setBasename(java.lang.String)] on object of class [org.springframework.context.support.ResourceBundleMessageSource] 08/27 16:05:21 debug [axis] Invoked write method [public void org.springframework.context.support.ResourceBundleMessageSource.setBasename(java.lang.String)] with value [messages] 08/27 16:05:21 debug [axis] Invoking BeanPostProcessors before initialization of bean 'messageSource' ......
what reason I may be?
Any comment will be very appreciated!!Code:08/27 16:06:43 warning [axis] Unhandled Exception thrown: class org.springframework.beans.factory.NoSuchBeanDefinitionException 08/27 16:06:43 error jrun.servlet.JRunRequestDispatcher.invoke No bean named 'userBO' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource]; Root of BeanFactory hierarchy [1]org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'userBO' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource]; Root of BeanFactory hierarchy at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:284) at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedBeanDefinition(AbstractBeanFactory.java:549) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:135) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:431) at example.web.LoginAction.getUserBO(LoginAction.java:25) at example.web.LoginAction.execute(LoginAction.java:45) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:484) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at example.EnvPrinter.doFilter(EnvPrinter.java:33) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at example.web.EncodingFilter.doFilter(EncodingFilter.java:172) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at jrun.servlet.FilterChain.service(FilterChain.java:101) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:252) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527) at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168) at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:348) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451) at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:294) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66) [0]javax.servlet.ServletException: No bean named 'userBO' is defined: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [messageSource]; Root of BeanFactory hierarchy at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:545) at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:486) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525) at javax.servlet.http.HttpServlet.service(HttpServlet.java:760) at javax.servlet.http.HttpServlet.service(HttpServlet.java:853) at jrun.servlet.FilterChain.doFilter(FilterChain.java:86) at example.EnvPrinter.doFilter(EnvPrinter.java:33) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at example.web.EncodingFilter.doFilter(EncodingFilter.java:172) at jrun.servlet.FilterChain.doFilter(FilterChain.java:94) at jrun.servlet.FilterChain.service(FilterChain.java:101) at jrun.servlet.ServletInvoker.invoke(ServletInvoker.java:91) at jrun.servlet.JRunInvokerChain.invokeNext(JRunInvokerChain.java:42) at jrun.servlet.JRunRequestDispatcher.invoke(JRunRequestDispatcher.java:252) at jrun.servlet.ServletEngineService.dispatch(ServletEngineService.java:527) at jrun.servlet.http.WebService.invokeRunnable(WebService.java:168) at jrunx.scheduler.ThreadPool$DownstreamMetrics.invokeRunnable(ThreadPool.java:348) at jrunx.scheduler.ThreadPool$ThreadThrottle.invokeRunnable(ThreadPool.java:451) at jrunx.scheduler.ThreadPool$UpstreamMetrics.invokeRunnable(ThreadPool.java:294) at jrunx.scheduler.WorkerThread.run(WorkerThread.java:66)


Reply With Quote