Monday, September 30, 2013

setup glassfish and roller

  • in .30
  • first disable jboss startup by "sudo update-rc.d -f jboss remove"
  • create glassfish user and group
  • mv glassfish to /usr/local/share/glassfish
  • chown to glassfish:galssfish
  • create a admin user and password:  ./asadmin change-admin-password
  • ./asadmin --host  30 --port 4848 enable-secure-admin to allow remote access to admin page
  • login to admin and change default http listener port to another number
  • copy mydql jdbc driver to /domains/domain1/lib/ext and roller-custom.properties to domain1/lib/classes.
  • add jdbc connection pool for roller and jdbc resource for jdbc/rollerdb
  • have to create the rollerdata dir in glassfish home and change the properties in roller-customer.properties
  • .have to install java jdk7 instead of using jre(jdk-7u40-linux-i586.gz)
  • sudo lsof -i tcp and found the job# for glassfish and kill it
  • scp the jdk
  • jdk-7u40-linux-i586.gz
  • sudo mv ./jdk1.7.0_40 /usr/lib/jvm/jdk1.7.0
  •  sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0/bin/java" 1
  • sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0/bin/javac" 1
  • sudo update-alternatives --install "/usr/bin/javac" "javaws" "/usr/lib/jvm/jdk1.7.0/bin/javaws" 1
  •  sudo chmod a+x /usr/bin/java
  •  sudo chmod a+x /usr/bin/javac
  • sudo chmod a+x /usr/bin/javaws
  • sudo chown -R root:root /usr/lib/jvm/jdk1.7.0
  • sudo update-alternatives --config java
  • sudo update-alternatives --config javac
  • sudo /etc/init.d/apparmor restart
  • edit /etc/profile.d/java.sh and put

"export JAVA_HOME=/usr/lib/jvm/jdk1.7.0

export PATH=$JAVA_HOME/bin:$PATH"

  • restart the server  and cd to glassfish/bin sudo ./asadmin craete-srevice
  • sudo chmod 755  /usr/local/share/glassfish/glassfish4/glassfish/lib/nadmin
  • start the GlassFish-domain1 service.

Sunday, September 22, 2013

glassfish 4 and roller 5.0.1

  • get tired of twisting  apache roller for jboss EAP,  decide to try glassfish 4.0
  •  downloaded and installed glassfish-4.0.zip  full java EE platform
  • unziped and copied mysql jdbc to the domain1/lib/ext
  • copied roller-custom.properties to domain1/clases
  • deployed the download roller-5.0.1-javaee.war
  • woala!!, it works.

Lessons learned:

I am not a Java App server guru, but worked more than 2 years with glassfish(3 then 4) and 3 years with jboss EAP(5, then 6)

a lot of applications downloaded from the internet(roller, nexus, and others) will work with glassfish without modification

for jboss, the apps  need spend some time painfully sniffing through the source code and a lot of time I have to give up and go back to use glassfish.

This is my first time use glassfish 4, and I did not notice a lot of change between 3 and 4, the speed is decent.

between jboss EAP 5 and EAP6, the change is radical and as a developer, a lot of things I did in EAP 5 are completely different in EAP6.

 

build roller 5.0.1 ro jboss eap 6.0

  • download the roller source and import existing Maven projects into eclipse
  • maven clean complie and install  roller-project(parent)
  • roller-core maven clean compile install with no problem
  • roller-planet-business stopped, change pom for guice. 

  <dependency>

  <groupId>com.google.inject</groupId>

  <artifactId>guice</artifactId>

  <version>3.0</version>

</dependency>

  • have to copy droptables.sql to  source/main/resource/sql
  • here are the missing dependency modificaton for roller-weblogger-business

<dependency>

  <groupId>com.google.inject</groupId>

  <artifactId>guice</artifactId>

  <version>3.0</version>

</dependency>

  <dependency>

            <groupId>net.oauth.core</groupId>

            <artifactId>oauth</artifactId>

             <version>20100527</version>

            <scope>compile</scope>

        </dependency>

 

        <dependency>

            <groupId>net.oauth.core</groupId>

            <artifactId>oauth-provider</artifactId>

             <version>20100527</version>

            <scope>compile</scope>

        </dependency>

  • added the net.oauth dependency to roller-weblogger-webapp and roller-weblogger-web and compliled them.
  • deployed roller-weblogger-webapp to jboss
  • tried a lot of things and installed jboss eap6.10, still not working

Saturday, September 21, 2013

maven nexus, apache roller

  • nexus on both 30 and 40.
  • downloaded source for roller and will try to install roller in jboss eap 6.0

Wednesday, September 11, 2013

Restore Roller Mydql Database


  • use ubuntu live cd  and choose " fix broken installation"
  • mount a usb to /media/external by choose the use from "sudo fdisk -l"
  • installed new ubuntu server 12.04 LTS from burned cd(tried usb and DVD not working).
  • installed mysql server after server started(LAMP won't work because of  dns issue of home).
  • mount usb and copy roller dir to /var/lib/mysql
  • sudo service mysql stop
  • sudo  chmod -R 660 /var/lib/mysql/roller/
  • sudo chmod 700 /var/lib/mysql/roller
  • sudo chown -R -f mysql:mysql /var/lib/mysql/roller
  • service mysql start
  • mysqlcheck --repair --all-databases
  • need to dump the roller db regularly, the weblogentry table is the most important.

mysql in ubuntu 12.04 LTS allow remote access

To expose MySQL to anything other than localhost you will have to have the following line uncommented in /etc/mysql/my.cnf and assigned to your computers IP address and not loopback
#Replace xxx with your IP Address 
bind-address        = xxx.xxx.xxx.xxx
Or add a bind-address = 0.0.0.0 if you don't want to specify the IP
Then stop and restart MySQL with the new my.cnf entry. Once running go to the terminal and enter the following command.
lsof -i -P | grep :3306
That should come back something like this with your actual IP in the xxx's
mysqld  1046  mysql  10u  IPv4  5203  0t0  TCP  xxx.xxx.xxx.xxx:3306 (LISTEN)
If the above statement returns correctly you will then be able to accept remote users. However for a remote user to connect with the correct priveleges you need to have that user created in both the localhost and '%'.
Before granting user access, you need to login MySQL. 
$ mysql -u root -p
CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'mypass';
CREATE USER 'myuser'@'%' IDENTIFIED BY 'mypass';
Then
GRANT ALL ON *.* TO 'myuser'@'localhost';
GRANT ALL ON *.* TO 'myuser'@'%';
If you don't have the same user created as above, when you logon locally you may inherit base localhost privileges and have access issues. If you want to restrict the access myuser has then you would need to read up on the GRANT statement syntax HERE If you get through all this and still have issues post some additional error output and the my.cnf appropriate lines.