2011 in review

The WordPress.com stats helper monkeys prepared a 2011 annual report for this blog.

Here’s an excerpt:

The concert hall at the Sydney Opera House holds 2,700 people. This blog was viewed about 35,000 times in 2011. If it were a concert at Sydney Opera House, it would take about 13 sold-out performances for that many people to see it.

Click here to see the complete report.

Alfresco & Flash upload issue

Having issues uploading to Alfresco Share using its Adobe flash up-loader?

As weird as this sounds, try updating your installation of Internet Explorer.

Even if your not using Internet Explorer, lets be honest who still is! :)

This has solved issues that we’ve been having, machines which still had IE6 on them, when updated to IE8 the up-loader would work in both Firefox and Chrome.

It also allowed us to use Primefaces 2.2 fileUpload on the machine it wasn’t working on, after updating IE.

VisualVM problem connecting to monitor Glassfish

We had a issue getting VisualVM to connect to one of our Glassfish servers, in order for us to monitor it.

The problem was being caused by the server being behind our firewall, although the issue still existed after we had opened port 8686.

netstat -ano command was showing us that the port was open, but no reasons as to why it wouldn’t connect:

tcp 0 0 :::8686 :::* LISTEN off (0.00/0/0)

Another one of our servers which is behind an older less secure firewall was connecting fine.

After much searching & head scratching, we found that we needed to add the following line to the JVM Option within Glassfish:

-Djava.rmi.server.hostname=YOUR_SERVERS_NAME

See this Oracle blog post for the reason why this is needed.

Summary:
If you are trying to access a server which is behind a NAT – you will most probably have to start your server with the option
-Djava.rmi.server.hostname=

so that the RMI stubs sent to the client contain the server’s public address allowing it to be reached by the clients from the outside.

Glassfish JVM crash issues under Alfresco 3.4d

We’re running Alfresco 3.4d on Glassfish 3.1 / Redhat 5.7

We noticed last week that ‘Java SE Development Kit 6 Update 26′ was occasionally crashing the JVM by using all the available memory, when Alfresco was using resources outside of the JVM.

We solved this by installing ‘Java SE Development Kit 6 Update 29′.

Just thought that we would post that out there, just in case your facing similar issues and haven’t a clue what is causing them, when the JVM crashes it doesn’t post its issues into the Glassfish server.log file, as that has crashed milliseconds beforehand.

Nested subreport within iReport & JasperReports Server

iReport, JasperReports Server & subreports what a nightmare

It has taken far too long to work out how to get them to play nicely, so I thought I’d sum it up since I couldn’t find any complete information on how to do it.

There is partial information which I based the following on here

  • Connect iReports to JasperReports Server, so you can add content.
  • In the ‘Repository Navigator’ Right click on your server name and select ‘Add’ / ‘Folder’.
  • Right click on the new folder and select ‘Add’ / ‘JasperServer Report’.
  • Enter an ID, Name & Description for your report, the ID needs underscores instead of spaces.
  • Locate the main JRXML file, I’ve select one from my HDD.
  • Locate the Data Source, I’ve select one that I’ve already created on the server, its easy to create.
  • On clicking finish, a dialog box ‘JRXML validation’ might pop up, this is iReports checking your main report for any subreports, it then changes any subreports links in order to reference the file in the repository. Click continue to whatever it suggests.
  • Note this above part has changed your master file to point to “repo:subreport.jrxml” rather than what it referenced before, which was “subreport.jasper”.
  • Now if you open out your tree you’ll notice that you’ve got a ‘Main jrxml’ and your subreport in your ‘Resources’ folder.
  • If you’ve multiple nested subreports, now is the time to upload them as well, because iReports has choosen to ignore any but the first one that it found.
  • Its easier to do this on the JasperReports Server side of things, find the new report in your Repository right click and ‘Edit’ it, then click ‘Controls & Resources’ / ‘Add Resource’ now upload another ‘subreport.jrxml’ file, Click ‘Next’ and give it a Name & ID, Click ‘Next’ & ‘Submit’.
  • Repeat above for any other subreports.
  • Switch back to iReports and Refresh your ‘Repository Navigator’ tree, in order to show the files uploaded in JasperReports Server.
  • In the ‘resources’ folder right click the subreport which is referenced first in the main jrxml file & click ‘properties’.
  • Hightlight and Copy with Ctrl + C the ‘Parent Folder’ line which displays, then click ‘Cancel’. In my case I’m copying the line /XX/Report1/Report1_files/Report1-Tenure.jrxml
  • Once copied, Right click & ‘Open in editor’ on the ‘Main jrxml’ report in your tree.
  • Highlight the subreport on the main report and click on the three dots next to the ‘Subreport Expression’ property in the properties panel.
  • Replace everything after “repo: with what is copied to your clipboard. in my case I end up with “repo:/XX/Report1/Report1_files/Report1-Tenure.jrxml”.
  • Click Save icon, and Right click on the Main report and write the changes back to it by selecting ‘Replace with current document’.
  • Link up your other Nested subreports in the same fashion, loading each one in turn to the editor, changing their ‘Subreport Expression’ property and write the information back to the correct resources jrxml file.
  • Making sure that you add “repo: before the path, as that wont be there as the nested subreport wasnt found by iReports first time around.
  • Now finally you can Right click the main report and ‘Run JasperServer Report’. Your report will also work on your server.
  • Other things to note, remove any refernces to ‘$P{SUBREPORT_DIR} +’ and just reference the actual subreport, otherwise it wont be able to find the file.

