Alfresco 4.3.d PDFBox fatal error Java Runtime

Our JVM kept crashing as soon as we went to the ‘Document Library’ within Alfresco 4.3.d

We tracked the issue down to a uploaded PDF file which contained metadata that the shipped version of PDFBox 1.2.1 (pdfbox-1.2.1.jar) chokes on and takes out the JVM.

By replacing the pdfbox.jar with the latest version pdfbox-1.7.1.jar our issues seem to have gone.

Replace old file with new in :  /alfresco-3.4.d/tomcat/webapps/alfresco/WEB-INF/lib/

Random error we where receiving in ‘catalina.out’ shown below:

# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x59ee264a, pid=4534, tid=1553988496
#
# JRE version: 6.0_18-b07
# Java VM: Java HotSpot(TM) Server VM (16.0-b13 mixed mode linux-x86 )
# Problematic frame:
# C [libfontmanager.so+0x2464a]
#
# An error report file with more information is saved as:
# /opt/alfresco-3.4.d/hs_err_pid4534.log
#
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

2012 in review

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

Here’s an excerpt:

4,329 films were submitted to the 2012 Cannes Film Festival. This blog had 55,000 views in 2012. If each view were a film, this blog would power 13 Film Festivals

Click here to see the complete report.

Apologies for the lack of Blog Post in the 2012, 2013 will be full, I’ve loads to write about – just need to find the time.

Access JasperReports Server using LDAP

We had a few issues getting to the bottom of how to add the LDAP functionality to JasperReports.

So here is how we did it:

Open ‘applicationContext-security.xml‘ which is located in:
/usr/local/glassfish3.1.2/glassfish/domains/domain1/autodeploy/jasperserver.war/WEB-INF

This is where it is if you’ve followed our earlier blog post, how to deploy JasperReports Server 4.0 on Glassfish 3.1/3.2.

If you didn’t then it’ll be located within your JasperReports directory somewhere.

Changes:

To help you find what needs to be changed, download my version of the applicationContext-security.xml file and use some file comparing software to note the changes from the original version.

There are changes on lines:

  • 14: Unremarked the “ldapAuthenticationProvider” line.
  • 78: Enter your LDAP host “ldap://blah.blah.co.uk:3286”.
  • 83: Enter username/email address/account name here.
  • 84: Enter the password to the above account on this line.
  • 93: Enter the domain content ‘DC’ structure for your LDAP directory.

i.e.
DC=staff,DC=google,DC=co,DC=uk

Apache Directory Studio will help test the above configuration & help you find your LDAP host, ‘DC’ structure, using its search features.

Once you’ve made the changes to this file, start up Glassfish again and you will be able to login using your corporate account.

*Things to note, if you have a local account in JasperReports with the same name as the account that you’re trying to access from LDAP, access will only be granted using the local password that was set to this account – Not a password coming from your LDAP host.

Jinitiator repaint on Windows 7

When using my fix to get Jinitiator to work with Windows 7, you might of noticed that your screen is reduce to the Windows 7 basic theme.

I thought I’d write a separate post about how to fix this, as it’s something I often get asked how to do.

Click Start > Control Panel > JInitiator
‘Basic’ Tab
In the ‘Java Runtime Pparameters’ box, add this:
-Dsun.java2d.noddraw=true
‘Apply’ & click ‘Close’.

Now restart your machine.

Now on launching your website application, Windows will no longer be forced into using the basic theme.

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.