Witam,
próbuję zdeployować małą aplikację w EJB3.0 na JBOSSie 5.1.0.GA. Jako IDE używam Intellij IDEA 9. IDE zintegrowałem z ANTem i JBOSSem. Baza danych Oracle 10g Express Edition.
persistence.xml
<persistence 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"
version="1.0">
<persistence-unit name="titan" transaction-type="JTA">
<!--<provider>oracle.toplink.essentials.PersistenceProvider</provider>-->
<provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
<jta-data-source>
jdbc/OracleDs
</jta-data-source>
<properties>
<property name="toplink.logging.level" value="INFO"/>
<property name="toplink.jdbc.driver" value="oracle.jdbc.OracleDriver"/> <!-- update to match database-->
<property name="toplink.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:xe"/> <!-- update to match database-->
<property name="toplink.jdbc.password" value="hr"/> <!-- update to match database-->
<property name="toplink.jdbc.user" value="hr"/> <!-- update to match database-->
</properties>
</persistence-unit>
</persistence>
oracle-ds.xml - c:\jboss-home\server\default\deploy\
<datasources>
<local-tx-datasource>
<!-- The jndi name of the DataSource, it is prefixed with java:/ -->
<!-- Datasources are not available outside the virtual machine -->
<jndi-name>jdbc/OracleDS</jndi-name>
<connection-url>jdbc:oracle:thin:@localhost:1521:XE</connection-url>
<!-- The driver class -->
<driver-class>oracle.jdbc.driver.OracleDriver</driver-class>
<exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.OracleExceptionSorter
</exception-sorter-class-name>
</local-tx-datasource>
</datasources>
package com.titan.entity;
import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
/**
* Created by IntelliJ IDEA.
* User: andrzej
* Date: 2010-08-07
* Time: 10:26:19
* To change this template use File | Settings | File Templates.
*/
@Entity
@Table(name="EMPLOYEES")
public class Employees implements Serializable {
@Id
@Column(name = "EMPLOYEE_ID")
private int employeeId;
@Column(name="FIRST_NAME")
private String firstName;
@Column(name="LAST_NAME")
private String lastName;
@Column(name="EMAIL")
private String email;
@Column(name="PHONE_NUMBER")
private int phoneNumber;
@Column(name="HIRE_DATE")
private Date hireDate;
@Column(name="JOB_ID")
private String jobId;
@Column(name="SALARY")
private int salary;
@Column(name="COMMISION_PCT")
private int commimsionPct;
@Column(name="MANAGER_ID")
private int managerId;
@Column(name="DEPARTMENT_ID")
private int departmentId;
public int getEmployeeId() {
return employeeId;
}
public void setEmployeeId(int employeeId) {
this.employeeId = employeeId;
}
public String getFirstName() {
return firstName;
}
public void setFirstName(String firstName) {
this.firstName = firstName;
}
public String getLastName() {
return lastName;
}
public void setLastName(String lastName) {
this.lastName = lastName;
}
public String getEmail() {
return email;
}
public void setEmail(String email) {
this.email = email;
}
public int getPhoneNumber() {
return phoneNumber;
}
public void setPhoneNumber(int phoneNumber) {
this.phoneNumber = phoneNumber;
}
public Date getHireDate() {
return hireDate;
}
public void setHireDate(Date hireDate) {
this.hireDate = hireDate;
}
public String getJobId() {
return jobId;
}
public void setJobId(String jobId) {
this.jobId = jobId;
}
public int getSalary() {
return salary;
}
public void setSalary(int salary) {
this.salary = salary;
}
public int getCommimsionPct() {
return commimsionPct;
}
public void setCommimsionPct(int commimsionPct) {
this.commimsionPct = commimsionPct;
}
public int getManagerId() {
return managerId;
}
public void setManagerId(int managerId) {
this.managerId = managerId;
}
public int getDepartmentId() {
return departmentId;
}
public void setDepartmentId(int departmentId) {
this.departmentId = departmentId;
}
}
package com.titan.session;
/**
* Created by IntelliJ IDEA.
* User: andrzej
* Date: 2010-08-07
* Time: 10:53:29
* To change this template use File | Settings | File Templates.
*/
import com.titan.entity.Employees;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@Stateless
public class TravelAgentBean implements TravelAgentRemote {
@PersistenceContext (unitName="titan")
private EntityManager em;
public void createEmployee(Employees employee){
em.persist(employee);
}
public Employees findEmployee(int pKey){
return em.find(Employees.class, pKey);
}
}
package com.titan.session;
/**
* Created by IntelliJ IDEA.
* User: andrzej
* Date: 2010-08-07
* Time: 10:44:47
* To change this template use File | Settings | File Templates.
*/
import com.titan.entity.Employees;
import javax.ejb.Remote;
@Remote
public interface TravelAgentRemote {
public void createEmployee(Employees employee);
public Employees findEmployee(int id);
}
Dosteję błąd:
Connected to server
[2010-08-13 09:57:41,052] Artifact titanEJB: Artifact is being deployed, please wait...
09:57:41,077 WARN [MainDeployer] undeploy 'file:/D:/projekty/java/titancruises/out/artifacts/titanEJB/titanEJB.jar' : package not deployed
09:57:41,122 INFO [MainDeployer] deploy, url=file:/D:/projekty/java/titancruises/out/artifacts/titanEJB/titanEJB.jar
09:57:41,343 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@1911412896{vfszip:/D:/projekty/java/titancruises/out/artifacts/titanEJB/titanEJB.jar/}
09:57:41,351 INFO [Ejb3DependenciesDeployer] Encountered deployment AbstractVFSDeploymentContext@1911412896{vfszip:/D:/projekty/java/titancruises/out/artifacts/titanEJB/titanEJB.jar/}
09:57:41,420 INFO [JBossASKernel] Created KernelDeployment for: titanEJB.jar
09:57:41,420 INFO [JBossASKernel] installing bean: jboss.j2ee:jar=titanEJB.jar,name=TravelAgentBean,service=EJB3
09:57:41,420 INFO [JBossASKernel] with dependencies:
09:57:41,421 INFO [JBossASKernel] and demands:
09:57:41,421 INFO [JBossASKernel] persistence.unit:unitName=#titan
09:57:41,421 INFO [JBossASKernel] jboss.ejb:service=EJBTimerService
09:57:41,421 INFO [JBossASKernel] and supplies:
09:57:41,421 INFO [JBossASKernel] jndi:TravelAgentBean/remote
09:57:41,421 INFO [JBossASKernel] Class:com.titan.session.TravelAgentRemote
09:57:41,421 INFO [JBossASKernel] jndi:TravelAgentBean/remote-com.titan.session.TravelAgentRemote
09:57:41,421 INFO [JBossASKernel] Added bean(jboss.j2ee:jar=titanEJB.jar,name=TravelAgentBean,service=EJB3) to KernelDeployment of: titanEJB.jar
09:57:41,422 INFO [EJB3EndpointDeployer] Deploy AbstractBeanMetaData@161c2721{name=jboss.j2ee:jar=titanEJB.jar,name=TravelAgentBean,service=EJB3_endpoint bean=org.jboss.ejb3.endpoint.deployers.impl.EndpointImpl properties=[container] constructor=null autowireCandidate=true}
09:57:41,535 WARN [MainDeployer] Failed to deploy: file:/D:/projekty/java/titancruises/out/artifacts/titanEJB/titanEJB.jar
org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss.j2ee:jar=titanEJB.jar,name=TravelAgentBean,service=EJB3" is missing the following dependencies:
Dependency "<UNKNOWN jboss.j2ee:jar=titanEJB.jar,name=TravelAgentBean,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=#titan' **")
Deployment "jboss.j2ee:jar=titanEJB.jar,name=TravelAgentBean,service=EJB3_endpoint" is missing the following dependencies:
Dependency "jboss.j2ee:jar=titanEJB.jar,name=TravelAgentBean,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall")
Deployment "persistence.unit:unitName=#titan" is missing the following dependencies:
Dependency "jboss.jca:name=
jdbc/OracleDs
,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=
jdbc/OracleDs
,service=DataSourceBinding' **")
DEPLOYMENTS IN ERROR:
Deployment "jboss.jca:name=
jdbc/OracleDs
,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=
jdbc/OracleDs
,service=DataSourceBinding' **
Deployment "<UNKNOWN jboss.j2ee:jar=titanEJB.jar,name=TravelAgentBean,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=#titan' **
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:993)
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:939)
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:873)
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:862)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:833)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:263)
at sun.reflect.GeneratedMethodAccessor261.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:138)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:140)
at org.jboss.jmx.connector.invoker.SerializableInterceptor.invoke(SerializableInterceptor.java:74)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:180)
at sun.reflect.GeneratedMethodAccessor260.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:855)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:422)
at sun.reflect.GeneratedMethodAccessor259.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
org.jboss.deployment.DeploymentException: Failed to deploy: file:/D:/projekty/java/titancruises/out/artifacts/titanEJB/titanEJB.jar
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:838)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.jmx.connector.invoker.InvokerAdaptorService.invoke(InvokerAdaptorService.java:263)
at sun.reflect.GeneratedMethodAccessor261.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.interceptor.AbstractInterceptor.invoke(AbstractInterceptor.java:138)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
at org.jboss.mx.interceptor.ModelMBeanOperationInterceptor.invoke(ModelMBeanOperationInterceptor.java:140)
at org.jboss.jmx.connector.invoker.SerializableInterceptor.invoke(SerializableInterceptor.java:74)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:180)
at sun.reflect.GeneratedMethodAccessor260.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:855)
at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:422)
at sun.reflect.GeneratedMethodAccessor259.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:305)
at sun.rmi.transport.Transport$1.run(Transport.java:159)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:155)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:535)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:790)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:649)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.jboss.deployers.client.spi.IncompleteDeploymentException: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
DEPLOYMENTS MISSING DEPENDENCIES:
Deployment "jboss.j2ee:jar=titanEJB.jar,name=TravelAgentBean,service=EJB3" is missing the following dependencies:
Dependency "<UNKNOWN jboss.j2ee:jar=titanEJB.jar,name=TravelAgentBean,service=EJB3>" (should be in state "Described", but is actually in state "** UNRESOLVED Demands 'persistence.unit:unitName=#titan' **")
Deployment "jboss.j2ee:jar=titanEJB.jar,name=TravelAgentBean,service=EJB3_endpoint" is missing the following dependencies:
Dependency "jboss.j2ee:jar=titanEJB.jar,name=TravelAgentBean,service=EJB3" (should be in state "Configured", but is actually in state "PreInstall")
Deployment "persistence.unit:unitName=#titan" is missing the following dependencies:
Dependency "jboss.jca:name=
jdbc/OracleDs
,service=DataSourceBinding" (should be in state "Create", but is actually in state "** NOT FOUND Depends on 'jboss.jca:name=
jdbc/OracleDs
,service=DataSourceBinding' **")
DEPLOYMENTS IN ERROR:
Deployment "jboss.jca:name=
jdbc/OracleDs
,service=DataSourceBinding" is in error due to the following reason(s): ** NOT FOUND Depends on 'jboss.jca:name=
jdbc/OracleDs
,service=DataSourceBinding' **
Deployment "<UNKNOWN jboss.j2ee:jar=titanEJB.jar,name=TravelAgentBean,service=EJB3>" is in error due to the following reason(s): ** UNRESOLVED Demands 'persistence.unit:unitName=#titan' **
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:993)
at org.jboss.deployers.plugins.deployers.DeployersImpl.checkComplete(DeployersImpl.java:939)
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:873)
at org.jboss.deployers.plugins.main.MainDeployerImpl.checkComplete(MainDeployerImpl.java:862)
at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:833)
... 50 more
[2010-08-13 09:57:41,630] Artifact titanEJB: Error during artifact deployment. See server log for details.
ojdbc6.jar, toplink-essencial.jar oraz toplink-essencial-agent umieściłem w katalogy c:\jboss-home\lib
Ant generuje JARa w katalogu \artifacts następnie przy starcie JBossa.
Środowisko Windows 7-64 - Java 1.6 - 64
Niewiem czy dobrze konfiguruję sterownik.