JPA with JSF and Session Bean on Apache TomEE

Even though I am going to use Apache TomEE (Tomcat 7 +OpenEJB + OpenJPA), It will work on ANY JAVA EE 6 (Web Profile) Compatible Application server.

In this example I am trying to demonstrate how to use Apache TomEE for developing an Application made with JPA + EJB + JSF.

This demo application uses Apache derby (JavaDB) database which comes free of cost with JDK 7 downloads. You may use any other database with tiny changes to some configuration files.

Pre-requisites:

Preparations:

  1. Create Database [You may skip this if you are using any other database]
  2. Open Terminal / MS DOS prompt
  3. goto JAVA_HOME (on windows: C:\Program Files\Java\jdk1.7.x_xx)
  4. goto db\bin
  5. use command:    startNetworkServer
  6. open eclipse → create new workspace → using Data source Explorer connect to Derby connection properties:
    url: jdbc:derby://localhost:1527/sample;create=true
    username: app
    password: app
  7. Open SQL Scrapbook → execute following queries:
    create table Contact(
    contactId int primary key generated always as identity,
    first_name varchar(25),
    last_name varchar(35),
    phone_no varchar(15)
    );
    insert into contact(first_name,last_name,phone_no)
    values('Katrina','Kaif','1020131');
    insert into contact(first_name,last_name,phone_no)
    values('Kareena','Kapoor','10480131');
    insert into contact(first_name,last_name,phone_no)
    values('Prachi','desai','1045431');
  8. Add server to current workspace [You may skip this if you know how to do it]
    1. Open “Servers” view → Right click → New → Server → Apache: Apache Tomcat 7
    2. Click on “Browse” and provide path to your TomEE folder → Finish
    3. Double click on Apache Tomcat 7 inside “Servers” view
    4. Change “Server Locations” to “Use Tomcat Installation”

    [This must be done when BEFORE ANY PROJECT IS ADDED TO TOMCAT]

  9. Create New Dynamic Web Project
    1. New–> Dynamic Web Project → Name: TestApp2
    2. Click on “Modify” to change Configuration
    3. Select “JPA” and “JSF” project facets

    [ One Best thing about TomEE, it comes bundled with OpenJPA and JSF so forget about downloading and copying required JARs into your application’s WEB-INF/lib]

    • Create JNDI DataSource [MUST READ]
    • Stop Apache TomEE (If already started)
    • Open TomEE’s “conf” folder → Open “tomee.xml” in any text editor
    • add following resource definition:
      <Resource id="testDS" type="DataSource">
      JdbcDriver org.apache.derby.jdbc.ClientDriver
      JdbcUrl jdbc:derby://localhost:1527/sample
      UserName app
      Password app
      </Resource>
      

      [No, I have not made any mistake there!!]

    • Save & close this file
    • Add following “datasource” in persistence.xml testDS
  10. Create JPA entity for Table “Contact”
    package com.mahendra.models;
    import java.io.Serializable;
    import javax.persistence.*;
    /**
    * The persistent class for the CONTACT database table.
    *
    */
    @Entity
    public class Contact implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    private int contactid;
    @Column(name="FIRST_NAME")
    private String firstName;
    @Column(name="LAST_NAME")
    private String lastName;
    @Column(name="PHONE_NO")
    private String phoneNo;
    public Contact() {
    }public int getContactid() {
    return this.contactid;
    }public void setContactid(int contactid) {
    this.contactid = contactid;
    }public String getFirstName() {
    return this.firstName;
    }
    
    public void setFirstName(String firstName) {
    this.firstName = firstName;
    }
    
    public String getLastName() {
    return this.lastName;
    }
    
    public void setLastName(String lastName) {
    this.lastName = lastName;
    }
    
    public String getPhoneNo() {
    return this.phoneNo;
    }
    
    public void setPhoneNo(String phoneNo) {
    this.phoneNo = phoneNo;
    }
    
    }
  11. Your modified persistence.xml should look like this:
    <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="pu2">
    <jta-data-source>testDS</jta-data-source>
    <class>com.mahendra.models.Contact</class>
    </persistence-unit></persistence>
  12. Create new Java Class [It’s actually a session bean]
    package com.mahendra.services;
    import java.util.List;
    import javax.ejb.LocalBean;
    import javax.ejb.Stateless;
    import javax.persistence.*;
    import com.mahendra.models.Contact;/**
    * Stateless Session bean to save and/or list all contacts<br/>
    * We are using Java EE 6 Web Profile, so we don't need EJB Project
    * to create Stateless Session Beans!<br>
    * This is a CMT (Again thanks to Apache TomEE, It CAN make JTA data-sources
    * unlike plain Apache Tomcat which is just a Servlet Container)
    * @author Mahendra Shinde
    *
    */@Stateless @LocalBean
    public class ContactService {
    @PersistenceContext(unitName="pu2")
    private EntityManager em;
    public ContactService(){
    System.out.println("Instance created for Contact Service");
    }
    /**
    * method to create new record using provided arguments<br/>
    * TransactionAttribute for this method is REQUIRED (default)
    * @param firstName
    * @param lastName
    * @param phone
    */
    
    public void save(String firstName,String lastName,String phone){
    Contact cn = new Contact();
    cn.setFirstName(firstName);
    cn.setLastName(lastName);
    cn.setPhoneNo(phone);
    em.persist(cn);
    System.out.println("Record saved");
    }
    
    /**
    * method to load all contacts from database
    * @return List of all contacts
    */
    public List<Contact> loadAll(){
    List<Contact> list = null;
    Query q =em.createQuery("select c from Contact c");
    list = q.getResultList();
    return list;
    }
    
    }
  13. Create Managed Bean (Backing bean) for JSF pages:
    package com.mahendra.beans;
    import java.io.Serializable;
    import java.util.List;
    import javax.ejb.EJB;
    import javax.faces.bean.*;
    import com.mahendra.models.Contact;
    import com.mahendra.services.ContactService;
    /**
    * Backing Bean for JSF pages. <br/>
    * This bean has reference of <code>ContactService</code> using @EJB Annotation
    * @author Mahendra Shinde
    *
    */
    @ManagedBean
    @SessionScopedpublic class ContactBean implements Serializable {
    @EJB private ContactService service;
    private String firstName,lastName,phone;
    private List<Contact> contactList;
    public ContactBean() {
    }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 getPhone() {
    return phone;
    }
    
    public void setPhone(String phone) {
    this.phone = phone;
    }
    
    /**
    * Call save method on ContactService and update list
    * @return Outcome for JSF Navigation
    */
    
    public String addContact(){
    service.save(firstName,lastName,phone);
    contactList = service.loadAll();
    return "success";
    }
    
    public List<Contact> getContactList() {
    return contactList;
    }
    
    public void setContactList(List<Contact> contactList) {
    this.contactList = contactList;
    }
    
    }
  14. Add following navigation rule inside “faces-config.xml” file:
    <navigation-rule>
    <display-name>index.xhtml</display-name>
    <from-view-id>/index.xhtml</from-view-id>
    <navigation-case>
    <from-outcome>success</from-outcome>
    <to-view-id>/list.xhtml</to-view-id>
    <redirect />
    </navigation-case>
    </navigation-rule>
  15. Create “index.xhtml” inside “WebContents” folder:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html" ><h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>Home page</title>
    </h:head><h:body>
    <h:form>
    <h:outputText value="First name :" />
    <h:inputText value="#{contactBean.firstName}"/>
    <h:outputText value="Last name :" />
    <h:inputText value="#{contactBean.lastName}"/>
    <h:outputText value="Phone :" />
    <h:inputText value="#{contactBean.phone}"/>
    <h:commandButton value="submit" action="#{contactBean.addContact}"/>
    </h:form>
    </h:body>
    </html>
  16. create “list.xhtml” inside “WebContents” folder
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"><h:head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <title>List of Contacts</title>
    </h:head><h:body>
    <h2>My Contacts</h2>
    <h:dataTable value="#{contactBean.contactList}" var="c">
    <h:column>
    <f:facet name="header">Contact #</f:facet>
    #{c.contactid}
    </h:column>
    <h:column>
    <f:facet name="header">First Name</f:facet>
    #{c.firstName}
    </h:column>
    <h:column>
    <f:facet name="header">Last Name</f:facet>
    #{c.lastName}
    </h:column>
    <h:column>
    <f:facet name="header">Phone #</f:facet>
    #{c.phoneNo}
    </h:column>
    </h:dataTable>
    </h:body>
    </html>
    
  17. Now, run your application on Apache TomEE
    [Make sure Apache Derby is Still running]
    test url : http://localhost:8080/TestApp2/faces/index.xhtml
