• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

using TransactionProxyFactoryBean

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am trying to implement the spring transactions following the petclinic2.0.8 sample application. In place of clinic transaction bean i have userServiceImpl which take care of login and other authentication stuff.

I have created the bean in applicationContext.xml and referencing it from DispatherServlet but I am getting the error;

StackTrace

<blockquote>code:
<pre name="code" class="core">
Jul 17, 2008 3:57:50 PM org.apache.catalina.core.AprLifecycleListener lifecycleEvent
INFO: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0\bin;.;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\Perl\bin\;E:\oraclexe\app\oracle\product\10.2.0\server\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\QuickTime\QTSystem\;H:\Softwares\ant-1.6.5\bin;C:\Program Files\Java\jdk1.6.0\bin;H:\Program Files\Subversion\bin;D:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Python25;C:\Program Files\TortoiseSVN\bin;G:\Program Files\VisualSVN\bin
Jul 17, 2008 3:57:50 PM org.apache.coyote.http11.Http11BaseProtocol init
INFO: Initializing Coyote HTTP/1.1 on http-8081
Jul 17, 2008 3:57:50 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1188 ms
Jul 17, 2008 3:57:50 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Jul 17, 2008 3:57:50 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/5.5.20
Jul 17, 2008 3:57:50 PM org.apache.catalina.core.StandardHost start
INFO: XML validation disabled
Jul 17, 2008 3:57:50 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(H:\eclipseProjects\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps\WonderSales\WEB-INF\lib\javax.servlet.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Jul 17, 2008 3:57:51 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(H:\eclipseProjects\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\webapps\WonderSales\WEB-INF\lib\servlet-api.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
2008-07-17 15:57:52,281 INFO [org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/wondergas_trunk]] - Initializing Spring FrameworkServlet 'Wondergas'
2008-07-17 15:57:52,281 INFO [org.springframework.web.servlet.DispatcherServlet] - FrameworkServlet 'Wondergas': initialization started
2008-07-17 15:57:52,359 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@56f631: display name [WebApplicationContext for namespace 'Wondergas-servlet']; startup date [Thu Jul 17 15:57:52 BST 2008]; root of context hierarchy
2008-07-17 15:57:52,578 INFO [org.springframework.beans.factory.xml.XmlBeanDefinitionReader] - Loading XML bean definitions from ServletContext resource [/WEB-INF/Wondergas-servlet.xml]
2008-07-17 15:57:52,953 INFO [org.springframework.web.context.support.XmlWebApplicationContext] - Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@56f631]: org.springframework.beans.factory.support.DefaultListableBeanFactory@54c4ad
2008-07-17 15:57:53,234 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@54c4ad: defining beans [WondergasController,AdminMenuController,LoginFormController,CreateUserFormController,ViewUsersController,DeleteUserFormController,LoginValidator,CreateUserValidator,UserImpl,ApplicationSecurityManager,messageSource,urlMapping,viewResolver]; root of factory hierarchy
2008-07-17 15:57:53,343 INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@54c4ad: defining beans [WondergasController,AdminMenuController,LoginFormController,CreateUserFormController,ViewUsersController,DeleteUserFormController,LoginValidator,CreateUserValidator,UserImpl,ApplicationSecurityManager,messageSource,urlMapping,viewResolver]; root of factory hierarchy
2008-07-17 15:57:53,343 ERROR [org.springframework.web.servlet.DispatcherServlet] - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'LoginFormController' defined in ServletContext resource [/WEB-INF/Wondergas-servlet.xml]: Cannot resolve reference to bean 'UserServiceImpl' while setting bean property 'userServiceImpl'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'UserServiceImpl' is defined
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:275)

</pre>
</blockquote>

<blockquote>code:
<pre name="code" class="core">

<bean
id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="dataSource">
<ref local="dataSource" />
</property>
<property name="mappingResources">
<list>
<value>user.hbm.xml</value>
<value>role.hbm.xml</value>
<value>permission.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.OracleDialect</prop>
<prop key="show_sql">true</prop>
<prop key="format_sql">true</prop>
<prop key="use_sql_comments">true</prop>
</props>
</property>
</bean>
<!-- Transaction Manager -->
<bean
id="transactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property
name="sessionFactory"
ref="sessionFactory" />
</bean>
<bean
id="UserServiceImpl"
class="com.wonder.common.impl.UserServiceImpl">
<property
name="sessionFactory"
ref="sessionFactory" />
</bean>
<bean
id="UserService"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property
name="transactionManager"
ref="transactionManager" />
<property
name="target"
ref="UserServiceImpl" />
<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="create*">PROPAGATION_REQUIRED</prop>
</props>
</property>
</bean>
</beans>

Dispatcher Servlet

 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Didn't you ask this in another thread. It seems like a duplicate post, if it is, please refrain from duplicate posting.

One thing I would point out, is I am assuming this is in more than one xml file. But it seems like the userServiceImpl is declared in with more framework stuff than maybe in a seperate xml file with other application specific beans.

Mark
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic