Saturday, September 14, 2013

Running GlassFish 4 with MySQL on OpenShift

This post has been moved http://svanimpe.be/blog/glassfish-openshift.html

14 comments:

  1. Hello, thanks for great article, is it possible to run the Glassfish Administration Console on OpenShift using your tutorial? Thanks

    ReplyDelete
  2. Unfortunately, the administration console is not supported (OpenShift only allows one port). The section "Setting up resources" describes how I worked around this.

    ReplyDelete
  3. I can't thank you enough for this tutorial. I tried to setup Glassfish on OpenShift a few times a couple months ago, and I always failed... I'm really glad you made it so simple, thanks to you it's now almost plug & play ! I got it up and running in less than half an hour. =)

    ReplyDelete
    Replies
    1. Glad I could be of help! It took me a while to figure all this out myself.

      Delete
  4. Hi, very good your post, simple and easy, but I had a problem on start, below:
    remote: Stopping MySQL 5.5 cartridge
    remote: Stopping DIY cartridge
    remote: Building git ref 'master', commit ff79e15
    remote: Preparing build for deployment
    remote: Deployment id is 98764b21
    remote: Activating deployment
    remote: Starting MySQL 5.5 cartridge
    remote: Starting DIY cartridge
    remote: /var/lib/openshift/53a4ecb64382ecd6640000fc/app-root/runtime/repo//.open
    shift/action_hooks/start: line 4: ../../../bin/asadmin: Permission denied
    remote: -------------------------
    remote: Git Post-Receive Result: failure
    remote: Activation status: failure
    remote: Activation failed for the following gears:
    remote: 53a4ecb64382ecd6640000fc (Error activating gear: CLIENT_ERROR: Failed to
    execute: 'control start' for /var/lib/openshift/53a4ecb64382ecd6640000fc/diy)
    remote: Deployment completed with status: failure
    remote: postreceive failed
    To ssh://54a4avb65382ecd66444432fc@web-gestorcelular.rhcloud.com/~/git/web.git/
    b7291ab..ff79e15 master -> master

    Please help me.

    ReplyDelete
    Replies
    1. I have the same problem! Can somebody help me?

      Delete
    2. (Found here : https://forums.openshift.com/running-glassfish-4-on-diy-cartridge-with-openjdk-17)

      In the start file, replace the line :
      ../../../bin/asadmin start-domain &> $OPENSHIFT_DIY_LOG_DIR/server.log
      With the following lines :
      cd ../../../bin
      mv asadmin asadmin.sh
      chmod u+x asadmin.sh
      bash asadmin.sh stop-domain &> $OPENSHIFT_DIY_LOG_DIR/server.log
      bash asadmin.sh start-domain &> $OPENSHIFT_DIY_LOG_DIR/server.log

      Delete
  5. Hi Steve, I am having same issue as Felipe Freitas. please can you help how to resolve this?

    remote: {userID} (Error activating gear: CLIENT_ERROR: Failed to
    execute: 'control start' for /var/lib/openshift/{userid}/diy)
    remote: Deployment completed with status: failure
    remote: postreceive failed

    ReplyDelete
  6. Hi

    I'm struggling when I'm uploading the start and stop files. I receive permission denied.
    I open the files and I figure out were missing the "#!/bin/bash" lines at booth files.
    After that my app compile but the welcome page doesn't appear and instead I receive the 503 error code.

    Please help

    ReplyDelete
  7. Did you get the directory structures right? GlassFish should go in "yourapp/diy/" and the hooks should go in "yourapp/.openshift/action_hooks/". Unless this changed with an OpenShift update, in which case, you'd have to check with them! In any case, I last used these steps about 2 months ago, and they still worked then.

    ReplyDelete
    Replies
    1. yes! I did everything accordingly the tutorial

      Delete
  8. I tried the steps again and they still work perfectly for me. I am using the exact same files and steps as in this post. After the git push, my output is:

    remote: Stopping DIY cartridge
    remote: Stopping MySQL 5.5 cartridge
    remote: Building git ref 'master', commit 36d173e
    remote: Preparing build for deployment
    remote: Deployment id is 712edc94
    remote: Activating deployment
    remote: Starting MySQL 5.5 cartridge
    remote: Starting DIY cartridge
    remote: Waiting for domain1 to start ...........
    remote: Successfully started the domain : domain1
    remote: domain Location: /var/lib/openshift/5467246c4382ec8298000031/app-root/runtime/repo/diy/glassfish4/glassfish/domains/domain1
    remote: Log File: /var/lib/openshift/5467246c4382ec8298000031/app-root/runtime/repo/diy/glassfish4/glassfish/domains/domain1/logs/server.log
    remote: Admin Port: -1
    remote: Command start-domain executed successfully.
    remote: -------------------------
    remote: Git Post-Receive Result: success
    remote: Activation status: success
    remote: Deployment completed with status: success

    ReplyDelete
    Replies
    1. Hi tanks for the answer. After the "Setting up the server" step e receive the 503 error code! That's normal?

      Delete
  9. Great Thanks for the post.

    For those whose server is not starting, do this :

    (Found here : https://forums.openshift.com/running-glassfish-4-on-diy-cartridge-with-openjdk-17)

    In the start file, replace the line :
    ../../../bin/asadmin start-domain &> $OPENSHIFT_DIY_LOG_DIR/server.log
    With the following lines :
    cd ../../../bin
    mv asadmin asadmin.sh
    chmod u+x asadmin.sh
    bash asadmin.sh stop-domain &> $OPENSHIFT_DIY_LOG_DIR/server.log
    bash asadmin.sh start-domain &> $OPENSHIFT_DIY_LOG_DIR/server.log

    ReplyDelete