Advertisements

2 comments on “JPA with JSF and Session Bean on Apache TomEE

  1. Thanks for this tutorial. I tried to get iit work with eclipse and tomee release apache-tomee-1.5.2.
    here is the log.
    20 oct. 2013 17:40:20 org.apache.catalina.core.AprLifecycleListener init
    INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Java\jdk1.6.0_31\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;c:/java/jdk1.6.0_31/bin/../jre/bin/client;c:/java/jdk1.6.0_31/bin/../jre/bin;c:/java/jdk1.6.0_31/bin/../jre/lib/i386;F:\ms_workspace\Printing\gsoap-win32-2.7\bin; C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Java\openejb-3.0/bin;c:\java\jdk1.6.0_31\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32\wbem;C:\Windows\system32\windowspowershell\v1.0\;c:\program files\ibm\gsk8\lib;C:\IBM\DB2_9.7\SQLLIB\BIN;C:\IBM\DB2_9.7\SQLLIB\FUNCTION;C:\IBM\DB2_9.7\SQLLIB\SAMPLES\REPL;C:\Program Files\Windows Live\Shared;%PROGRAMFILES%\Internet Explorer;c:\Program Files\Microsoft SQL Server\90\Tools\binn\;C:\Program Files\MySQL\MySQL Utilities 1.3.4\;C:\Java\derby\db-derby-10.10.1.1\bin;;C:\Java\eclipse\helios;;.
    20 oct. 2013 17:40:21 org.apache.tomcat.util.digester.SetPropertiesRule begin
    ATTENTION: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property ‘source’ to ‘org.eclipse.jst.jee.server:SampeJPAWeb’ did not find a matching property.
    20 oct. 2013 17:40:21 org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler [“http-bio-8080”]
    20 oct. 2013 17:40:21 org.apache.coyote.AbstractProtocol init
    INFO: Initializing ProtocolHandler [“ajp-bio-8009”]
    20 oct. 2013 17:40:22 org.apache.openejb.util.OptionsLog info
    INFO: Using ‘openejb.jdbc.datasource-creator=org.apache.tomee.jdbc.TomEEDataSourceCreator’
    20 oct. 2013 17:40:22 org.apache.openejb.OpenEJB$Instance
    INFO: ********************************************************************************
    20 oct. 2013 17:40:22 org.apache.openejb.OpenEJB$Instance
    INFO: OpenEJB http://openejb.apache.org/
    20 oct. 2013 17:40:22 org.apache.openejb.OpenEJB$Instance
    INFO: Startup: Sun Oct 20 17:40:22 CEST 2013
    20 oct. 2013 17:40:22 org.apache.openejb.OpenEJB$Instance
    INFO: Copyright 1999-2012 (C) Apache OpenEJB Project, All Rights Reserved.
    20 oct. 2013 17:40:22 org.apache.openejb.OpenEJB$Instance
    INFO: Version: 4.5.2
    20 oct. 2013 17:40:22 org.apache.openejb.OpenEJB$Instance
    INFO: Build date: 20130320
    20 oct. 2013 17:40:22 org.apache.openejb.OpenEJB$Instance
    INFO: Build time: 03:56
    20 oct. 2013 17:40:22 org.apache.openejb.OpenEJB$Instance
    INFO: ********************************************************************************
    20 oct. 2013 17:40:22 org.apache.openejb.OpenEJB$Instance
    INFO: openejb.home = C:\Java\apache-tomee-plus-1.5.2
    20 oct. 2013 17:40:22 org.apache.openejb.OpenEJB$Instance
    INFO: openejb.base = D:\Java\workspaces\eclipse\tomee\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
    20 oct. 2013 17:40:22 org.apache.openejb.cdi.CdiBuilder initializeOWB
    INFO: Created new singletonService org.apache.openejb.cdi.ThreadSingletonServiceImpl@fedfb6
    20 oct. 2013 17:40:22 org.apache.openejb.cdi.CdiBuilder initializeOWB
    INFO: Succeeded in installing singleton service
    20 oct. 2013 17:40:22 org.apache.openejb.config.ConfigurationFactory init
    INFO: openejb configuration file is ‘D:\Java\workspaces\eclipse\tomee\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\conf\openejb.xml’
    20 oct. 2013 17:40:23 org.apache.openejb.util.OptionsLog info
    INFO: Using ‘openejb.provider.default=org.apache.tomee’
    20 oct. 2013 17:40:23 org.apache.openejb.config.ConfigurationFactory configureService
    INFO: Configuring Service(id=Tomcat Security Service, type=SecurityService, provider-id=Tomcat Security Service)
    20 oct. 2013 17:40:23 org.apache.openejb.config.ConfigurationFactory configureService
    INFO: Configuring Service(id=Default Transaction Manager, type=TransactionManager, provider-id=Default Transaction Manager)
    20 oct. 2013 17:40:23 org.apache.openejb.config.ConfigurationFactory configureService
    INFO: Configuring Service(id=My DataSource, type=Resource, provider-id=Default JDBC Database)
    20 oct. 2013 17:40:23 org.apache.openejb.config.ConfigurationFactory configureService
    INFO: Configuring Service(id=My Unmanaged DataSource, type=Resource, provider-id=Default JDBC Database)
    20 oct. 2013 17:40:23 org.apache.openejb.config.ConfigurationFactory configureService
    INFO: Configuring Service(id=My Singleton Container, type=Container, provider-id=Default Singleton Container)
    20 oct. 2013 17:40:23 org.apache.openejb.config.ConfigurationFactory configureService
    INFO: Configuring Service(id=My Stateful Container, type=Container, provider-id=Default Stateful Container)
    20 oct. 2013 17:40:23 org.apache.openejb.config.ConfigurationFactory configureService
    INFO: Configuring Service(id=My Stateless Container, type=Container, provider-id=Default Stateless Container)
    20 oct. 2013 17:40:23 org.apache.openejb.config.DeploymentsResolver loadFrom
    ATTENTION: – Does not exist: D:\Java\workspaces\eclipse\tomee\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\apps
    20 oct. 2013 17:40:23 org.apache.openejb.util.OptionsLog info
    INFO: Using ‘openejb.system.apps=true’
    20 oct. 2013 17:40:23 org.apache.openejb.config.ConfigurationFactory configureApplication
    INFO: Configuring enterprise application: openejb
    20 oct. 2013 17:40:23 org.apache.openejb.config.InitEjbDeployments deploy
    INFO: Using openejb.deploymentId.format ‘{ejbName}’
    20 oct. 2013 17:40:23 org.apache.openejb.config.InitEjbDeployments deploy
    INFO: Auto-deploying ejb openejb/User: EjbDeployment(deployment-id=openejb/User)
    20 oct. 2013 17:40:23 org.apache.openejb.config.InitEjbDeployments deploy
    INFO: Auto-deploying ejb openejb/Deployer: EjbDeployment(deployment-id=openejb/Deployer)
    20 oct. 2013 17:40:23 org.apache.openejb.config.InitEjbDeployments deploy
    INFO: Auto-deploying ejb openejb/ConfigurationInfo: EjbDeployment(deployment-id=openejb/ConfigurationInfo)
    20 oct. 2013 17:40:23 org.apache.openejb.config.InitEjbDeployments deploy
    INFO: Auto-deploying ejb MEJB: EjbDeployment(deployment-id=MEJB)
    20 oct. 2013 17:40:23 org.apache.openejb.config.AppInfoBuilder build
    INFO: Enterprise application “openejb” loaded.
    20 oct. 2013 17:40:23 org.apache.openejb.assembler.classic.Assembler createRecipe
    INFO: Creating TransactionManager(id=Default Transaction Manager)
    20 oct. 2013 17:40:23 org.apache.openejb.assembler.classic.Assembler createRecipe
    INFO: Creating SecurityService(id=Tomcat Security Service)
    20 oct. 2013 17:40:23 org.apache.openejb.assembler.classic.Assembler createRecipe
    INFO: Creating Resource(id=My DataSource)
    20 oct. 2013 17:40:23 org.apache.openejb.assembler.classic.Assembler createRecipe
    INFO: Creating Resource(id=My Unmanaged DataSource)
    20 oct. 2013 17:40:23 org.apache.openejb.assembler.classic.Assembler createRecipe
    INFO: Creating Container(id=My Singleton Container)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.Assembler createRecipe
    INFO: Creating Container(id=My Stateful Container)
    20 oct. 2013 17:40:24 org.apache.openejb.core.stateful.SimplePassivater init
    INFO: Using directory C:\Users\ADMINI~1\AppData\Local\Temp for stateful session passivation
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.Assembler createRecipe
    INFO: Creating Container(id=My Stateless Container)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.Assembler createApplication
    INFO: Assembling app: openejb
    20 oct. 2013 17:40:24 org.apache.openejb.util.OptionsLog info
    INFO: Using ‘openejb.jndiname.format={deploymentId}{interfaceType.openejbLegacyName}’
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.JndiBuilder bind
    INFO: Jndi(name=openejb/UserBusinessRemote) –> Ejb(deployment-id=openejb/User)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.JndiBuilder bind
    INFO: Jndi(name=global/openejb/openejb/User!org.apache.openejb.assembler.util.User) –> Ejb(deployment-id=openejb/User)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.JndiBuilder bind
    INFO: Jndi(name=global/openejb/openejb/User) –> Ejb(deployment-id=openejb/User)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.JndiBuilder bind
    INFO: Jndi(name=openejb/DeployerBusinessRemote) –> Ejb(deployment-id=openejb/Deployer)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.JndiBuilder bind
    INFO: Jndi(name=global/openejb/openejb/Deployer!org.apache.openejb.assembler.Deployer) –> Ejb(deployment-id=openejb/Deployer)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.JndiBuilder bind
    INFO: Jndi(name=global/openejb/openejb/Deployer) –> Ejb(deployment-id=openejb/Deployer)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.JndiBuilder bind
    INFO: Jndi(name=openejb/ConfigurationInfoBusinessRemote) –> Ejb(deployment-id=openejb/ConfigurationInfo)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.JndiBuilder bind
    INFO: Jndi(name=global/openejb/openejb/ConfigurationInfo!org.apache.openejb.assembler.classic.cmd.ConfigurationInfo) –> Ejb(deployment-id=openejb/ConfigurationInfo)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.JndiBuilder bind
    INFO: Jndi(name=global/openejb/openejb/ConfigurationInfo) –> Ejb(deployment-id=openejb/ConfigurationInfo)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.JndiBuilder bind
    INFO: Jndi(name=MEJB) –> Ejb(deployment-id=MEJB)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.JndiBuilder bind
    INFO: Jndi(name=global/openejb/MEJB!javax.management.j2ee.ManagementHome) –> Ejb(deployment-id=MEJB)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.JndiBuilder bind
    INFO: Jndi(name=global/openejb/MEJB) –> Ejb(deployment-id=MEJB)
    20 oct. 2013 17:40:24 org.apache.openejb.cdi.CdiBuilder initSingleton
    INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@fedfb6
    20 oct. 2013 17:40:24 org.apache.openejb.cdi.OpenEJBLifecycle startApplication
    INFO: OpenWebBeans Container is starting…
    20 oct. 2013 17:40:24 org.apache.webbeans.plugins.PluginLoader startUp
    INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
    20 oct. 2013 17:40:24 org.apache.webbeans.plugins.PluginLoader startUp
    INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
    20 oct. 2013 17:40:24 org.apache.openejb.cdi.BeansDeployer validateInjectionPoints
    INFO: All injection points are validated successfully.
    20 oct. 2013 17:40:24 org.apache.openejb.cdi.OpenEJBLifecycle startApplication
    INFO: OpenWebBeans Container has started, it took 147 ms.
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.Assembler startEjbs
    INFO: Created Ejb(deployment-id=openejb/Deployer, ejb-name=openejb/Deployer, container=My Stateless Container)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.Assembler startEjbs
    INFO: Created Ejb(deployment-id=MEJB, ejb-name=MEJB, container=My Stateless Container)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.Assembler startEjbs
    INFO: Created Ejb(deployment-id=openejb/ConfigurationInfo, ejb-name=openejb/ConfigurationInfo, container=My Stateless Container)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.Assembler startEjbs
    INFO: Created Ejb(deployment-id=openejb/User, ejb-name=openejb/User, container=My Stateless Container)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.Assembler startEjbs
    INFO: Started Ejb(deployment-id=openejb/Deployer, ejb-name=openejb/Deployer, container=My Stateless Container)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.Assembler startEjbs
    INFO: Started Ejb(deployment-id=MEJB, ejb-name=MEJB, container=My Stateless Container)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.Assembler startEjbs
    INFO: Started Ejb(deployment-id=openejb/ConfigurationInfo, ejb-name=openejb/ConfigurationInfo, container=My Stateless Container)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.Assembler startEjbs
    INFO: Started Ejb(deployment-id=openejb/User, ejb-name=openejb/User, container=My Stateless Container)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.Assembler deployMBean
    INFO: Deployed MBean(openejb.user.mbeans:application=openejb,group=org.apache.openejb.assembler.monitoring,name=JMXDeployer)
    20 oct. 2013 17:40:24 org.apache.openejb.assembler.classic.Assembler createApplication
    INFO: Deployed Application(path=openejb)
    20 oct. 2013 17:40:24 org.apache.openejb.util.OptionsLog info
    INFO: Using ‘openejb.profile.custom=false’
    20 oct. 2013 17:40:24 org.apache.openejb.server.ServiceManager initServer
    INFO: Creating ServerService(id=cxf)
    20 oct. 2013 17:40:25 org.apache.openejb.server.ServiceManager initServer
    INFO: Creating ServerService(id=cxf-rs)
    20 oct. 2013 17:40:25 org.apache.openejb.server.SimpleServiceManager start
    INFO: ** Bound Services **
    20 oct. 2013 17:40:25 org.apache.openejb.server.SimpleServiceManager printRow
    INFO: NAME IP PORT
    20 oct. 2013 17:40:25 org.apache.openejb.server.SimpleServiceManager start
    INFO: ——-
    20 oct. 2013 17:40:25 org.apache.openejb.server.SimpleServiceManager start
    INFO: Ready!
    20 oct. 2013 17:40:25 org.apache.catalina.startup.Catalina load
    INFO: Initialization processed in 4962 ms
    20 oct. 2013 17:40:25 org.apache.tomee.catalina.OpenEJBNamingContextListener bindResource
    INFO: Importing a Tomcat Resource with id ‘UserDatabase’ of type ‘org.apache.catalina.UserDatabase’.
    20 oct. 2013 17:40:25 org.apache.openejb.assembler.classic.Assembler createRecipe
    INFO: Creating Resource(id=UserDatabase)
    20 oct. 2013 17:40:25 org.apache.catalina.core.StandardService startInternal
    INFO: Démarrage du service Catalina
    20 oct. 2013 17:40:25 org.apache.catalina.core.StandardEngine startInternal
    INFO: Starting Servlet Engine: Apache Tomcat (TomEE)/7.0.37
    20 oct. 2013 17:40:25 org.apache.tomee.catalina.TomcatWebAppBuilder init
    INFO: ————————- localhost ->
    20 oct. 2013 17:40:26 org.apache.openejb.config.ConfigurationFactory configureApplication
    INFO: Configuring enterprise application: D:\Java\workspaces\eclipse\tomee\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT
    20 oct. 2013 17:40:26 org.apache.openejb.config.AppInfoBuilder build
    INFO: Enterprise application “D:\Java\workspaces\eclipse\tomee\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT” loaded.
    20 oct. 2013 17:40:26 org.apache.openejb.assembler.classic.Assembler createApplication
    INFO: Assembling app: D:\Java\workspaces\eclipse\tomee\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT
    20 oct. 2013 17:40:26 org.apache.openejb.cdi.CdiBuilder initSingleton
    INFO: Existing thread singleton service in SystemInstance(): org.apache.openejb.cdi.ThreadSingletonServiceImpl@fedfb6
    20 oct. 2013 17:40:26 org.apache.openejb.cdi.OpenEJBLifecycle startApplication
    INFO: OpenWebBeans Container is starting…
    20 oct. 2013 17:40:26 org.apache.webbeans.plugins.PluginLoader startUp
    INFO: Adding OpenWebBeansPlugin : [CdiPlugin]
    20 oct. 2013 17:40:26 org.apache.webbeans.plugins.PluginLoader startUp
    INFO: Adding OpenWebBeansPlugin : [OpenWebBeansJsfPlugin]
    20 oct. 2013 17:40:26 org.apache.openejb.cdi.BeansDeployer validateInjectionPoints
    INFO: All injection points are validated successfully.
    20 oct. 2013 17:40:26 org.apache.openejb.cdi.OpenEJBLifecycle startApplication
    INFO: OpenWebBeans Container has started, it took 3 ms.
    20 oct. 2013 17:40:26 org.apache.openejb.assembler.classic.Assembler createApplication
    INFO: Deployed Application(path=D:\Java\workspaces\eclipse\tomee\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\ROOT)
    20 oct. 2013 17:40:27 org.apache.tomee.catalina.TomcatWebAppBuilder init
    INFO: ————————- localhost -> /SampeJPAWeb
    20 oct. 2013 17:40:29 org.apache.catalina.core.ContainerBase startInternal
    GRAVE: A child container failed during start
    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SampeJPAWeb]]
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
    at java.util.concurrent.FutureTask.get(FutureTask.java:83)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    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:662)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/SampeJPAWeb]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    … 7 more
    Caused by: org.apache.tomee.catalina.TomEERuntimeException: org.apache.openejb.OpenEJBException: Cannot unmarshall the faces configuration file: file:/D:/Java/workspaces/eclipse/tomee/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/SampeJPAWeb/WEB-INF/faces-config.xml: élément inattendu (URI : “http://java.sun.com/xml/ns/javaee”, local : “display-name”). Les éléments attendus sont ,,,,,,,,,,,,,,
    at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:1903)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.startInternal(TomcatWebAppBuilder.java:1073)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.configureStart(TomcatWebAppBuilder.java:1033)
    at org.apache.tomee.catalina.GlobalListenerSupport.lifecycleEvent(GlobalListenerSupport.java:124)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    … 7 more
    Caused by: org.apache.openejb.OpenEJBException: Cannot unmarshall the faces configuration file: file:/D:/Java/workspaces/eclipse/tomee/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/SampeJPAWeb/WEB-INF/faces-config.xml: élément inattendu (URI : “http://java.sun.com/xml/ns/javaee”, local : “display-name”). Les éléments attendus sont ,,,,,,,,,,,,,,
    at org.apache.openejb.config.ReadDescriptors.readFacesConfig(ReadDescriptors.java:763)
    at org.apache.openejb.config.DeploymentLoader.addFacesConfigs(DeploymentLoader.java:1211)
    at org.apache.openejb.config.DeploymentLoader.createWebModule(DeploymentLoader.java:884)
    at org.apache.openejb.config.DeploymentLoader.createWebModule(DeploymentLoader.java:699)
    at org.apache.openejb.config.DeploymentLoader.load(DeploymentLoader.java:189)
    at org.apache.tomee.catalina.TomcatWebAppBuilder.loadApplication(TomcatWebAppBuilder.java:1901)
    … 14 more
    Caused by: javax.xml.bind.UnmarshalException: élément inattendu (URI : “http://java.sun.com/xml/ns/javaee”, local : “display-name”). Les éléments attendus sont ,,,,,,,,,,,,,,
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.handleEvent(UnmarshallingContext.java:662)
    at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:258)
    at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportError(Loader.java:253)
    at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.reportUnexpectedChildElement(Loader.java:120)
    at com.sun.xml.bind.v2.runtime.unmarshaller.Loader.childElement(Loader.java:105)
    at com.sun.xml.bind.v2.runtime.unmarshaller.StructureLoader.childElement(StructureLoader.java:262)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:498)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:480)
    at com.sun.xml.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:150)
    at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:527)
    at org.apache.openejb.jee.JaxbJavaee$JavaeeNamespaceFilter.startElement(JaxbJavaee.java:284)
    at org.apache.xerces.parsers.AbstractSAXParser.startElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
    at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:333)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:218)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:196)
    at com.sun.xml.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:247)
    at org.apache.openejb.jee.JaxbJavaee.unmarshalJavaee(JaxbJavaee.java:132)
    at org.apache.openejb.config.ReadDescriptors.readFacesConfig(ReadDescriptors.java:759)
    … 19 more
    20 oct. 2013 17:40:29 org.apache.catalina.core.ContainerBase startInternal
    GRAVE: A child container failed during start
    java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
    at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
    at java.util.concurrent.FutureTask.get(FutureTask.java:83)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:684)
    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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
    at java.util.concurrent.FutureTask.run(FutureTask.java:138)
    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:662)
    Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    … 7 more
    20 oct. 2013 17:40:29 org.apache.catalina.startup.Catalina start
    GRAVE: Catalina.start:
    org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:684)
    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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:322)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:456)
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    … 7 more
    Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    … 9 more
    Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
    … 11 more
    20 oct. 2013 17:40:29 org.apache.catalina.startup.Catalina start
    INFO: Server startup in 4154 ms

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s