jboss部署问题
ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):
*** CONTEXTS MISSING DEPENDENCIES: Name -> Dependency{Required State:Actual State}
jboss.j2ee:jar=myjpa.jar,name=CustomerService,service=EJB3
-> <UNKNOWN jboss.j2ee:jar=myjpa.jar,name=CustomerService,service=EJB3>{Described:** UNRESOLVED Demands 'persistence.unit:unitName=#japdemo' **}
persistence.unit:unitName=#japdemo
-> jboss.jca:name=,service=DataSourceBinding{Create:** NOT FOUND Depends on 'jboss.jca:name=,service=DataSourceBinding' **}
*** CONTEXTS IN ERROR: Name -> Error
jboss.jca:name=,service=DataSourceBinding -> ** NOT FOUND Depends on 'jboss.jca:name=,service=DataSourceBinding' **
<UNKNOWN jboss.j2ee:jar=myjpa.jar,name=CustomerService,service=EJB3> -> ** UNRESOLVED Demands 'persistence.unit:unitName=#japdemo' **
package com.jpa.service;
import java.util.List;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import com.jpa.vo.Customer;
@Stateless
public class CustomerService implements ICustomerService {
@PersistenceContext(unitName="japdemo")
private EntityManager entityManager;
public void save(Customer customer) {
entityManager.persist(customer);
}
public void delete(Integer id) {
Customer customer=this.findById(id);
entityManager.remove(customer);
}
public Customer update(Customer customer) {
Customer ct=entityManager.merge(customer);
return ct;
}
public Customer findById(Integer id) {
Customer c=entityManager.find(Customer.class, id);
return c;
}
public List<Customer> findAll() {
return entityManager.createQuery("from Customer").getResultList();
}
}
package com.jpa.service;
import java.util.List;
import javax.ejb.Remote;
import com.jpa.vo.Customer;
@Remote
public interface ICustomerService {
void save(Customer customer);
void delete(Integer id);
Customer update(Customer customer);
Customer findById(Integer id);
List<Customer> findAll();
}
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.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_2_0.xsd">
<persistence-unit name="japdemo" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistece</provider>
<non-jta-data-source></non-jta-data-source>
<class>com.jpa.vo.Customer</class>
<properties>
<property name="hibernate.connection.driver_class" value="oracle.jdbc.driver.OracleDriver"/>
<property name="hibernate.connection.url" value="jdbc:oracle:thin:@localhost[:1521:orcl"></property>
<property name="hibernate.connection.username" value="system"></property>
<property name="hibernate.connection.password" value="orcl"></property>
<property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9Dialect"/>
<property name="hibernate.hbm2dll.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>