ebarros 4 de mar. de 2009
Isso nao tem sentido, provavelmente seja algum erro nos seus arquivos de configurações, o mais provável eh q o seu arquivo hibernate.cfg.xml nao esteja configurado corretamente, posta ele ai para podermos analisar.
apalmeira 4 de mar. de 2009
Olá,
Segue o persistence.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version= "1.0"
xmlns= "http://java.sun.com/xml/ns/persistence"
xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation= "http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd" >
<persistence-unit name= "JayBird"
transaction-type= "RESOURCE_LOCAL" >
<provider> org.hibernate.ejb.HibernatePersistence</provider>
<class> Modelo.Usuario</class>
<class> Modelo.Departamento</class>
<class> Modelo.Permissao</class>
<class> Modelo.UnidadeOperacional</class>
<class> Modelo.Tela</class>
<properties>
<property name= "hibernate.dialect"
value= "org.hibernate.dialect.FirebirdDialect" />
<property name= "hibernate.connection.username" value= "SYSDBA" />
<property name= "hibernate.connection.driver_class"
value= "org.firebirdsql.jdbc.FBDriver" />
<property name= "hibernate.connection.password" value= "masterkey" />
<property name= "hibernate.connection.url"
value= "jdbc:firebirdsql:127.0.0.1:lpcti" />
<property name= "hibernate.cache.provider_class"
value= "org.hibernate.cache.NoCacheProvider" />
</properties>
</persistence-unit>
</persistence>
Esse é o erro, lembrando que com o Jboss 4.3 o problema nao ocorre:
11 : 38 : 35 , 331 INFO [ ConnectionFactoryBindingService ] Bound ConnectionManager 'jboss.jca:service=ConnectionFactoryBinding,name=JmsXA' to JNDI name 'java:JmsXA'
11 : 38 : 35 , 378 INFO [ PersistenceUnitDeployment ] Starting persistence unit persistence . unit : unitName = #JayBird
11 : 38 : 35 , 409 ERROR [ AbstractKernelController ] Error installing to Start : name = persistence . unit : unitName = #JayBird state=Create
java . lang . RuntimeException : Specification violation [ EJB3 JPA 6.2 . 1.2 ] - You have not defined a non - jta - data - source for a RESOURCE_LOCAL enabled persistence context named : JayBird
at org . jboss . jpa . deployment . PersistenceUnitInfoImpl .< init > ( PersistenceUnitInfoImpl . java : 124 )
at org . jboss . jpa . deployment . PersistenceUnitDeployment . start ( PersistenceUnitDeployment . java : 285 )
at sun . reflect . NativeMethodAccessorImpl . invoke0 ( Native Method )
at sun . reflect . NativeMethodAccessorImpl . invoke ( Unknown Source )
at sun . reflect . DelegatingMethodAccessorImpl . invoke ( Unknown Source )
at java . lang . reflect . Method . invoke ( Unknown Source )
at org . jboss . reflect . plugins . introspection . ReflectionUtils . invoke ( ReflectionUtils . java : 59 )
at org . jboss . reflect . plugins . introspection . ReflectMethodInfoImpl . invoke ( ReflectMethodInfoImpl . java : 150 )
at org . jboss . joinpoint . plugins . BasicMethodJoinPoint . dispatch ( BasicMethodJoinPoint . java : 66 )
at org . jboss . kernel . plugins . dependency . KernelControllerContextAction $ JoinpointDispatchWrapper . execute ( KernelControllerContextAction . java : 241 )
at org . jboss . kernel . plugins . dependency . ExecutionWrapper . execute ( ExecutionWrapper . java : 47 )
at org . jboss . kernel . plugins . dependency . KernelControllerContextAction . dispatchExecutionWrapper ( KernelControllerContextAction . java : 109 )
at org . jboss . kernel . plugins . dependency . KernelControllerContextAction . dispatchJoinPoint ( KernelControllerContextAction . java : 70 )
at org . jboss . kernel . plugins . dependency . LifecycleAction . installActionInternal ( LifecycleAction . java : 221 )
at org . jboss . kernel . plugins . dependency . InstallsAwareAction . installAction ( InstallsAwareAction . java : 54 )
at org . jboss . kernel . plugins . dependency . InstallsAwareAction . installAction ( InstallsAwareAction . java : 42 )
at org . jboss . dependency . plugins . action . SimpleControllerContextAction . simpleInstallAction ( SimpleControllerContextAction . java : 62 )
at org . jboss . dependency . plugins . action . AccessControllerContextAction . install ( AccessControllerContextAction . java : 71 )
at org . jboss . dependency . plugins . AbstractControllerContextActions . install ( AbstractControllerContextActions . java : 51 )
at org . jboss . dependency . plugins . AbstractControllerContext . install ( AbstractControllerContext . java : 348 )
at org . jboss . dependency . plugins . AbstractController . install ( AbstractController . java : 1598 )
at org . jboss . dependency . plugins . AbstractController . incrementState ( AbstractController . java : 934 )
at org . jboss . dependency . plugins . AbstractController . resolveContexts ( AbstractController . java : 1062 )
at org . jboss . dependency . plugins . AbstractController . resolveContexts ( AbstractController . java : 984 )
at org . jboss . dependency . plugins . AbstractController . install ( AbstractController . java : 774 )
at org . jboss . dependency . plugins . AbstractController . install ( AbstractController . java : 540 )
at org . jboss . deployers . vfs . deployer . kernel . BeanMetaDataDeployer . deploy ( BeanMetaDataDeployer . java : 121 )
at org . jboss . deployers . vfs . deployer . kernel . BeanMetaDataDeployer . deploy ( BeanMetaDataDeployer . java : 51 )
at org . jboss . deployers . spi . deployer . helpers . AbstractSimpleRealDeployer . internalDeploy ( AbstractSimpleRealDeployer . java : 62 )
at org . jboss . deployers . spi . deployer . helpers . AbstractRealDeployer . deploy ( AbstractRealDeployer . java : 50 )
at org . jboss . deployers . plugins . deployers . DeployerWrapper . deploy ( DeployerWrapper . java : 171 )
at org . jboss . deployers . plugins . deployers . DeployersImpl . doDeploy ( DeployersImpl . java : 1439 )
at org . jboss . deployers . plugins . deployers . DeployersImpl . doInstallParentFirst ( DeployersImpl . java : 1157 )
at org . jboss . deployers . plugins . deployers . DeployersImpl . doInstallParentFirst ( DeployersImpl . java : 1178 )
at org . jboss . deployers . plugins . deployers . DeployersImpl . install ( DeployersImpl . java : 1098 )
at org . jboss . dependency . plugins . AbstractControllerContext . install ( AbstractControllerContext . java : 348 )
at org . jboss . dependency . plugins . AbstractController . install ( AbstractController . java : 1598 )
at org . jboss . dependency . plugins . AbstractController . incrementState ( AbstractController . java : 934 )
at org . jboss . dependency . plugins . AbstractController . resolveContexts ( AbstractController . java : 1062 )
at org . jboss . dependency . plugins . AbstractController . resolveContexts ( AbstractController . java : 984 )
at org . jboss . dependency . plugins . AbstractController . change ( AbstractController . java : 822 )
at org . jboss . dependency . plugins . AbstractController . change ( AbstractController . java : 553 )
at org . jboss . deployers . plugins . deployers . DeployersImpl . process ( DeployersImpl . java : 781 )
at org . jboss . deployers . plugins . main . MainDeployerImpl . process ( MainDeployerImpl . java : 545 )
at org . jboss . system . server . profileservice . ProfileServiceBootstrap . loadProfile ( ProfileServiceBootstrap . java : 304 )
at org . jboss . system . server . profileservice . ProfileServiceBootstrap . start ( ProfileServiceBootstrap . java : 205 )
at org . jboss . bootstrap . AbstractServerImpl . start ( AbstractServerImpl . java : 405 )
at org . jboss . Main . boot ( Main . java : 209 )
at org . jboss . Main $ 1. run ( Main . java : 547 )
at java . lang . Thread . run ( Unknown Source )
11 : 38 : 35 , 440 INFO [ TomcatDeployment ] deploy , ctxPath =/ JCom , vfsUrl = JCom . war
11 : 38 : 35 , 597 WARN [ config ] JSF1059 : WARNING ! The com . sun . faces . verifyObjects feature is to aid developers not using tools . It shouldn '' t be enabled if using an IDE , or if this application is being deployed for production as it will impact application start times .
11 : 38 : 39 , 924 INFO [ CacheManager ] Selected [ org . ajax4jsf . cache . LRUMapCacheFactory ] cache factory
11 : 38 : 39 , 924 INFO [ LRUMapCacheFactory ] Creating LRUMap cache instance using parameters : { facelets . DEVELOPMENT = true , com . sun . faces . duplicateJARPattern =^ tmp \d + ( \S * \. jar ), com . sun . faces . injectionProvider = org . jboss . web . jsf . integration . injection . JBossDelegatingInjectionProvider , com . sun . faces . validateXml = true , facelets . REFRESH_PERIOD = 2 , com . sun . faces . verifyObjects = true , org . ajax4jsf . SKIN = classic , javax . faces . STATE_SAVING_METHOD = client , javax . faces . DEFAULT_SUFFIX =. xhtml }
11 : 38 : 39 , 924 INFO [ LRUMapCacheFactory ] Creating LRUMap cache instance of default capacity
11 : 38 : 39 , 971 INFO [ CacheManager ] Selected [ org . ajax4jsf . cache . LRUMapCacheFactory ] cache factory
11 : 38 : 39 , 971 INFO [ LRUMapCacheFactory ] Creating LRUMap cache instance using parameters : { facelets . DEVELOPMENT = true , com . sun . faces . duplicateJARPattern =^ tmp \d + ( \S * \. jar ), com . sun . faces . injectionProvider = org . jboss . web . jsf . integration . injection . JBossDelegatingInjectionProvider , com . sun . faces . validateXml = true , facelets . REFRESH_PERIOD = 2 , com . sun . faces . verifyObjects = true , org . ajax4jsf . SKIN = classic , javax . faces . STATE_SAVING_METHOD = client , javax . faces . DEFAULT_SUFFIX =. xhtml }
11 : 38 : 39 , 971 INFO [ LRUMapCacheFactory ] Creating LRUMap cache instance of default capacity
apalmeira 4 de mar. de 2009
Alguem sabe como resolver esse problema?
apalmeira 5 de mar. de 2009
Por favor,
Alguém sabe como resolver isso?
Grato.
Jair_Rillo_Junior 5 de mar. de 2009
# 11:38:35,409 ERROR [AbstractKernelController] Error installing to Start: name=persistence.unit:unitName=#JayBird state=Create
java.lang.RuntimeException: Specification violation [EJB3 JPA 6.2.1.2] - You have not defined a non-jta-data-source for a RESOURCE_LOCAL enabled persistence context named: JayBird
Eu não testei o JBoss 5 ainda e portanto, não passei por esse problema.
Mas uma simples busca no google me levou para um JIRA aberto: https://jira.jboss.org/jira/browse/EJBTHREE-1730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12453872#action_12453872
O melhor de tudo que no final parece tem a solução para o problema
apalmeira 5 de mar. de 2009
Infelizmente nao deu certo!
bruno.rossetto 6 de mar. de 2009
Olá apalmeira,
edite o arquivo $JBOSS_HOME/server/default/deployers/ejb3.deployer/META-INF/jpa-deployers-jboss-beans.xml
comentando ou excluindo os seguintes trechos de código:
<!-- <bean name="PersistenceParsingDeployer" class="org.jboss.jpa.deployers.PersistenceParsingDeployer"/>-->
<!-- <bean name="PersistenceDeployer" class="org.jboss.jpa.deployers.PersistenceDeployer"/>-->
<!-- <bean name="PersistenceUnitDeployer" class="org.jboss.jpa.deployers.PersistenceUnitDeployer">
<property name="defaultPersistenceProperties">
<map keyClass="java.lang.String" valueClass="java.lang.String">
<entry>
<key>hibernate.transaction.manager_lookup_class</key>
<value>org.hibernate.transaction.JBossTransactionManagerLookup</value>
</entry>
<!- -entry>
<key>hibernate.connection.release_mode</key>
<value>after_statement</value>
</entry- ->
<!- -entry>
<key>hibernate.transaction.flush_before_completion</key>
<value>false</value>
</entry- >
<!- -entry>
<key>hibernate.transaction.auto_close_session</key>
<value>false</value>
</entry- ->
<!- -entry>
<key>hibernate.query.factory_class</key>
<value>org.hibernate.hql.ast.ASTQueryTranslatorFactory</value>
</entry- ->
<!- -entry>
<key>hibernate.hbm2ddl.auto</key>
<value>create-drop</value>
</entry- ->
<entry>
<key>hibernate.cache.provider_class</key>
<value>org.hibernate.cache.HashtableCacheProvider</value>
</entry>
<!- - Clustered cache with JBoss Cache - ->
<!- -entry>
<key>hibernate.cache.region.factory_class</key>
<value>org.hibernate.cache.jbc2.JndiMultiplexedJBossCacheRegionFactory</value>
</entry>
<entry>
<key>hibernate.cache.region.jbc2.cachefactory</key>
<value>java:CacheManager</value>
</entry>
<entry>
<key>hibernate.cache.region.jbc2.cfg.entity</key>
<value>pessimistic-entity</value>
</entry>
<entry>
<key>hibernate.cache.region.jbc2.cfg.query</key>
<value>local-query</value>
</entry- ->
<!- -entry>
<key>hibernate.dialect</key>
<value>org.hibernate.dialect.HSQLDialect</value>
</entry- ->
<entry>
<key>hibernate.jndi.java.naming.factory.initial</key>
<value>org.jnp.interfaces.NamingContextFactory</value>
</entry>
<entry>
<key>hibernate.jndi.java.naming.factory.url.pkgs</key>
<value>org.jboss.naming:org.jnp.interfaces</value>
</entry>
<entry>
<key>hibernate.bytecode.use_reflection_optimizer</key>
<value>false</value>
</entry>
<!- - I don't think this is honored, but EJB3Deployer uses it - ->
<entry>
<key>hibernate.bytecode.provider</key>
<value>javassist</value>
</entry>
</map>
</property>
</bean>
-->
Obs.: Caso comente, tome cuidado com os comentários que já existem pois poderão entrar em conflito com seu comentário geral.
Segui conforme a referência[1] que o Jair passou no Fórum e aqui funcionou legal. Dê mais uma olhada pois a informação está ok.
Parou de funcionar pois o JBossAS5 segue mais a risca a spec.
6.2.1.2 transaction-type
The transaction-type attribute is used to specify whether the entity managers provided by the
entity manager factory for the persistence unit must be JTA entity managers or resource-local entity
managers. The value of this element is JTA or RESOURCE_LOCAL. A transaction-type of JTA
assumes that a JTA data source will be provided?either as specified by the jta-data-source ele-
ment or provided by the container. In general, in Java EE environments, a transaction-type of
RESOURCE_LOCAL assumes that a non-JTA datasource will be provided. In a Java EE environment, if
this element is not specified, the default is JTA. In a Java SE environment, if this element is not speci-
fied, a default of RESOURCE_LOCAL may be assumed.
O ideal seria vc criar um datasource para ser utilizado pela sua aplicação, fazendo com que as conexões sejam gerenciadas pelo próprio Application Server.
Veja referência [2] . Você pode obter exemplos de datasource no JBoss em $JBOSS_HOME/docs/examples/jca. Basicamente copie um -ds.xml de lá e customize conforme suas necessidades. A referência 3 mostra como configurar o persistence.xml com o novo datasource.
Referências:
[1] https://jira.jboss.org/jira/browse/EJBTHREE-1730?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12453872#action_12453872
[2] http://www.jboss.org/community/docs/DOC-9328
[3] http://www.hibernate.org/hib_docs/entitymanager/reference/en/html/configuration.html
Espero ter ajudado.
[]s,
Bruno Rossetto
http://brmachado.blogspot.com/
apalmeira 11 de mar. de 2009