(Old Eclipse usage on 16.10.2010)

23.09.2013 - Installation for a JavaEE-Project#

1. Eclipse#

Download "Eclipse IDE for Java EE Developers" (I took the 32bit version for compatibility reasons). Extract zip into a folder.

2. Java#

Download a new java version. I installed both 32bit and 64bit of version 1.7.40.

3. Run Eclipse#

Check Eclipse version under Menu > Help > About Eclipse
Eclipse Java EE IDE for Web Developers.
Version: Kepler Release
Build id: 20130614-0229
Details about the core Eclipse release is under button "Eclipse.org".
Hint: The "Web Tools Platform" is now included.

4. JBoss Tools#

Add JBoss Tools to Eclipse under Menu > Help > "Install New Software ...".
Hit button "Add.." and add a new repository.
Get the repository from http://www.jboss.org/tools/download. I took the stable "JBoss Core Tools 4.1 :: Eclipse 4.3.0" version.
Click on it and copy the URL to use as repository in Eclipse.
http://download.jboss.org/jbosstools/updates/stable/kepler/
Install
  • JBoss Web and Java EE Development > JBossAS Tools
  • JBoss Web and Java EE Development > JBoss Tools RichFaces
  • JBoss Data Services > Hibernate Tools
This enables you to create a "JBoss 7.x Runtime Server". (Current WTP Project still just has JBoss 5)

5. MySql#

Download at http://dev.mysql.com/downloads/windows/installer/.
I took "MySQL Installer 5.6.14" as offline installation.
Export from server:
mysqldump -u <user> -p<pw> dp clients datecancels dategroups datetemplates fixeddates group grouprole logins profiles sequence tablelogs > 201309230_dp.sql;
Import locally with MySQL Workbench > Menu > Server > Data Import/Restore > "Import from Self-Contained File"

6. Setup JPA / Configure database connection to MySQL5 for JBoss 7.0.x#

1. In the JPA project edit the persistence.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="DatePlanner201_JPA">
		<description>any description</description>
		<provider>org.hibernate.ejb.HibernatePersistence</provider>
		<class>ebel.dp201.jpa.Profile</class>
		<class>...</class>
		<properties>
			<property name="hibernate.default_schema" value="dp"/>
			<property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect"/>
			<property name="hibernate.id.new_generator_mappings" value="true"/>
			<property name="hibernate.connection.url" value="jdbc:mysql://_hostname_:3306/_database_"/>
			<property name="hibernate.connection.username" value="user"/>
			<property name="hibernate.connection.password" value="xxxx"/>
			<property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
			<property name="hibernate.connection.datasource" value="DatePlanner201_JPA" />
		</properties>
    </persistence-unit>
</persistence>

Create a new datasource (http://localhost:8080/console > Connector > Datasources)

Name                = Any name, maybe database
JNDI Name           = DatePlanner201_JPA 
Driver              = mysql-connector-java-5.1.26-bin.jar
Username            = user
Password            = xxxx
Connection URL      = jdbc:mysql://localhost/dp 

JBoss datasources are stored in /standalone/configuration/standalone.xml.

The "JNDI Name" can be any name, but I guess it is a good idea to have it prefixed with "java:jboss/datasources/..." (as described in this Jboss Community Thread), but it must match the JDNI name in the JBoss console.

The "persistence-unit" name in persistence.xml therfore is only used by your application with @PersistenceContext(unitName = "xyz").

Put the MySql Java driver to the deployment folder:

../standalone/deployments/mysql-connector-java-5.1.26-bin.jar

Deploy driver and application with a text file named <driver/app>.dodploy

7. Test
#

Use address to JSF project, e.g. http://localhost:8080/DatePlanner201_JSF