alexfe 27 de jan. de 2015
coloca esse bloco <tx:annotation-driven
transaction-manager="transactionManager"/>
Depois do
<tx:annotation-driven
transaction-manager="transactionManager"/>
evandro_araujo 27 de jan. de 2015
alexfe 28 de jan. de 2015
Desculpa tinha escrito errado
coloca esse bloco <tx:annotation-driven
transaction-manager="transactionManager"/>
em baixo deste
& lt ; mvc : annotation-driven /& gt ;
ou substitui faz o teste ai
evandro_araujo 28 de jan. de 2015
Alex,
tentei deixar da seguinte forma, mas o problema continua.
< mvc : annotation - driven />
< tx : annotation - driven
transaction - manager = "transactionManager" />
alexfe 28 de jan. de 2015
Veja se te ajuda
User este nome para seu arquivo applicationContext.xml
& lt ; ? xml version = "1.0" encoding = "UTF-8" ?& gt ;
& lt ; beans xmlns = "http://www.springframework.org/schema/beans"
xmlns: mvc = "http://www.springframework.org/schema/mvc"
xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance"
xmlns: context = "http://www.springframework.org/schema/context"
xmlns: aop = "http://www.springframework.org/schema/aop"
xmlns: tx = "http://www.springframework.org/schema/tx"
xsi: schemaLocation = "
http: //www.springframework.org/schema/beans
http: //www.springframework.org/schema/beans/spring-beans-2.0.xsd
http: //www.springframework.org/schema/tx
http: //www.springframework.org/schema/tx/spring-tx-2.0.xsd
http: //www.springframework.org/schema/aop
http: //www.springframework.org/schema/aop/spring-aop-2.0.xsd" >
& lt ; context: annotation - config /& gt ;
& lt ; mvc: annotation - driven /& gt ;
& lt ; mvc: default - servlet - handler /& gt ;
& lt ; !-- ####### DATASOURCES ########## --& gt ;
& lt ; bean id = "dataSource"
class = "org.springframework.jdbc.datasource.SingleConnectionDataSource"
destroy - method = "destroy" scope = "singleton" & gt ;
& lt ; property name = "driverClassName" value = "org.postgresql.Driver" /& gt ;
& lt ; property name = "url" value = "jdbc:postgresql://localhost:5432/jalis_testeunitario" /& gt ;
& lt ; property name = "autoCommit" value = "false" /& gt ;
& lt ; property name = "suppressClose" value = "true" /& gt ;
& lt ; property name = "username" value = "thread" /& gt ;
& lt ; property name = "password" value = "murphy123" /& gt ;
& lt ; / bean & gt ;
& lt ; !-- SESSION FACTORY --& gt ;
& lt ; bean id = "sessionFactory"
class = "org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"
scope = "singleton" & gt ;
& lt ; property name = "dataSource" & gt ;
& lt ; ref bean = "dataSource" /& gt ;
& lt ; / property & gt ;
& lt ; property name = "hibernateProperties" & gt ;
& lt ; props & gt ;
& lt ; prop key = "hibernate.dialect" & gt ;
org . hibernate . dialect . PostgreSQLDialect
& lt ; / prop & gt ;
& lt ; prop key = "hibernate.default_schema" & gt ; public & lt ; / prop & gt ;
& lt ; prop key = "hibernate.show_sql" & gt ; true & lt ; / prop & gt ;
& lt ; prop key = "hibernate.format_sql" & gt ; true & lt ; / prop & gt ;
& lt ; prop key = "hibernate.current_session_context_class" & gt ; thread & lt ; / prop & gt ; & lt ; !-- Gerenciamento de contexto automático da sessão do Hibernate --& gt ;
& lt ; prop key = "hibernate.connection.provider_class" & gt ; org . hibernate . connection . C3P0ConnectionProvider & lt ; / prop & gt ;
& lt ; prop key = "hibernate.c3p0.min_size" & gt ; 3 & lt ; / prop & gt ; & lt ; !-- Minimo de conexões do pool --& gt ;
& lt ; prop key = "hibernate.c3p0.max_size" & gt ; 8 & lt ; / prop & gt ; & lt ; !-- Máximo de conexões do pool --& gt ;
& lt ; prop key = "hibernate.c3p0.timeout" & gt ; 50 & lt ; / prop & gt ; & lt ; !-- Tempo em segundos --& gt ;
& lt ; prop key = "hibernate.connection.autocommit" & gt ; false & lt ; / prop & gt ; & lt ; !-- Auto commit --& gt ;
& lt ; prop key = "hibernate.c3p0.idle_test_period" & gt ; 50 & lt ; / prop & gt ;
& lt ; prop key = "hibernate.connection.pool_size" & gt ; 50 & lt ; / prop & gt ; & lt ; !-- Limita o numero de conexos aguarndando no pool --& gt ;
& lt ; prop key = "hibernate.c3p0.max_statements" & gt ; 1000 & lt ; / prop & gt ; & lt ; !-- Determina o limite maximo de de cache de comando sql do C3po --& gt ;
& lt ; prop key = "hibernate.c3p0.acquire_increment" & gt ; 5 & lt ; / prop & gt ;
& lt ; / props & gt ;
& lt ; / property & gt ;
& lt ; property name = "annotatedClasses" & gt ;
& lt ; list & gt ;
& lt ; value & gt ; br . com . project . model . geral . Usuario & lt ; / value & gt ; & lt ; !-- Classe de entidade persistentes --& gt ;
& lt ; / list & gt ;
& lt ; / property & gt ;
& lt ; / bean & gt ;
& lt ; bean id = "jdbcTemplate" class = "org.springframework.jdbc.core.JdbcTemplate"
scope = "singleton" autowire = "autodetect" & gt ;
& lt ; property name = "dataSource" & gt ;
& lt ; ref bean = "dataSource" /& gt ;
& lt ; / property & gt ;
& lt ; / bean & gt ;
& lt ; bean id = "transactionManager"
class = "org.springframework.orm.hibernate3.HibernateTransactionManager"
scope = "singleton" lazy - init = "default" autowire = "byName" & gt ;
& lt ; property name = "sessionFactory" & gt ;
& lt ; ref bean = "sessionFactory" /& gt ;
& lt ; / property & gt ;
& lt ; / bean & gt ;
& lt ; bean class = "org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" /& gt ;
& lt ; !-- ======================================= FIM DA CONFIGURAÇÃO DE CONEXÃO ================================================================================================ --& gt ;
& lt ; !-- Controllers --& gt ;
& lt ; !-- Repositorios interfaces --& gt ;
& lt ; !-- Servicos interfaces --& gt ;
& lt ; / beans & gt ;
evandro_araujo 28 de jan. de 2015
Alex,
copiei o seu código e agora mudou o erro :
Description Resource Path Location Type
The processing instruction target matching “[xX][mM][lL]” is not allowed. servlet-context.xml /SpringDevmedia/src/main/webapp/WEB-INF/spring/appServlet line 1 XML Problem
alexfe 28 de jan. de 2015
Vc temque ajustar ao projeto, verificar se falta Jars. Mas deixe o cabecalho do XML assim e tente novamente
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-lazy-init="true">
evandro_araujo 28 de jan. de 2015
deixei dessa forma :
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns= "http://www.springframework.org/schema/beans"
xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc= "http://www.springframework.org/schema/mvc"
xmlns:context= "http://www.springframework.org/schema/context"
xsi:schemaLocation= "
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd" >
<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
<!-- Scans within the base package of the application for @Components to configure as beans -->
<!-- @Controller, @Service, @Configuration, etc. -->
<context:component-scan base-package= "xyz.sample.baremvc" />
<!-- Enables the Spring MVC @Controller programming model -->
<mvc:annotation-driven />
</beans>
alexfe 28 de jan. de 2015
evandro_araujo 29 de jan. de 2015
deixei na configuração acima e não deu mais o erro.