Alfresco Share Document Previews

Getting Alfresco Share to correctly display document previews can be a royal pain, hopefully the following information will help you get yours to work.

The headless Open Office packages which come with RHEL5 don’t work correctly, if your using the same O/S
remove the existing installed packages & install the whole program on your server from www.openoffice.org
- This was a big part of our issues.
There are no reasons behind this, just a little bit of information here

Next install the required packages :
pdf2swf
convert

Edit:
vi /usr/local/glassfish3.1/glassfish/domains/domain1/lib/classes/alfresco-global.properties

Change so it reads:
#
# External locations
#-------------
ooo.exe=/opt/openoffice.org3/program/soffice.bin
ooo.enabled=true
img.root=/usr/local/bin
img.exe=/usr/local/bin/convert
swf.exe=/usr/local/bin/pdf2swf

Now check to see if these files that you’ve just installed in ‘/usr/local/bin’ are running correctly, we were having issues, see below:
[root@server bin]# /usr/local/bin/pdf2swf
./pdf2swf: error while loading shared libraries: libjpeg.so.7: cannot open shared object file: No such file or directory

This was because the library wasn’t been located, so we deleted/recreated any links to the missing files in both the below locations (just to make sure, as wasnt sure where each program was looking for its required library)

[root@server /]# find ./ -name libjpeg.so.7
./usr/local/lib/libjpeg.so.7
./usr/lib/libjpeg.so.7

‘/usr/lib’
libjpeg.so.7 -> /usr/local/lib/libjpeg.so.7

‘/usr/local/lib’
libjpeg.so.7 -> libjpeg.so.7.0.0

And ‘just like that’ it was working, make sure you also check where ‘convert’ is working.
It took us hours to figure out what was going wrong, so I hope this shines some light on your dark day.

SWFTools installation with freetype problem

pdf2swf is required for Alfresco global setting. We need to install swftools.

error message when try to install swftools:

./configure

. . .

freetype/config/ ftheader.h: No such file or directory

. . .

Freetype has been install at /usr/local/include/, ftheader.h is located in /usr/local/include/freetype2/freetype/config

Solution:

Add a symbolic link

ln -s /usr/local/include/freetype2/freetype     /usr/include/freetype

JasperReports Server 4.0 on Glassfish 3.1

1. Download JasperReports Server installation package

2. Unzip this package and then following the steps in chapter 5 ‘Installing the War File Distribution’ within JasperReports-Server-CP-Install-Guide.pdf.

3. If you are running Mysql 5.5, then there is an issue posted here

Scroll down the page to ‘5. Known Issues

* 21953: The JasperReports Server repository database has issues under MySQL 5.5. There is a conflict with a new reserved word: MAXVALUE. Also, the storage engine needs to be specified as engine=Innodb (instead of type=Innodb).

In order to use the command ‘maxValue‘, you need to replace with all ‘maxValue‘ lines which exist without quotes to have quotes, so ‘`maxValue`‘ and change any ‘Type=Innodb‘ to ‘ENGINE=Innodb‘, within all the *.ddl files in \jasperreports-server-cp-4.0.0-bin\buildomatic\install_resources\sql\mysql\

4. Now edit the file default_master.properties, add the following settings for glassfish

appServerType = glassfish2
appServerDir =\Glassfish3.1\glassfish

5. edit \jasperreports-server-cp-4.0.0-bin\buildomatic\bin\validation.xml

add following to line 342

<equals arg1="${appServerType}" arg2="glassfish2" />

Before this:

<if>
<not>
<or>
<equals arg1="${appServerType}" arg2="skipAppServerCheck" />
<equals arg1="${appServerType}" arg2="tomcat5" />
<equals arg1="${appServerType}" arg2="tomcat6" />
<equals arg1="${appServerType}" arg2="jboss" />
</or>
</not>

And after this:

<if>
<not>
<or>
<equals arg1="${appServerType}" arg2="skipAppServerCheck" />
<equals arg1="${appServerType}" arg2="tomcat5" />
<equals arg1="${appServerType}" arg2="tomcat6" />
<equals arg1="${appServerType}" arg2="jboss" />
<equals arg1="${appServerType}" arg2="glassfish2" />

</or>
</not>

Without this the installation script will not continue. This is probably a bug within the system.

6. Manually install data-pooling and data resources required for glassfish,mysql database username and password should be set correctly in js-glassfish-ds.xml :

when glassfish is running, use asadmin add databaseresources.

/usr/local/glassfish3.1/glassfish/bin/asadmin add-resources  /jasperreports-server-cp-4.0.0-bin/buildomatic/build_conf/default/js-glassfish-ds.xml

7.  Comment out the glassfish datasource autoinstallation script.

