Tuesday, 23 June 2009

The following information may be useful for anyone wanting to write an application that connects to the Daisy repository using a JMS connection. The port is tcp://[your_name_or_ip]:61616 and the username and password can be found in $DAISY_HOME/daisydata/conf/myconfig.xml

Look for this:

And the username and password are listed as attributes in the credentials element

Monday, 22 June 2009

We had noticed that when using the SimpleDocument Editor in Daisy, although attributes can be added freehand (using the html view), there was a process that seemed to be running after save that removed many attributes.

I have since discovered that editing $DAISY_HOME/dasiywiki/webapp/daisy/resources/conf/htmlcleaner.xml will allow for modifications to be made to these "cleaning" rules. For example: we wanted to be able to write out 'a' tags with class attributes within the editor. This change was made possible by editing htmlcleaner and making the following adjustments (for example):

We were having a problem with Safari and Chrome rendering our JSF pages; all the content was available, but for some reason they refused to load any of the external links to stylesheets, javascript etc. They also refused to render any markup; in fact, all they would show was all the page "content" in the default text.

Further investigation (using fiddler) made it apparent that the pages were being served with the "application/xhtml+xml" when our page templates all had an html 4.01 strict doctype. This caused the WebKit browsers to ignore any links to external assets while Firefox and IE seemed to render the page as expected.

We discovered that creating templates that looked like (where the contentType is specified inside the f:view tag as early as possible) seemed to solve the issue:

Go to the Java EE perspective and create a new project to get the "New Project" wizard to appear. Expand out "Web" and select "Dynamic Web Project". Give the project a name.

The "Target Runtime" should be GlassFish v3 Prelude, The Dynamic web module version should be 2.5 and select JavaServer Faces v1.2 Project as your configuration option.

Choose "Next" for the Source folders option and "Next" for the Web Module settings.

For the JSF Implementation Library settings, click on the "Manage Libraries" link (it's the icon on the right, just below the "Type" dropdown list), Select "New", create a name (e.g. "Mojarra") and check the System Library checkbox. Select OK and then highlight the library you just created and select "Add JARs". Navigate to the folder where you unpacked Mojarra and go to its lib folder. Select both jsf-impl.jar and jsf-api.jar and then select "Open".

Both JARs should be visible under the library you created. Select "OK" and now check the library you just created and select "Finish". You should now be ready to start coding.

To create a simple JSF example project:

1. Right-click on your Java Resources:src folder and select New > Other. Expand out "General" and select "File" and select "Next". If it asks you to select a "parent folder", just select the src folder for the project you just created. The file should be called messages.properties. In that file, add a line: greeting=JSF is working and save the file.

2. in WebContent/WEB-INF/web.xml, find the <servlet-mapping> and make sure it looks like this:

3. Right-click on WebContent and select "New" and "JSP". Name it "index.jsp". You should have a basic html template page.

Right-click on the project and select Run As > Run on Server. Ensure you're running it on GlassFish Prelude v3 (if you are working from my previous post). You should now be able to go to localhost:8080/%the_name_of_your_project% and you should see the message from the config file: "JSF is working".

Saturday, 20 June 2009

These are rough notes for getting Eclipse Galileo (3.5) and GlassFish 3 Prelude to work together for deploying and developing JSF applications. I've encountered a few issues still with both of these things but am pleased to say that once you're up and running, you can be very productive, so it's worth taking the steps to get the environment set up.

I'm working on the premise that the user has the JDK1.6 already installed in OSX - to confirm this, you can check for the presence of this folder: /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home

I'm also writing these notes before Galileo is released (should be released 4 days from time of writing)

3. Once the glassfish installer has completed, start Eclipse and confirm that you have a Java 1.6 JDK registered. To do this, go to Eclipse > Preferences > Java > Installed JREs. If you can't see anything that says something like "JVM 1.6.0" select "Add..." and choose MacOS X VM then Next.

The JRE Home should be /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Home

And the choice of name is up to you.

4. Next you will need to install the GlassFish adapter. Go to Help > Install new Software. Select "Add" and add this location: https://ajax.dev.java.net/eclipse. Once that's done, you should see an option for "Glassfish Java EE5 and Java EE6 support". Select that and Next or Finish. Eclipse will require a restart.

5. To add the GlassFish server, first ensure you're in the Java EE perspective and locate the tab marked "Servers", right click, select New > Server. Open out the GlassFish options and select GlassFish v3 Prelude.

For the JRE, make sure you're choosing the 1.6.0 JVM and your application directory should be something like: /Users/%yourusername%/glassfishv3/glassfish. I had to select Install Server too.

6. Once that's completed, you can highlight the listed server and hit the green start button. A brief visit to localhost:8080 should confirm this.

Tuesday, 16 June 2009

Just wanted to make these notes before I forget - the aim here was to create a vhost (or potentially several vhosts) which map to different projects hosted on (some kind) of servlet container like glassfish:

1. Install or upgrade to the latest version of Apache http server (Apache 2.2)2. edit your hosts file (C:\WINDOWS\system32\drivers\etc) to add the name for whatever you need to proxy (as per usual vhost settings):

3. edit httpd.conf (For Windows, it should be in C:\Program Files\Apache Software Foundation\Apache2.2\conf\httpd.conf):

ensure both

Are uncommented in order for proxying to work correctly.

Also ensure the httpd-vhosts.conf include is being "Included" by uncommenting:

Friday, 5 June 2009

We were having a problem where we were trying to deploy a webapp on glassfish 2.1; the app itself was compiled with Java 1.6 and glassfish was being launched with Java 1.5. It should be noted that in this case we were trying to launch glassfish from within IntelliJ IDEA.

If you're having the same problem, go into your {glassfish home}/config/asenv.conf and check to see whether this value is pointing to an earlier version of the JDK. It should be: