Me deparei com um problema no meu projeto.
Fui mudar do SQL_SERVER para o POSTGRESQL e agora não consigo levantar a aplicação com o JBOSS:
Erro no console
16:38:26,150 INFO [SessionFactoryImpl] building session factory
16:38:26,400 INFO [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
16:38:26,478 ERROR [[/contratos]] Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contratoService' defined in class path resource [applicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'contratoDao': Injection of persistence fields failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: org.hibernate.HibernateException: Wrong column type: ID, expected: int8
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:480)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
applicationContext.xml:
<bean id="contratoService" class="br.com.bry.crsec.contratos.service.impl.ContratoService" />
Alguem teria alguma sugestão?
Posta o applicationContext.xml todo.
está aqui:
<?xml version="1.0" encoding="ISO-8859-1"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:p="http://www.springframework.org/schema/p" xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context" xmlns:jee="http://www.springframework.org/schema/jee"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.5.xsd"
default-autowire="byName">
<!--*** Camada de negócios ***-->
<bean id="entidadeService" class="br.com.bry.crsec.contratos.service.impl.EntidadeService" />
<bean id="contratoService" class="br.com.bry.crsec.contratos.service.impl.ContratoService" />
<bean id="contratoWebService" class="br.com.bry.crsec.contratos.service.impl.ContratoWebService" />
<bean id="participanteService" class="br.com.bry.crsec.contratos.service.impl.ParticipanteService" />
<bean id="pesquisaService" class="br.com.bry.crsec.contratos.service.impl.PesquisaService" />
<bean id="usuarioService" class="br.com.bry.crsec.contratos.service.impl.UsuarioService" />
<bean id="grupoService" class="br.com.bry.crsec.contratos.service.impl.GrupoService" />
<bean id="securityService" class="br.com.bry.crsec.contratos.service.impl.SecurityService">
<property name="certificadoAutenticacaoAct" value="${CertificadoAutenticacaoPDDE}" />
</bean>
<bean id="parametroService" class="br.com.bry.crsec.contratos.service.impl.ParametroService" />
<bean id="assinaturaService" class="br.com.bry.crsec.contratos.service.impl.AssinaturaService" />
<!-- <bean id="contabilidadeService" class="br.com.bry.crsec.contratos.service.impl.ContabilidadeService" /> -->
<bean id="contabilidadeService" class="br.com.bry.crsec.contratos.service.impl.ContabilidadeService" />
<bean id="cartorioService" class="br.com.bry.crsec.contratos.service.impl.CartorioServiceFalso" />
<bean id="emailService" class="br.com.bry.crsec.contratos.service.impl.EmailService">
<property name="link" value="${LinkDoEmailDeAssinatura}" />
</bean>
<bean id="dataLimiteService" class="br.com.bry.crsec.contratos.service.impl.DataLimiteService">
<property name="numeroDeDiasAntecipados" value="${NumeroDeDiasAntecipadosParaDataLimite}" />
</bean>
<bean id="emailPushService" class="br.com.bry.crsec.contratos.service.impl.EmailPushService" />
<bean id="smsPushService" class="br.com.bry.crsec.contratos.service.impl.SmsPushService" />
<bean id="openOfficeConnection" class="com.artofsolving.jodconverter.openoffice.connection.SocketOpenOfficeConnection">
<constructor-arg value="${ServidorOpenOffice}" />
<constructor-arg value="${PortaOpenOffice}" />
</bean>
<bean id="fabricaDeAlgoritmos" class="br.com.bry.crsec.contratos.service.conversao.pdf.FabricaDeAlgoritmosDeConversao">
<property name="connection" ref="openOfficeConnection" />
<property name="documentConverter">
<bean class="com.artofsolving.jodconverter.openoffice.converter.OpenOfficeDocumentConverter">
<constructor-arg ref="openOfficeConnection" />
</bean>
</property>
</bean>
<!--*** Camada de persistência ***-->
<bean id="entidadeDao" class="br.com.bry.crsec.contratos.dao.jpa.JpaEntidadeDAO" />
<bean id="contratoDao" class="br.com.bry.crsec.contratos.dao.jpa.JpaContratoDAO" />
<bean id="usuarioDao" class="br.com.bry.crsec.contratos.dao.jpa.JpaUsuarioDAO" />
<bean id="grupoDao" class="br.com.bry.crsec.contratos.dao.jpa.JpaGrupoDAO" />
<bean id="participanteDao" class="br.com.bry.crsec.contratos.dao.jpa.JpaParticipanteDao" />
<bean id="parametroDao" class="br.com.bry.crsec.contratos.dao.properties.PropertiesParametroDao">
<property name="properties" ref="arquivoDeConfiguracao" />
</bean>
<util:properties id="arquivoDeConfiguracao" location="classpath:bry_contratos.properties" />
<!--*** Configurações de banco e transações ***-->
<bean id="dataSourceCrsec" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/contratos" />
<property name="cache" value="true"/>
<property name="resourceRef" value="true"/>
<property name="lookupOnStartup" value="true"/>
<property name="expectedType" value="javax.sql.DataSource" />
</bean>
<bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="crsec-pu" />
<property name="dataSource" ref="dataSourceCrsec" />
<property name="persistenceXmlLocation" value="classpath:/META-INF/persistence.xml"/>
<property name="jpaVendorAdapter">
<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
<property name="database" value="${DialetoDoBancoDeDados}" />
<property name="showSql" value="${RodarNoModoDesenvolvimento}" />
<property name="generateDdl" value="${RodarNoModoDesenvolvimento}" />
</bean>
</property>
<property name="jpaProperties">
<props>
<prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
<prop key="hibernate.hbm2ddl.auto">validate</prop>
<prop key="hibernate.archive.autodetection">class</prop>
</props>
</property>
</bean>
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
<property name="entityManagerFactory" ref="entityManagerFactory" />
</bean>
<tx:annotation-driven />
<!--*** Configuracao do Quartz para rodar a daemon de avisos em limite de assinatura ***-->
<bean name="dataLimiteJobBean" class="org.springframework.scheduling.quartz.JobDetailBean">
<property name="jobClass" value="br.com.bry.crsec.contratos.util.DataLimiteJobBean" />
<property name="jobDataAsMap">
<map>
<entry key="dataLimiteService">
<ref bean="dataLimiteService"/>
</entry>
</map>
</property>
</bean>
<bean class="org.springframework.scheduling.quartz.SchedulerFactoryBean">
<property name="triggers">
<bean class="org.springframework.scheduling.quartz.CronTriggerBean">
<property name="jobDetail" ref="dataLimiteJobBean" />
<property name="cronExpression" value="${ExpressaoCronParaRodarDaemon}" />
</bean>
</property>
</bean>
<!--*** Outras configurações ***-->
<bean id="carimboDoTempoImageRenderer" init-method="carregarImagemTemplate"
class="br.com.bry.crsec.contratos.web.util.CarimboDoTempoImageRenderer" />
<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
<property name="velocityProperties">
<value>
resource.loader=class
class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
</value>
</property>
</bean>
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
<property name="host" value="modelo.bry.com.br"/>
<property name="port" value="25" />
<!--
<property name="session">
<bean class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="mail/Session" />
<property name="cache" value="true"/>
<property name="resourceRef" value="true"/>
<property name="lookupOnStartup" value="true"/>
<property name="expectedType" value="javax.mail.Session" />
</bean>
</property>
-->
</bean>
<context:annotation-config />
<bean id="parametrosCrsec" class="br.com.bry.crsec.contratos.util.ParametrosCrsec">
<property name="extensoesDeArquivoPermitidas">
<map>
<entry key="pdf" value="application/pdf" />
<entry key="doc" value="application/msword" />
<entry key="docx" value="application/vnd.openxmlformats-officedocument.wordprocessingml.document" />
<entry key="rtf" value="application/rtf" />
<entry key="txt" value="text/plain" />
<entry key="jpg" value="image/jpeg" />
<entry key="jpeg" value="image/jpeg" />
<entry key="tiff" value="image/tiff" />
<entry key="tif" value="image/tiff" />
<entry key="gif" value="image/gif" />
<entry key="png" value="image/png" />
</map>
</property>
</bean>
<bean class="org.springframework.web.context.support.ServletContextPropertyPlaceholderConfigurer" depends-on="parametrosCrsec">
<property name="contextOverride" value="true" />
<property name="searchContextAttributes" value="true" />
</bean>
<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
<property name="customEditors">
<map>
<entry key="java.util.Date">
<bean class="org.springframework.beans.propertyeditors.CustomDateEditor">
<constructor-arg index="0">
<bean class="java.text.SimpleDateFormat">
<constructor-arg value="dd/MM/yyyy"/>
</bean>
</constructor-arg>
<constructor-arg index="1" value="false"/>
</bean>
</entry>
</map>
</property>
</bean>
</beans>
Vc pode substituir essas declarações de beans por isso:
<context:component-scan base-package="*"/>
E colocar a anotação @Component nas suas classes.
Obrigado pela ajuda.
O problema estava no banco de dados, no momento em que a aplicação se conectava com o banco.
Zerei o banco e refiz ele e agora está funcionando.
valeu ai !!!