Edit /jasperreports-server-cp-4.0.0-bin/buildomatic/bin/app-server.xml, comment out the glassfish2 datasources option

before:


 <if>
          <equals arg1="${appServerType}" arg2="glassfish2" />
          <then>
              <runasadmin>
                  <arg value="start-domain"/>
                  <arg value="domain1"/>
              </runasadmin>
             <runasadmin>
                  <arg value="add-resources"/>
                  <arg value="${currentConf}/js-glassfish-ds.xml"/>
              </runasadmin>
              <runasadmin failOnError="false">
                  <arg value="create-jvm-options"/>
                  <arg value="${glassfishJvmOpt}"/>
              </runasadmin>                  <runasadmin>
                  <arg value="stop-domain"/>
                  <arg value="domain1"/>
              </runasadmin>    

          </then>
      </if>


after:


 <if>
          <equals arg1="${appServerType}" arg2="glassfish2" />
          <then>
             <!--  <runasadmin>
                  <arg value="start-domain"/>
                  <arg value="domain1"/>
              </runasadmin>
             <runasadmin>
                  <arg value="add-resources"/>
                  <arg value="${currentConf}/js-glassfish-ds.xml"/>
              </runasadmin>
              <runasadmin failOnError="false">
                  <arg value="create-jvm-options"/>
                  <arg value="${glassfishJvmOpt}"/>
              </runasadmin>                  <runasadmin>
                  <arg value="stop-domain"/>
                  <arg value="domain1"/>
              </runasadmin>    -->

          </then>
      </if>
...


8. Stop glassfish and Run the autoinstall command js-install-ce.bat in Windows or js-install-ce.sh in Unix. If you are using MYSQL 5.5 should use minimal argument to avoid default full installation(Default installation comes with sample data and sample table, but will bring sql insert error in MYSQL 5.5  because the java source code still use MaxValue). Use help can get all the functions.

./js-install-ce.sh minimal (unix)

js-install-ce.bat (windows)

9. All the files should then be copy to \glassfish3.1\glassfish\domains\domain1\autodeploy\jasperserver.war\

10. Create a glassfish-web.xml file in /glassfish3.1/glassfish/domains/domain1/autodeploy/jasperserver.war/WEB-INF/

Paste the following information to this file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd">
<glassfish-web-app>
<resource-ref>
<res-ref-name>jdbc/dataSource</res-ref-name>
<jndi-name>jdbc/jasperserver</jndi-name>
</resource-ref>
<class-loader delegate="true"/>
</glassfish-web-app>

<jndi-name>jdbc/jasperserver</jndi-name>” is required for glassfish3.1, otherwise the server will throw “javax.naming.NameNotFoundException: JasperServerDataBase not found” error message during deploying the web application. This is not necessary for glassfish3.0. The default setting in web.xml can be picked up by glassfish3.0.

11. Restart glassfish3.1. All should now work!

Xplorer2 integration with DirectFolders

DirectFolders is an application that makes file system folder navigation quick and easy. It’s sweet spot is when you’ve got deeply nested folders. You can create bookmarks for them which are accessible via hotkeys anytime, anyplace.

Xplorer2 is a powerful, extensively customisable replacement for Windows Explorer. The Windows 7 native Explorer specialises in making life hard for anyone using it so turned to Xplorer2 for the sake of my mental health.

There are free ‘lite’ versions of  both applications and they are well worth a test drive.

By default, DirectFolders launches the native Windows Explorer but it can be configured to launch Xplorer2 instead.

Configuring DirectFolders to launch Xplorer2

To get DirectFolders to launch Xplorer2:

  1. launch the DirectFolders ‘Configure…’ window
  2. Select the Options tab
  3. In the Misc section
    1. Select ‘Open Folder in’: Custom
    2. Enter the command to launch Xplorer2:
      C:\Program Files\zabkat\xplorer2\xplorer2_64.exe /R:%1
      Substitute the correct location of Xplorer2 for your installation.

image

 

Configuring Xplorer2 to load folders in a new tab

After making the changes above, DirectFolders will launch it’s shortcuts in Xplorer2 but it will create a new instance of Xplorer2 for each launch. To make the folders appear as new tabs in the same Xplorer2 instance do the following:

  1. Open Xplorer2 advanced options: Tools –> Advanced Options
  2. Select the Layout Settings tab
  3. Scroll down to Single Window Mode
  4. Select ‘Always open new tabs in a single window’
  5. Select OK
  6. Restart Xplorer2 and test launching shortcuts from DirectFolders. They should appear in new tabs in a single instance of Xplorer2.

image

Xplorer2 has a lot of shortcut functionality built in, so you could manage folder navigation entirely within it. I’m so comfortable with DirectFolders having used it for years that it suits me better to integrate the two.

Putty session locked up? Try Ctrl+q

If your putty session locks up and becomes unresponsive, try hitting Ctrl+q to restore it. I’ve had this problem many times but only today spotted that it happened when I hit Ctrl+s by mistake. According to this post at StackOverflow, Ctrl+s sends the XOFF instruction which results in the lack of response.

 

Follow

Get every new post delivered to your Inbox.