0
我正在開發openshift上的第一個應用程序,它是一個具有數據庫連接性的jsf應用程序 當我嘗試在沒有jpa的所有jsf xhtml頁面上運行時,我插入一個bean來訪問數據庫我有來自服務器的消息「失敗的部署./ROOT.waer。正是當我插入這個代碼不順心的事:Openshift應用程序和ejb「失敗的部署./ROOT.war
的觀點意圖類
@ManagedBean(name="utnavctrl" ,eager=true)
@SessionScoped
public class Utnavctrl {
boolean newrecord=false;
@EJB
private Usersdao usersdao;
public Utnavctrl(){
一個bean類DB連接
@Stateless
@LocalBean
public class Usersdao {
@PersistenceContext(unitName = "primary")
private EntityManager em;
public Usersdao() {
// TODO Auto-generated constructor stub
}
public List<User> getAllUsers() {
return em.createNamedQuery("User.findAll", User.class)
.getResultList();
}
我不明白爲什麼加這兩個課後(沒有修改視圖xhtml ecc)程序不再工作。
的persince.xml是
<?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="primary">
<!-- If you are running in a production environment, add a managed
data source, this example data source is just for development and testing! -->
<!-- The datasource is deployed as WEB-INF/kitchensink-quickstart-ds.xml, you
can find it in the source at src/main/webapp/WEB-INF/kitchensink-quickstart-ds.xml -->
<jta-data-source>java:jboss/datasources/MySQLDS</jta-data-source>
<class>com.antoiovi.gestcars.model.Automobili</class>
<class>com.antoiovi.gestcars.model.Group</class>
<class>com.antoiovi.gestcars.model.Prenotazioniauto</class>
<class>com.antoiovi.gestcars.model.Proglav</class>
<class>com.antoiovi.gestcars.model.Role</class>
<class>com.antoiovi.gestcars.model.User</class>
<class>com.antoiovi.gestcars.model.UserData</class>
<properties>
<!-- Properties for Hibernate -->
<property name="hibernate.hbm2ddl.auto" value="create-drop" />
<property name="hibernate.show_sql" value="false" />
</properties>
</persistence-unit>
</persistence>
Thhe bean.xml是
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file can be an empty text file (0 bytes) -->
<!-- We're declaring the schema to save you time if you do have to configure
this in the future -->
<beans xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="
http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
</bean
任何人可以幫助我嗎?