This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes Other Application Frameworks and the fly likes using TransactionProxyFactoryBean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "using TransactionProxyFactoryBean" Watch "using TransactionProxyFactoryBean" New topic
Author

using TransactionProxyFactoryBean

Kashif Mughal
Ranch Hand

Joined: Jun 19, 2008
Posts: 44
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



Thanks in Advance,
Kash.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

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


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using TransactionProxyFactoryBean
 
Similar Threads
Spring2.5.6+Tomcat7: HTTP Status 404: The requested resource () is not available
java.lang.NoSuchMethodError:
Problem to run my application
handling transient entity in delete processing
[Security:090398]Invalid Subject: weblogic :java.lang.SecurityException: [nested exception is java.l