Wednesday, February 18, 2009

Drupal on GlassFish using Quercus

I will explain how to get Drupal running on GlassFish in 10 minutes.

Requirements:
Database:
  1. Create the Drupal user in the database.
    GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON drupal.* TO 'drupal'@'localhost' IDENTIFIED BY 'drupal';
    Note: This is not secure and should only be used for demo.

  2. Create a new database in mySQL called drupal.
    create database drupal character set utf8;
Quercus:

Download and extract the quercus-3.2.1.war file.
jar -xvf quercus-3.2.1.war WEB-INF
Drupal:
  1. Download and extract Drupal 6.9
  2. Copy the WEB-INF directory and files from the Quercus into the Drupal directory.
NetBeans:

  1. Create a new project in NetBeans. Choose Java Web and Web Application with Existing Sources.


  2. Fill in the Name and location properties for the project.

    Note: Please make sure that you choose a different folder for the project files. Please see the image below as an example.


  3. Next select the application server, and set the Context Path. I renamed my context to /drupal


  4. Next select the Web Pages folder. This should be the top directory of the Drupal directory you extracted. This is the directory which contains index.php.


  5. Click Finish

  6. Open the project and navigate to the Web Pages folder. Navigate to the sites --> default directory. Right click on the default.settings.php file and copy. Paste the file back into the directory. Right click on the file it should be named something like default.settings_1.php, rename the file to settings.

    Note: NetBeans will append the .php to the end of the file.


  7. Right click on the project and select Properties. This will bring up the project properties. Select the Libraries Category. Here you will see the files that were included from Quercus 3.1.2 which were in the WEB-INF/lib directory.

  8. Click on Add Library and select MySQL JDBC Driver. Click OK.


  9. Finally Run Main Project (F6).


Drupal Configuration:

If you were successful, you should see the Drupal Configuration page.



  1. Select Install Drupal in English (You may choose differently based on your requirements).


  2. Fill in the database with the information we created earlier.

    • Check mysqli
    • Database Name: drupal
    • Database Username : drupal
    • Database Password: drupal


    Click Save and Continue.


  3. That will complete the database installation and bring up the Site Configuration Screen. Fill in the values and click Save and Continue.


  4. Finished. You should get an Installation Complete screen. Click on your new site.

    Note: My installation has an error message because I don't have SMTP configured on my Mac.



Congratulations! You have Drupal 6.9 running on Quercus 3.1.2 on GlassFish 2.1.

4 comments :

Pachydermus said...

John,

Have you tried Drupal with Domain Access - how do you work Drupal with Resin when Drupal is managing the various domains? Any thought or ideas would be welcome.

Thanks!

John Yeary said...

Hello Pachydermus,

I have not tried it with Domain access, nor multiple domains. I was simply trying to show that it was possible to use complex PHP based applications on Quercus. If I have further time, I will look at some of the more intricate details.

John

Barbara said...

Thank you for providing this information. It worked like a charm.

I first tried to accomplish Drupal on Glassfish following instructions that used LRWPinJava on GlassFish. I gave up that attempt because the instructions assumed the OS for GlassFish was Solaris or Linux. It began to get too complicated to translate the installation of PHP and Drupal to my Windows XP environment.

I'm not sure why the author of that post recommended LRWPinJava. Your way is much simpler and seems to work just fine.

John Yeary said...

Thanks Barbara!

Popular Posts