openxava / documentation / Problems

Table of contents

Problems
Session is closed by Liferay after 30 minutes of work
UTF-8 characters are not processed correctly
Logging is not shown using Liferay 5.1
Performance degradation when working much time in the same page in Liferay
Changes in the members of @Tab are not refreshed in the browser
Liferay loses JNDI
Generate PDF does not work

Session is closed by Liferay after 30 minutes of work

Using OX3.1 or better no page reloading is produced (thanks to AJAX), so if the user is working 30 minutes in the same module Liferay thinks that he has not touched the application in 30 minutes, so a message of session timeout is shown.
It's easy to configure Liferay in order to avoid this inconvenient behaviour.
First, put the session timeout to 5 minutes. Edit the web.xml file (in webapps/ROOT/WEB-INF for Tomcat):
<session-config>
    <session-timeout>5</session-timeout>
</session-config>
Edit (or create if it does not exist yet) the file webapps/ROOT/WEB-INF/classes/portal-ext.properties, adding the next properties:
session.timeout=5
session.timeout.warning=1
session.timeout.auto.extend=true
In this way the session timeout is only 5 minutes, but it is extended automatically (without any question to the user) while the browser has Liferay open.
Warning: Because a Liferay bug this configuration requires a Liferay 4.4.1 or better.

UTF-8 characters are not processed correctly

OpenXava has full support for UTF-8 or any other charset you want since version 3.1. It takes the value from file.encoding Java property and use it as encoding for web requests and responses.
If your OX application does not show or input correctly UTF-8 characters, try to put -Djava.encoding=UTF-8 as Java option for starting your application server.

Logging is not shown using Liferay 5.1

Just add a file named logging.properties to the folder properties of your project. The file can be empty.
The cause is that if Liferay 5.1 does not find this file it creates one for you, and it's configured by default for not producing logging.

Performance degradation when working much time in the same page in Liferay

This is not an issue of OpenXava. It's a problem of the JavaScript included in Liferay. Really it's affect to any AJAX application that changes the HTML without load a new page for some time.
Fortunately it's easy to fix. Edit the livequery.js file from the webapps/ROOT/html/js/jquery folder of your Liferay. Look for the registerPlugin function and comment its content. Just as follow:
registerPlugin: function() {
    /* Removed, because it produces a degradation
     * performance problem with OpenXava,
     * really with any AJAX application that uses
     * an unique HTML page
    $.each( arguments, function(i,n) {
        // Short-circuit if the method doesn't exist
        if (!$.fn[n]) return;
 
        // Save a reference to the original method
        var old = $.fn[n];
 
        // Create a new method
        $.fn[n] = function() {
            // Call the original method
            var r = old.apply(this, arguments);
 
            // Request a run of the Live Queries
            $.livequery.run();
 
            // Return the original methods result
            return r;
        }
    });
    */
},
If you are using Liferay 5.2.x the work is done, just refresh your browser then everything will work fine.
If you are using Liferay 5.1.x edit the portal-ext.properties file from webapps/ROOT/WEB-INF/classes folder of your Liferay, and add the next entry:
javascript.fast.load=false
After it, restart your Liferay. Now everything will be fast all the time.

Changes in the members of @Tab are not refreshed in the browser

OpenXava stores the user preferences for the tab in a special folder on the server running Tomcat. Whenever a user visits a tab, the layout is saved for future uses.
To reflect your code changes, remove the .openxava folder of you home folder, or the home folder of the user that starts the tomcat.

Liferay loses JNDI

With the applicattion running on Liferay, when you change the scheme by code can occur this error:
Caused by: org.hibernate.engine.jndi.JndiException: Unable to lookup JNDI name [java:comp/env/jdbc/DataSource]
    at org.hibernate.engine.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:117)
    at org.hibernate.engine.jdbc.connections.internal.DatasourceConnectionProviderImpl.configure(DatasourceConnectionProviderImpl.java:115)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.buildJdbcConnectionAccess(JdbcServicesImpl.java:260)
    at org.hibernate.engine.jdbc.internal.JdbcServicesImpl.configure(JdbcServicesImpl.java:94)
    at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.configureService(StandardServiceRegistryImpl.java:111)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:234)
    at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:206)
    at org.hibernate.cfg.Configuration.buildTypeRegistrations(Configuration.java:1887)
    at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1846)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:857)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl$4.perform(EntityManagerFactoryBuilderImpl.java:850)
    at org.hibernate.boot.registry.classloading.internal.ClassLoaderServiceImpl.withTccl(ClassLoaderServiceImpl.java:425)
    at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:849)
    at org.hibernate.jpa.HibernatePersistenceProvider.createEntityManagerFactory(HibernatePersistenceProvider.java:75)
    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:54)
    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:56)
    ... 286 more
Caused by: javax.naming.NameNotFoundException: El nombre java:comp/env/jdbc/DataSource no este asociado a este contexto
    at org.apache.naming.NamingContext.lookup(NamingContext.java:820)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:154)
    at org.apache.naming.SelectorContext.lookup(SelectorContext.java:135)
    at com.liferay.portal.security.pacl.jndi.SchemeAwareContextWrapper.lookup(SchemeAwareContextWrapper.java:193)
    at javax.naming.InitialContext.lookup(InitialContext.java:396)
    at org.hibernate.engine.jndi.internal.JndiServiceImpl.locate(JndiServiceImpl.java:114)
To fix it, edit the portal-ext.properties file from webapps/ROOT/WEB-INF/classes folder of your Liferay and add the next line:
portal.security.manager.strategy=none

Generate PDF does not work

Usually it's because the popup blocker of your browser is on. Set off the popup blocker or add your URL as an exception. Since v5.8 PDF generation works even with popup blocker activated.