java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper – when running jasper reports

The problem

When filling the jasper reports error java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper occurs.

Full stacktrace when generating HTML report


java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper
at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:807)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:886)
at javax.swing.RepaintManager.<clinit>(RepaintManager.java:238)
at javax.swing.JComponent.repaint(JComponent.java:4792)
at java.awt.Component.repaint(Component.java:3311)
at javax.swing.text.JTextComponent.setEditable(JTextComponent.java:1758)
at javax.swing.text.JTextComponent.<init>(JTextComponent.java:309)
at javax.swing.JEditorPane.<init>(JEditorPane.java:196)
at javax.swing.JEditorPane.<init>(JEditorPane.java:288)
at net.sf.jasperreports.engine.util.JEditorPaneHtmlMarkupProcessor.convert(JEditorPaneHtmlMarkupProcessor.java:79)
at net.sf.jasperreports.engine.fill.JRFillTextElement.processMarkupText(JRFillTextElement.java:1065)
at net.sf.jasperreports.engine.fill.JRFillStaticText.<init>(JRFillStaticText.java:51)
at net.sf.jasperreports.engine.fill.JRFillObjectFactory.visitStaticText(JRFillObjectFactory.java:654)
at net.sf.jasperreports.engine.base.JRBaseStaticText.visit(JRBaseStaticText.java:94)
at net.sf.jasperreports.engine.JRAbstractObjectFactory.getVisitResult(JRAbstractObjectFactory.java:88)
at net.sf.jasperreports.engine.fill.JRFillElementGroup.<init>(JRFillElementGroup.java:82)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.<init>(JRFillElementContainer.java:89)
at net.sf.jasperreports.engine.fill.JRFillBand.<init>(JRFillBand.java:91)
at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getBand(JRFillObjectFactory.java:514)
at net.sf.jasperreports.engine.fill.JRBaseFiller.createFillBand(JRBaseFiller.java:313)
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:266)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:73)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:61)
at net.sf.jasperreports.engine.fill.JRFiller.createBandReportFiller(JRFiller.java:186)
at net.sf.jasperreports.engine.fill.JRFiller.createReportFiller(JRFiller.java:201)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:82)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:456)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:863)

Another error which comes up when generating a pdf report


Caused by: java.lang.NoClassDefFoundError: Could not initialize class javax.swing.RepaintManager
at javax.swing.JComponent.repaint(JComponent.java:4792)
at java.awt.Component.repaint(Component.java:3311)
at javax.swing.text.JTextComponent.setEditable(JTextComponent.java:1758)
at javax.swing.text.JTextComponent.<init>(JTextComponent.java:309)
at javax.swing.JEditorPane.<init>(JEditorPane.java:196)
at javax.swing.JEditorPane.<init>(JEditorPane.java:288)
at net.sf.jasperreports.engine.util.JEditorPaneHtmlMarkupProcessor.convert(JEditorPaneHtmlMarkupProcessor.java:79)
at net.sf.jasperreports.engine.fill.JRFillTextElement.processMarkupText(JRFillTextElement.java:1065)
at net.sf.jasperreports.engine.fill.JRFillStaticText.<init>(JRFillStaticText.java:51)
at net.sf.jasperreports.engine.fill.JRFillObjectFactory.visitStaticText(JRFillObjectFactory.java:654)
at net.sf.jasperreports.engine.base.JRBaseStaticText.visit(JRBaseStaticText.java:94)
at net.sf.jasperreports.engine.JRAbstractObjectFactory.getVisitResult(JRAbstractObjectFactory.java:88)
at net.sf.jasperreports.engine.fill.JRFillElementGroup.<init>(JRFillElementGroup.java:82)
at net.sf.jasperreports.engine.fill.JRFillElementContainer.<init>(JRFillElementContainer.java:89)
at net.sf.jasperreports.engine.fill.JRFillBand.<init>(JRFillBand.java:91)
at net.sf.jasperreports.engine.fill.JRFillObjectFactory.getBand(JRFillObjectFactory.java:514)
at net.sf.jasperreports.engine.fill.JRBaseFiller.createFillBand(JRBaseFiller.java:313)
at net.sf.jasperreports.engine.fill.JRBaseFiller.<init>(JRBaseFiller.java:266)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:73)
at net.sf.jasperreports.engine.fill.JRVerticalFiller.<init>(JRVerticalFiller.java:61)
at net.sf.jasperreports.engine.fill.JRFiller.createBandReportFiller(JRFiller.java:186)
at net.sf.jasperreports.engine.fill.JRFiller.createReportFiller(JRFiller.java:201)
at net.sf.jasperreports.engine.fill.JRFiller.fill(JRFiller.java:82)
at net.sf.jasperreports.engine.JasperFillManager.fill(JasperFillManager.java:456)
at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillManager.java:863)

