2015-02-24 62 views
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 

任何人可以帮助我吗?

回答

0

删除eager = true,因为这会导致OpenShift出现问题...我不知道为什么,但我看到了。

相关问题