Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Hubert Felber
Upgrade Problem with Liferay 6.1.0 on Jboss 5.1 with Derby
May 21, 2012 5:10 AM
Answer

Hubert Felber

Rank: Regular Member

Posts: 157

Join Date: November 23, 2009

Recent Posts

Hi,
I try to update from Liferay 6.0.6 to 6.1.0 on JBoss 5.1 with Derby Database
I am getting
1
212:18:52,995 ERROR [MainServlet:199] com.liferay.portal.kernel.events.ActionException: com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.
3SQLSyntaxErrorException: 'REPLACE' is not recognized as a function or procedure.
4com.liferay.portal.kernel.events.ActionException: com.liferay.portal.kernel.upgrade.UpgradeException: com.liferay.portal.kernel.upgrade.UpgradeException: java.sql.SQLSyntaxErrorException: 'REPLACE' is
5 not recognized as a function or procedure.
6        at com.liferay.portal.events.StartupAction.run(StartupAction.java:58)


Did anybody manage to successfully run Liferay 6.1.0 on JBoss 5.1?
Does anybody have an idea? I checked out the source and compiled myself.
Thanks for helping.
Hubert
Edward Richardson
RE: Upgrade Problem with Liferay 6.1.0 on Jboss 5.1 with Derby
November 26, 2012 8:06 AM
Answer

Edward Richardson

Rank: New Member

Posts: 2

Join Date: September 24, 2012

Recent Posts

Did you find a solution to this problem Hubert?

I'm having the same problem when switching Liferay 6.1.1 to use Derby.
I had a look through the Liferay source code after getting a similar error message and stacktrace and found in GroupFinderImpl.java the following code which uses the REPLACE function which does not appear to be supported by Derby...
 1protected String replaceOrderBy(String sql, OrderByComparator obc) {
 2        if (obc instanceof GroupNameComparator) {
 3            sql = StringUtil.replace(
 4                sql, "Group_.name AS groupName",
 5                "REPLACE(Group_.name, '" +
 6                    GroupLocalServiceImpl.ORGANIZATION_NAME_SUFFIX +
 7                        "', '') AS groupName");
 8        }
 9
10        return sql;
11    }


It appears that Derby can't be used because of this. Has anybody else encountered this problem and found a solution yet?
Jason Alexander
RE: Upgrade Problem with Liferay 6.1.0 on Jboss 5.1 with Derby
December 13, 2012 11:54 AM
Answer

Jason Alexander

Rank: New Member

Posts: 2

Join Date: December 13, 2012

Recent Posts

Yes, this is a problem with LR 6.1.1 and Derby. Your liferay install will be pretty crippled but some features may work.

There is a Derby JIRA entry regarding this function, but it hasn't been worked yet.

https://issues.apache.org/jira/browse/DERBY-5597
Edward Richardson
RE: Upgrade Problem with Liferay 6.1.0 on Jboss 5.1 with Derby
July 23, 2013 1:48 AM
Answer

Edward Richardson

Rank: New Member

Posts: 2

Join Date: September 24, 2012

Recent Posts

To anyone who is interested, I got around this by doing the following...

1) Create a class to do the string replacement...

 1
 2package uk.co.company.derby;
 3
 4public class StringUtil {
 5    public static String replace(final String str, final String target,
 6            final String replacement) {
 7        return str.replace(target, replacement);
 8    }
 9}


2) Create a jar for the class e.g. CustomDerbyFunctions.jar

3) Add CustomDerbyFunctions.jar to your Liferay install. I'm using JBoss 7.1 so I added mine at jboss/modules/com/liferay/portal/main. You will also need to add a resource-root definition in the module.xml file if your are using JBoss 7 too.

4) Run the following SQL against your lportal database - CREATE FUNCTION REPLACE(str VARCHAR(50), target VARCHAR(50), replacement VARCHAR(50)) RETURNS VARCHAR(50) PARAMETER STYLE JAVA NO SQL LANGUAGE JAVA EXTERNAL NAME 'uk.co.company.derby.StringUtil.replace'