|
From: Giorgos Z. <gi...@pe...> - 2003-12-04 12:36:25
|
dear list, i am new to spring framework so please excuse me if my question has an obvious answer. here it is: i have setup a simple we application where my web.xml file defines two servlets: a ContextLoaderServler and a DispatcherServer. the first one is responsible for loading my applicationSpecification.xml. the second one loads its servel-name.xml configuration file. now here comes the problem... in the applicationSpecication.xml file i have defined a simple DAO bean (<bean id="beanService"... etc>) and from the servlet-name.xml i refer to this bean in the definition of my Controller: <bean id="myController" class="myControllerClass"> <property name="myService"><ref bean="beanService"></property> </bean> then i deploy my app into tomcat but the two configuration files insist on loading in the wrong order, ie servler-name.xml first, applicationConfiguration.xml second which results in the following deployment error: Can't resolve reference to bean 'beanService' while setting property 'myService' on bean 'myController'; i have tried reading every bit of documentation i could find but i didn't seem to see anything relevant. your help will be greatly appreciated. best regards, giorgos |
|
From: Darren D. <dda...@kg...> - 2003-12-04 15:05:09
|
> now here comes the problem... in the applicationSpecication.xml file > i have defined a simple DAO bean (<bean id="beanService"... etc>) > > and from the servlet-name.xml i refer to this bean in the definition > of my Controller: > > <bean id="myController" class="myControllerClass"> > <property name="myService"><ref bean="beanService"></property> > </bean> the default name for the file is 'applicationContext.xml' rather than 'applicationSpecification.xml'. If you don't use the default name, you have to declare this in your web.xml as follows.. <web-app> ... <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationSpecification.xml</param-value> </context-param> ... </web-app> hth, Darren. -- Darren Davison Public Key: http://www.davison.uk.net/key.jsp |
|
From: Giorgos Z. <gi...@pe...> - 2003-12-04 15:13:50
|
Hi Darren, Actually I am doing what you suggested but the order was still wrong. Until I tried to use the <listener> tag instead of the <servlet> tag to define the ContextLoaderListener. This fixed the problem although I must admin that I don't quite understand why. Thanks, Giorgos Darren Davison wrote: > > > >>now here comes the problem... in the applicationSpecication.xml file >>i have defined a simple DAO bean (<bean id="beanService"... etc>) >> >>and from the servlet-name.xml i refer to this bean in the definition >>of my Controller: >> >><bean id="myController" class="myControllerClass"> >> <property name="myService"><ref bean="beanService"></property> >></bean> >> >> > > >the default name for the file is 'applicationContext.xml' rather than >'applicationSpecification.xml'. If you don't use the default name, you have >to declare this in your web.xml as follows.. > ><web-app> >... ><context-param> > <param-name>contextConfigLocation</param-name> > <param-value>/WEB-INF/applicationSpecification.xml</param-value> ></context-param> >... ></web-app> > > >hth, >Darren. > > >-- >Darren Davison >Public Key: http://www.davison.uk.net/key.jsp > > >------------------------------------------------------- >This SF.net email is sponsored by: IBM Linux Tutorials. >Become an expert in LINUX or just sharpen your skills. Sign up for IBM's >Free Linux Tutorials. Learn everything from the bash shell to sys admin. >Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click >_______________________________________________ >Springframework-developer mailing list >Spr...@li... >https://lists.sourceforge.net/lists/listinfo/springframework-developer > > |
|
From: Ken K. <kk...@kk...> - 2003-12-04 15:32:02
|
Giorgos, Check the *ContextLoaderServlet *Javadoc for an explanation. Ken Giorgos Zervas wrote: > Hi Darren, > > Actually I am doing what you suggested but the order was still wrong. > > Until I tried to use the <listener> tag instead of the <servlet> tag > to define the ContextLoaderListener. This fixed the problem although I > must admin that I don't quite understand why. > > Thanks, > Giorgos > > Darren Davison wrote: > >> >> >> >>> now here comes the problem... in the applicationSpecication.xml file >>> i have defined a simple DAO bean (<bean id="beanService"... etc>) >>> >>> and from the servlet-name.xml i refer to this bean in the definition >>> of my Controller: >>> >>> <bean id="myController" class="myControllerClass"> >>> <property name="myService"><ref bean="beanService"></property> >>> </bean> >>> >> >> >> >> the default name for the file is 'applicationContext.xml' rather than >> 'applicationSpecification.xml'. If you don't use the default name, >> you have >> to declare this in your web.xml as follows.. >> >> <web-app> >> ... >> <context-param> >> <param-name>contextConfigLocation</param-name> >> <param-value>/WEB-INF/applicationSpecification.xml</param-value> >> </context-param> >> ... >> </web-app> >> >> >> hth, >> Darren. >> >> >> -- >> Darren Davison >> Public Key: http://www.davison.uk.net/key.jsp >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: IBM Linux Tutorials. >> Become an expert in LINUX or just sharpen your skills. Sign up for >> IBM's >> Free Linux Tutorials. Learn everything from the bash shell to sys >> admin. >> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click >> _______________________________________________ >> Springframework-developer mailing list >> Spr...@li... >> https://lists.sourceforge.net/lists/listinfo/springframework-developer >> >> > > > > > ------------------------------------------------------- > This SF.net email is sponsored by: IBM Linux Tutorials. > Become an expert in LINUX or just sharpen your skills. Sign up for IBM's > Free Linux Tutorials. Learn everything from the bash shell to sys admin. > Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click > _______________________________________________ > Springframework-developer mailing list > Spr...@li... > https://lists.sourceforge.net/lists/listinfo/springframework-developer > > |
|
From: Giorgos Z. <gi...@pe...> - 2003-12-04 15:38:49
|
Thanks Ken, I will make sure that I read it. Best regards, Giorgos Ken Krebs wrote: > Giorgos, > > Check the *ContextLoaderServlet *Javadoc for an explanation. > > Ken > > Giorgos Zervas wrote: > >> Hi Darren, >> >> Actually I am doing what you suggested but the order was still wrong. >> >> Until I tried to use the <listener> tag instead of the <servlet> tag >> to define the ContextLoaderListener. This fixed the problem although >> I must admin that I don't quite understand why. >> >> Thanks, >> Giorgos >> >> Darren Davison wrote: >> >>> >>> >>> >>>> now here comes the problem... in the applicationSpecication.xml >>>> file i have defined a simple DAO bean (<bean id="beanService"... etc>) >>>> >>>> and from the servlet-name.xml i refer to this bean in the >>>> definition of my Controller: >>>> >>>> <bean id="myController" class="myControllerClass"> >>>> <property name="myService"><ref bean="beanService"></property> >>>> </bean> >>>> >>> >>> >>> >>> the default name for the file is 'applicationContext.xml' rather than >>> 'applicationSpecification.xml'. If you don't use the default name, >>> you have >>> to declare this in your web.xml as follows.. >>> >>> <web-app> >>> ... >>> <context-param> >>> <param-name>contextConfigLocation</param-name> >>> <param-value>/WEB-INF/applicationSpecification.xml</param-value> >>> </context-param> >>> ... >>> </web-app> >>> >>> >>> hth, >>> Darren. >>> >>> >>> -- >>> Darren Davison >>> Public Key: http://www.davison.uk.net/key.jsp >>> >>> >>> ------------------------------------------------------- >>> This SF.net email is sponsored by: IBM Linux Tutorials. >>> Become an expert in LINUX or just sharpen your skills. Sign up for >>> IBM's >>> Free Linux Tutorials. Learn everything from the bash shell to sys >>> admin. >>> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click >>> _______________________________________________ >>> Springframework-developer mailing list >>> Spr...@li... >>> https://lists.sourceforge.net/lists/listinfo/springframework-developer >>> >>> >> >> >> >> >> ------------------------------------------------------- >> This SF.net email is sponsored by: IBM Linux Tutorials. >> Become an expert in LINUX or just sharpen your skills. Sign up for >> IBM's >> Free Linux Tutorials. Learn everything from the bash shell to sys >> admin. >> Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click >> _______________________________________________ >> Springframework-developer mailing list >> Spr...@li... >> https://lists.sourceforge.net/lists/listinfo/springframework-developer >> >> > |