-
Notifications
You must be signed in to change notification settings - Fork 1
Local JBoss AS 7.1 Environment
Operating System
- uname -a
- Linux t420 3.13.0-40-generic #69-Ubuntu SMP Thu Nov 13 17:53:56 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
- http://releases.ubuntu.com/14.04/
JDK install
- sudo apt-get install openjdk-7-jdk
java -version
- java version "1.7.0_75"
- OpenJDK Runtime Environment (IcedTea 2.5.4) (7u75-2.5.4-1~trusty1)
- OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)
Install JBoss AS 7.1 Server
- JBoss AS 7.1 64-bit Linux
- http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.tar.gz
- unpack to ~/apps/jboss-as-7.1.1.Final
Install Eclipse Kepler 4.3
- http://www.eclipse.org/downloads/download.php?file=/technology/epp/downloads/release/kepler/SR2/eclipse-jee-kepler-SR2-linux-gtk-x86_64.tar.gz
- unpack to ~/apps/eclipse
Add JBoss Tools to Eclipse
- http://tools.jboss.org/downloads/jbosstools/kepler/4.1.2.Final.html#update_site
- Eclipse:Help->Install New Software-> add
- work with: http://download.jboss.org/jbosstools/updates/stable/kepler/
- From install options, select first, Abridged JBoss Tools
Create ~/git
Create .ssh keys
- https://help.ubuntu.com/community/SSH/OpenSSH/Keys
- mkdir ~/.ssh
- chmod 700 ~/.ssh
- ssh-keygen -t rsa
Import Remote OpenShift App into Eclipse
- Import->OpenShift->Existing Application (e.g. mysiwtapi)
- Click option to allow easy publishing
- configure public and private key created in above step to Eclipse/JBoss Tools
Import project from GIT
- https://github.com/ams10961/siwtapi.git
- import as existing project
Manually migrate code into OpenShift Application
- delete existing src and pom.xml from imported OpenShift application
- copy src directory and pom.xml into their place (e.g. git/mysiwtapi)
- cp -r switapi/.openshift into OpenShift application
Configure Eclipse Project Facets
- CDI 1.0
- Dynamic Web Module 3.0
- Java 1.7
- JavaScript 1.0
- JAX-RS (Rest Web Services) 1.1
- JBoss Maven Integration 1.0
- JPA 2.0
Add Hibernate Run Configuration
- Menu->Run->Run Configurations
- Hibernate Console Configuration->New
- enter configuration name, e.g. 'mysiwtapi'
- select 'mysiwtapi' project
- set JPA (JDK 1.5+) and Hibernate 4.0
- Ignore direct run error on 'run'
Check Eclipse JPA Settings
- Platform: Generic 2.0
- JPA Implmentation: Disable Library Configuration
- Connection: None (will generate warnings)
- Discover annotated classes automatically
Suppress JAX-RS Error in Eclipse
- Update behaviour for 'Configure Problem Severity for preference 'Missing Provider Implementation'
- Update behaviour from 'Error' to 'Ignore'
Check Eclipse Hibernate Settings
- Enable Hibernate Support
- Default Hibernate Console configuration: mysiwtapi
- Details : Main : Type:JPA; Version:4.0; Project:mysiwtapi; DB Connection: [JPA Project Configured]
Prune Failed Maven Downloads
-
If Maven complains about failed downloads, this command will prune failed items from repository
find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} ; -print -exec rm {} ;
Update local AS 7.1 server modules
- RestEasy 3.0.9
- HTTPComponents 4.3.x
- MySql 5 Connector
- cp -r ~/git/mysiwtapi/.openshift/config/modules/* ~/apps/jboss-as-7.1.1.Final/modules
Create an SSL certificate and keystore for local server
- http://docs.jboss.org/jbossweb/7.0.x/ssl-howto.html
- // create a password protected keystore with a single self-signed certificate
- keytool -genkey -alias tomcat -keyalg RSA -keystore ~/apps/jboss-as-7.1.1.Final/standalone/configuration/keystore
Update local server Configuration to support HTTPS
- cd ~/apps/jboss-as-7.1.1.Final/standalone/configuration
- backup standalone.xml
- edit standalone.xml
- add https connector referencing created keystore
Around line 260
<subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
<ssl password="passw0rd" protocol="TLSv1" verify-client="false"
certificate-key-file="/home/ams10961/apps/
jboss-as-7.1.1.Final/standalone/configuration/keystore"/>
</connector>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
</virtual-server>
</subsystem>
Update local server JDBC drivers
- remove unused example data source
- include H2 and MySql JDBC XA Drivers
Around line 95
<subsystem xmlns="urn:jboss:domain:datasources:1.0">
<datasources>
<drivers>
<driver name="h2" module="com.h2database.h2">
<xa-datasource-class>org.h2.jdbcx.JdbcDataSource</xa-datasource-class>
</driver>
<driver name="com.mysql" module="com.mysql">
<xa-datasource-class>com.mysql.jdbc.jdbc2.optional.MysqlXADataSource</xa-datasource-class>
</driver>
</drivers>
</datasources>
</subsystem>
Update arquillian path
-
/mysiwtapi/src/test/resources/arquillian.xml
<property name="jbossHome">/home/ams10961/apps/jboss-as-7.1.1.Final</property>
Install local MySql 5 Server
- sudo apt-get install mysql-server
- record admin username/password
**Setup local SQL Client
- setup an SQL client, e.g. http://squirrelsql.org
- download, e.g. squirrel-sql-3.6-standard.jar
- java -jar squirrel-sql-3.6-standard.jar
- note password, e.g. 'passw0rd'
- start with ~/apps/squirrel-sql-3.6/squirrel-sql.sh, lock to launcher
- add Driver
- name 'jboss-mysql'
- example URL jdbc:mysql://<hostname>[,][<:3306>]/[?<param1
- add class path
- browse to ~/git/api11/.openshift/config/modules/com/mysql/main/mysql-connector-java-5.1.28.jar
- list drivers, select 'com.mysql.jdbc.Driver'
- add Alias
- select 'jboss-mysql', url 'jdbc:mysql://localhost:3306', user:root, password:passw0rd
- create persistent SQL databases: siwtapi and siwtapi_test
Create Twitter Credentials Directory
- mkdir ~/app-root
- chmod 700 ~/app-root
- mkdir ~/app-root/data
- chmod 700 ~/app-root/data
Build and run tests
- sudo apt-get install maven
- make sure ~/app-root/data/twitter.properties contains keys and secrets
- mvn clean test -Parq-jbossas-managed
Import local self-signed certificate into browser
- browse to https://localhost:8443
- accept certificate and add permanently
Add localhost to truststore