Environment:

  • Jasper reports 6.0.3
  • Open Jdk 8
  • Tomcat 8 on docker

Solution

Run following command from command prompt.

sed -i ‘s/^assistive_technologies=/#&/’ /etc/java-8-openjdk/accessibility.properties

Or just comment out below line in  /etc/java-8-openjdk/accessibility.properties

assistive_technologies=org.GNOME.Accessibility.AtkWrapper

JBPM – setRollbackOnly was invoked while configuration specifies user managed transactions.

The problem

you get the exception ‘setRollbackOnly was invoked while configuration specifies user managed transactions.’ When trying to close the JbpmContext because you called jbpmContext.setRollbackOnly()

Description

As the error message says, this error comes up when you have configured user managed transactions but you invoke setRollbackOnly.

User managed transaction configuration –

<service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServiceFactory"/>

As per the JBPM documentation here

Grails, Hibernate Event Listeners and ArrayStoreException

The Problem

Trying to register few Hibernate event listeners from plugin, But some how, registering the custom event listeners causes ArrayStoreException at runtime.

In plugin class

 def doWithSpring = {
	sanitizeHtmlListner(SanitizeHtmlListner)
	hibernateEventListeners(HibernateEventListeners) {
		listenerMap = ['save':sanitizeHtmlListner]
	}
    }

Listener class

class SanitizeHtmlListner implements SaveOrUpdateEventListener {
-----
}

Exception

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initialization o
f bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with nam
e 'transactionManager': Cannot resolve reference to bean 'sessionFactory' while setting bean property 'sessionFactory';
nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFacto
ry': Invocation of init method failed; nested exception is java.lang.ArrayStoreException
        at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:391)
        at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
        at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
        at gant.Gant.withBuildListeners(Gant.groovy:427)
        at gant.Gant.this$2$withBuildListeners(Gant.groovy)
        at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
        at gant.Gant.dispatch(Gant.groovy:415)
        at gant.Gant.this$2$dispatch(Gant.groovy)
        at gant.Gant.invokeMethod(Gant.groovy)
        at gant.Gant.executeTargets(Gant.groovy:590)
        at gant.Gant.executeTargets(Gant.groovy:589)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'messageSource': Initi
alization of bean failed; nested exception is

Solution

No solution is known,

This is a bug in Grails, which will not let you register SaveAndUpdateListener,  and if you do, you get this error. if you try with pre-insert, pre-update listeners it should work. I don’t know what other listeners are affected.

Reported http://jira.grails.org/browse/GRAILS-7576

See

http://grails.1312388.n4.nabble.com/Hibernate-listeners-are-not-called-for-integration-tests-td3546387.html
http://grails.1312388.n4.nabble.com/Hibernate-event-listeners-td3483795.html

A simple grails CMS inspired from drupal

I am working on creating a new CMS based on grails. The purpose is to use it for a new site I am going to launch in near future.

Features
I really like drupal, and I want not all but similar features in my CMS.

  • Create/Edit/View/Delete nodes
  • Spaces (eg news, announcements)
  • Blocks
  • Regions
  • URL aliases
  • Make creating custom content type easy
  • Comments
  • Full text search
  • File upload

No plugin architecture, revisions or full support for themes initially.

Why not weceem or any other existing CMS

Just because I want to develop my own so that I understand it and i have full flexibility.

If you have any comments/suggestions please comment here.

The future of Java servlets and web applications – JSR 340

