jpa - Error associating dependecies betwen EJB and PersistenceUnity on JBoss 7 -
i having problems while starting ejb application on jboss 7 or on eap 6.1 jboss 7.2 while associating dependencies between ejb , persistenceunit.
line log error:
10:07:04,857 error [org.jboss.as.deployment] (deploymentscanner-threads - 1) {"composite operation failed , rolled back. steps failed:" => {"operation step-2" => {"services missing/unavailable dependencies" => ["jboss.deployment.unit.\"crm.war\".component.clientedaobean.start missing [ jboss.naming.context.java.module.crm.crm.\"env/br.com.crm.model.dao.clientedaobean/em\" ]","jboss.persistenceunit.\"crm.war#crmunity\" missing [ jboss.naming.context.java.jboss.datasources/crmds ]","jboss.deployment.unit.\"crm.war\".jndidependencyservice missing [ jboss.naming.context.java.module.crm.crm.\"env/br.com.crm.model.dao.clientedaobean/em\", jboss.naming.context.java.module.crm.crm.\"env/br.com.crm.model.dao.contatodaobean/em\" ]","jboss.deployment.unit.\"crm.war\".component.br/com/crm/model/dao/contatodaoremote.start missing [ jboss.naming.context.java.module.crm.crm.\"env/br.com.crm.model.dao.contatodaobean/em\" ]"]}}}
below, follow xml files , ejb code:
application.xml
<?xml version="1.0" encoding="utf-8"?> <!doctype application public "-//sun microsystems,inc.//dtd j2ee application 1.2//en" "http://java.sun.com/j2ee/dtds/application_1_2.dtd"> <application> <display-name>crm</display-name> <module> <web> <web-uri>crm.war</web-uri> <context-root>crm</context-root> </web> </module> <module> <ejb>crmejb.jar</ejb> </module> </application>
crm-ds.xml
<?xml version="1.0" encoding="utf-8"?> <!-- hypersonic embedded database jca connection factory config $id: hsqldb-ds.xml,v 1.1.2.11 2003/09/28 12:31:36 starksm exp $ --> <datasources> <local-tx-datasource enabled="true" use-java-context="true" pool-name="crmds"> <jndi-name>java:jboss/datasources/crmds</jndi-name> <connection-url>jdbc:hsqldb:file:database/crm</connection-url> <driver>hsqldb.jar</driver> <driver-class>org.hsqldb.jdbcdriver</driver-class> <user-name>sa</user-name> <password></password> </local-tx-datasource> </datasources>
persistence.xml
<?xml version="1.0" encoding="utf-8"?> <persistence version="2.1" xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"> <persistence-unit name="crmunity" transaction-type="jta"> <provider>org.hibernate.ejb.hibernatepersistence</provider> <jta-data-source>java:jboss/datasources/crmds</jta-data-source> <class>br.com.crm.model.entities.cliente</class> <class>br.com.crm.model.entities.contato</class> <properties> <property name="hibernate.dialect" value="org.hibernate.dialect.hsqldialect"/> <property name="hibernate.hbm2ddl.auto" value="update"/> <property name="hibernate.format_sql" value="false" /> <property name="hibernate.show_sql" value="false" /> </properties> </persistence-unit> </persistence>
contatodaobeanremote.java
@remote public interface contatodaoremote { // code }
contatodaobean.java
package br.com.crm.model.dao; /** * @author tarcisio * session bean controlado pelo container para realização de operações sobre * base de dados de contatos de clientes. */ @stateless(name = "br/com/crm/model/dao/contatodaoremote") public class contatodaobean implements contatodaoremote{ @persistenceunit(unitname = "crmunity") private entitymanagerfactory emf; // code }
standalone.xml
<!-- ~ jboss, home of professional open source. ~ copyright 2011, red hat, inc., , individual contributors ~ indicated @author tags. see copyright.txt file in ~ distribution full listing of individual contributors. ~ ~ free software; can redistribute and/or modify ~ under terms of gnu lesser general public license ~ published free software foundation; either version 2.1 of ~ license, or (at option) later version. ~ ~ software distributed in hope useful, ~ without warranty; without implied warranty of ~ merchantability or fitness particular purpose. see gnu ~ lesser general public license more details. ~ ~ should have received copy of gnu lesser general public ~ license along software; if not, write free ~ software foundation, inc., 51 franklin st, fifth floor, boston, ma ~ 02110-1301 usa, or see fsf site: http://www.fsf.org. --> <server xmlns="urn:jboss:domain:1.0"> <extensions> <extension module="org.jboss.as.clustering.infinispan"/> <extension module="org.jboss.as.connector"/> <extension module="org.jboss.as.deployment-scanner"/> <extension module="org.jboss.as.ee"/> <extension module="org.jboss.as.ejb3"/> <extension module="org.jboss.as.jaxrs"/> <extension module="org.jboss.as.jmx"/> <extension module="org.jboss.as.jpa"/> <extension module="org.jboss.as.logging"/> <extension module="org.jboss.as.naming"/> <extension module="org.jboss.as.osgi"/> <extension module="org.jboss.as.remoting"/> <extension module="org.jboss.as.sar"/> <extension module="org.jboss.as.security"/> <extension module="org.jboss.as.threads"/> <extension module="org.jboss.as.transactions"/> <extension module="org.jboss.as.web" /> <extension module="org.jboss.as.weld" /> </extensions> <management> <security-realms> <security-realm name="propertiesmgmtsecurityrealm"> <authentication> <properties path="mgmt-users.properties" relative-to="jboss.server.config.dir" /> </authentication> </security-realm> </security-realms> <management-interfaces> <native-interface interface="management" port="9999" /> <http-interface interface="management" port="9990"/> </management-interfaces> </management> <profile> <subsystem xmlns="urn:jboss:domain:logging:1.0"> <console-handler name="console"> <level name="info"/> <formatter> <pattern-formatter pattern="%d{hh:mm:ss,sss} %-5p [%c] (%t) %s%e%n"/> </formatter> </console-handler> <periodic-rotating-file-handler name="file"> <level name="info"/> <formatter> <pattern-formatter pattern="%d{hh:mm:ss,sss} %-5p [%c] (%t) %s%e%n"/> </formatter> <file relative-to="jboss.server.log.dir" path="server.log"/> <suffix value=".yyyy-mm-dd"/> </periodic-rotating-file-handler> <logger category="com.arjuna"> <level name="warn"/> </logger> <logger category="org.apache.tomcat.util.modeler"> <level name="warn"/> </logger> <logger category="sun.rmi"> <level name="warn"/> </logger> <root-logger> <level name="info"/> <handlers> <handler name="console"/> <handler name="file"/> </handlers> </root-logger> </subsystem> <subsystem xmlns="urn:jboss:domain:datasources:1.0"> <datasources> <datasource jndi-name="java:jboss/datasources/exampleds" enabled="true" use-java-context="true" pool-name="h2ds"> <connection-url>jdbc:h2:mem:test;db_close_delay=-1</connection-url> <driver>h2</driver> <pool></pool> <security> <user-name>sa</user-name> <password>sa</password> </security> <validation></validation> <timeout></timeout> <statement></statement> </datasource> <drivers> <driver name="h2" module="com.h2database.h2"> <xa-datasource-class>org.h2.jdbcx.jdbcdatasource</xa-datasource-class> </driver> </drivers> </datasources> </subsystem> <subsystem xmlns="urn:jboss:domain:deployment-scanner:1.0"> <deployment-scanner scan-interval="5000" relative-to="jboss.server.base.dir" path="deployments" /> </subsystem> <subsystem xmlns="urn:jboss:domain:ee:1.0" /> <subsystem xmlns="urn:jboss:domain:ejb3:1.0" /> <subsystem xmlns="urn:jboss:domain:infinispan:1.0" default-cache-container="hibernate"> <cache-container name="hibernate" default-cache="local-query"> <local-cache name="entity"> <eviction strategy="lru" max-entries="10000"/> <expiration max-idle="100000"/> </local-cache> <local-cache name="local-query"> <eviction strategy="lru" max-entries="10000"/> <expiration max-idle="100000"/> </local-cache> <local-cache name="timestamps"> <eviction strategy="none"/> </local-cache> </cache-container> </subsystem> <subsystem xmlns="urn:jboss:domain:jaxrs:1.0"/> <subsystem xmlns="urn:jboss:domain:jca:1.0"> <archive-validation enabled="false" /> <bean-validation enabled="false" /> <default-workmanager> <short-running-threads blocking="true"> <core-threads count="10" per-cpu="20"/> <queue-length count="10" per-cpu="20"/> <max-threads count="10" per-cpu="20"/> <keepalive-time time="10" unit="seconds"/> </short-running-threads> <long-running-threads blocking="true"> <core-threads count="10" per-cpu="20"/> <queue-length count="10" per-cpu="20"/> <max-threads count="10" per-cpu="20"/> <keepalive-time time="10" unit="seconds"/> </long-running-threads> </default-workmanager> </subsystem> <subsystem xmlns="urn:jboss:domain:jmx:1.0"> <jmx-connector registry-binding="jmx-connector-registry" server-binding="jmx-connector-server" /> </subsystem> <subsystem xmlns="urn:jboss:domain:jpa:1.0"> <jpa default-datasource=""/> </subsystem> <subsystem xmlns="urn:jboss:domain:naming:1.0" /> <subsystem xmlns="urn:jboss:domain:osgi:1.0" activation="lazy"> <configuration pid="org.apache.felix.webconsole.internal.servlet.osgimanager"> <property name="manager.root">jboss-osgi</property> </configuration> <properties> <!-- comma seperated list of module identifiers. each system module added dependency osgi framework module. packages these system modules can made visible framework system packages. http://www.osgi.org/javadoc/r4v42/org/osgi/framework/constants.html#framework_systempackages_extra --> <property name="org.jboss.osgi.system.modules"> org.apache.commons.logging, org.apache.log4j, org.jboss.as.osgi, org.slf4j, </property> <!-- framework environment property identifying packages system bundle must export current execution environment --> <property name="org.osgi.framework.system.packages.extra"> org.apache.commons.logging;version=1.1.1, org.apache.log4j;version=1.2, org.jboss.as.osgi.service;version=7.0, org.jboss.osgi.deployment.interceptor;version=1.0, org.jboss.osgi.spi.capability;version=1.0, org.jboss.osgi.spi.util;version=1.0, org.jboss.osgi.testing;version=1.0, org.jboss.osgi.vfs;version=1.0, org.slf4j;version=1.5.10, </property> <!-- specifies beginning start level of framework --> <property name="org.osgi.framework.startlevel.beginning">1</property> </properties> <modules> <!-- modules registered osgi layer on startup --> <module identifier="javaee.api"/> <module identifier="org.jboss.logging"/> <!-- bundles installed on startup --> <module identifier="org.apache.aries.util"/> <module identifier="org.jboss.osgi.webconsole"/> <module identifier="org.osgi.compendium"/> <!-- bundles started in startlevel 1 --> <module identifier="org.apache.felix.log" startlevel="1"/> <module identifier="org.jboss.osgi.logging" startlevel="1"/> <module identifier="org.apache.felix.configadmin" startlevel="1"/> <module identifier="org.jboss.as.osgi.configadmin" startlevel="1"/> <!-- bundles started in startlevel 2 --> <module identifier="org.apache.aries.jmx" startlevel="2"/> <module identifier="org.apache.felix.eventadmin" startlevel="2"/> <module identifier="org.apache.felix.metatype" startlevel="2"/> <module identifier="org.apache.felix.scr" startlevel="2"/> <module identifier="org.apache.felix.webconsole" startlevel="2"/> <module identifier="org.jboss.osgi.jmx" startlevel="2"/> <module identifier="org.jboss.osgi.http" startlevel="2"/> <!-- bundles started in startlevel 3 --> <module identifier="org.jboss.osgi.blueprint" startlevel="3"/> <module identifier="org.jboss.osgi.webapp" startlevel="3"/> <module identifier="org.jboss.osgi.xerces" startlevel="3"/> </modules> </subsystem> <subsystem xmlns="urn:jboss:domain:remoting:1.0"/> <subsystem xmlns="urn:jboss:domain:resource-adapters:1.0" /> <subsystem xmlns="urn:jboss:domain:sar:1.0"/> <subsystem xmlns="urn:jboss:domain:security:1.0"> <security-domains> <security-domain name="other" cache-type="default"> <authentication> <login-module code="usersroles" flag="required"/> </authentication> </security-domain> </security-domains> </subsystem> <subsystem xmlns="urn:jboss:domain:threads:1.0"/> <subsystem xmlns="urn:jboss:domain:transactions:1.0"> <recovery-environment socket-binding="txn-recovery-environment" status-socket-binding="txn-status-manager"/> <core-environment> <process-id> <uuid /> </process-id> </core-environment> <coordinator-environment default-timeout="300"/> </subsystem> <subsystem xmlns="urn:jboss:domain:web:1.0" default-virtual-server="default-host"> <connector name="http" scheme="http" protocol="http/1.1" socket-binding="http"/> <virtual-server name="default-host" enable-welcome-root="true"> <alias name="localhost" /> <alias name="example.com" /> </virtual-server> </subsystem> <subsystem xmlns="urn:jboss:domain:weld:1.0" /> </profile> <interfaces> <interface name="management"> <inet-address value="127.0.0.1"/> </interface> <interface name="public"> <inet-address value="127.0.0.1"/> </interface> </interfaces> <socket-binding-group name="standard-sockets" default-interface="public"> <socket-binding name="http" port="8080"/> <socket-binding name="https" port="8443"/> <socket-binding name="jmx-connector-registry" port="1090"/> <socket-binding name="jmx-connector-server" port="1091"/> <socket-binding name="jndi" port="1099"/> <socket-binding name="osgi-http" port="8090"/> <socket-binding name="remoting" port="4447"/> <socket-binding name="txn-recovery-environment" port="4712"/> <socket-binding name="txn-status-manager" port="4713"/> </socket-binding-group> </server>
project technologies:
embedded hsqdb database version 2.2.3
ejb 3
jpa 2.1
hibernate 3 providing jpa persistence
can me solve dependencies problem?
thank in advance.
it perfect, if place alias datasource in ear, , config them in standalone.xml: got database independent distributive in ideal case. try insert block in standalone.xml (i took parameters crm-ds.xml):
<subsystem xmlns="urn:jboss:domain:datasources:1.1"> <datasources> <datasource jta="false" jndi-name="java:jboss/datasources/crmds" pool-name="crmds" enabled="true" use-ccm="false"> <connection-url>jdbc:hsqldb:file:database/crm</connection-url> <driver-class>org.h2.driver</driver-class> <driver>h2</driver> <security> <user-name>sa</user-name> </security> <validation> <validate-on-match>false</validate-on-match> <background-validation>false</background-validation> </validation> <statement> <share-prepared-statements>false</share-prepared-statements> </statement> </datasource> <drivers> <driver name="h2" module="com.h2database.h2"> <xa-datasource-class>org.h2.jdbcx.jdbcdatasource</xa-datasource-class> </driver> </drivers> </datasources> </subsystem>
version of subsystem may server specific.
Comments
Post a Comment