You must be aware of the Servlet 3.0 spec,  and what cool things it brings to the java web development. If not, you can read it here Introduction to servlet 3.0 new features. Servlet 3.0 was released as part of the JavaEE6 and brings many exciting features like Annotations, web framework playability, built in file upload support and comet support. That’s the present of java web applications, many containers like Tomcat 7.x and Glassfish V3 supports Servlet 3.0 Spec.

The future of servlets

There’s yet more goodness to come to servlets , A new specification request, JSR 340 has been submitted, that will develop the new version 3.1 of java servlets.  The JSR 340 will be part of the JavaEE 7

Here’s the main theme of the Servlet 3.1 spec

  • Cloud support : The main theme of the JavaEE7 would be to improve the platform for cloud
  • Multi tenancy support : Just like cloud, multi tenancy are becoming quite popular with the SAAS applications. So in the 3.1 version of the servlets, we will see a built in support for multi tenancy that will consider the things like security, session state, resources and other isolation requirements.
  • Improved support for asynchronous request processing.
  • Utilize the Java EE concurrency APIs for asynchronous support.
  • Security improvement based on the   security enhancements in servlet 3.0 spec.
  • Take the advantage of HTML 5,  support for web sockets.

Related links

Does java miss a good HTML sanitizer ?

I have been looking for a good Java HTML sanitizer, that would let me sanitize user input based on a whitelist, and would escape other things. There are some examples here and there but none seems so complete as PHP, Ruby, Python and Pearl.
Does java really miss a robust HTML sanitizer ?
Do you know any good open source HTML sanitizer for java !
update
I have released a grails plugin html-cleaner Which is a whitelist based html sanitizer – based on Jsoup

Deleted MySql root user accidently? Recreate root account

Deleted MySql root user accidently?

Follow the steps recreate the root user.

  1. If mysql service is already running, stop it.
  2. Open the command prompt and goto MYSQL_HOME/bin directory.
  3. Run following commands


> mysqld --skip-grant-tables

Then start mysql console

> mysql –u=root

Then run following commands

> GRANT CREATE, DROP ON *.* TO root@localhost IDENTIFIED BY 'newpass' WITH GRANT OPTION;

> GRANT ALL PRIVILEGES ON *.* TO root@localhost IDENTIFIED BY 'newpass' WITH GRANT OPTION;

Then restart the mysql service and you are done.

wireframesketcher – You will love this plugin

When some one said ‘A picture is worth a thousand words’, He said true. During the early phase of the projects, I frequently have to create screen mockups and send to client for review. I have been always doing this by hand (though i knew about the tools). But when I found about the wireframesketcher I decided to give it a try, mainly because It worked within eclipse, and I am really quite satisfied by the results that now I will be using it for all the future projects.

If you are a developer and use eclipse, and you need to create screen mockups, then you must try this plugin.  Get the  trial version of the plugin.

Wait for a complete review…. I will update with some example screens

mvn eclipce:eclipse gives error – Request to merge when ‘filtering’ is not identical

Description: You get the error Request to merge when ‘filtering’ is not identical when running mvn eclipse:eclipse on a maven project

Root cause: It’s because of the change in maven eclipse plugin

solution: try this

mvn org.apache.maven.plugins:maven-eclipse-plugin:2.6:eclipse

Vote for google app engine Maven plugin

Yes, Just like you, I am also looking for maven support in GAE.

There is an unofficial GAE maven plugin here. But  It would be great if google release an official maven plugin and publish artifacts to central maven repository.

Vote here if you are looking for maven support in GAE

http://code.google.com/p/googleappengine/issues/detail?id=1296

Update: Finally My trick did the work. I posted link to this issue on mailing lists and blogs related to Java/app engine on January 7.  Since then more than 100 people have voted for the issue.  And the issue is now accepted by google.

Now we can hope for a official appengine maven plugin in near future.

Update 27-DEC-2010

Congratulations !
I just noticed that the issue has been fixed. App Engine 1.3.7 is now in Maven central and future versions will be pushed to central after each release.

See the link for How to use Maven with google plugin for eclipse.