Fórum

LIferay 5.2.3 and Oracle Error

thumbnail
Gordon Augat, modificado 14 Anos atrás.

LIferay 5.2.3 and Oracle Error

Regular Member Postagens: 107 Data de Entrada: 16/08/06 Postagens Recentes
Anybody using Liferay 5.2.x on Oracle? I have a strange bug that seems to happen in Oracle and not mysql.

I have an article where the structure contains and image and some other elements. When I hit save it will continue to work unless a restart liferay or clear the database cache. Then when I edit the article and hit save I get the message "Web Content is temporarily unavailable". In the log file I get the follow error...

20:04:40,404 DEBUG [SQL:111] insert into JournalArticleImage (groupId, articleId, version, elInstanceId, elName, languageId, tempImage, articleImageId) values (?, ?, ?, ?, ?, ?, ?, ?)
20:04:40,407 DEBUG [AbstractBatcher:66] Executing batch size: 1
20:04:40,507 DEBUG [AbstractBatcher:418] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
20:04:40,512 ERROR [JDBCExceptionReporter:101] ORA-00001: unique constraint (DTCORPDEV.IX_103D6207) violated

20:04:40,515 ERROR [JDBCExceptionReporter:101] ORA-00001: unique constraint (DTCORPDEV.IX_103D6207) violated

20:04:40,523 DEBUG [JDBCTransaction:186] rollback
20:04:40,526 DEBUG [JDBCTransaction:227] re-enabling autocommit
20:04:40,529 DEBUG [JDBCTransaction:197] rolled back JDBC Connection
20:04:40,531 DEBUG [ConnectionManager:325] transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
20:04:40,533 DEBUG [UpdateTimestampsCache:81] Invalidating space [JournalArticleImage], timestamp: 5110531197063168
20:04:40,540 DEBUG [ConnectionManager:464] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
20:04:40,542 DEBUG [ConnectionManager:325] transaction completed on session with on_close connection release mode; be sure to close the session to release JDBC resources!
20:04:40,586 ERROR [jsp:165] com.liferay.portal.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: Could not execute JDBC batch update
at com.liferay.portal.service.persistence.impl.BasePersistenceImpl.processException(BasePersistenceImpl.java:91)


Any Ideas?
thumbnail
Gordon Augat, modificado 14 Anos atrás.

RE: LIferay 5.2.3 and Oracle Error

Regular Member Postagens: 107 Data de Entrada: 16/08/06 Postagens Recentes
Ok...I found the problem. Not sure what the best solution is. In Oracle, when you insert a column with a value of empty string, oracle makes it NULL. So in my case, when the Liferay code was finding my image, it was passing in a languageId of empty string. However, in the oracle database it was stored as a NULL. So part of the where clause was (languageId = '') instead of (languageId is null). Since liferay determined that the image did not exist based on its flawed query, liferay code tried to insert the image. Since the image already existed, I get a index viloation exception.
thumbnail
Iñaki Paz Rey, modificado 14 Anos atrás.

RE: LIferay 5.2.3 and Oracle Error

New Member Postagens: 16 Data de Entrada: 17/01/08 Postagens Recentes
Hello Gordon,

We are dealing with the same problem right now. Did you solve the problem? How did you do it?
We are currently working on 2 options:
- Driver problem (it may be solved using oracle 11g driver designed for Java 1.6) ojdbc14 vs. ojdbc6.
- Rewritting query solving the problem you have mentioned.

Also, could you please submit the issue to http://issues.liferay.com??

Thanks,
Iñaki Paz
thumbnail
Iñaki Paz Rey, modificado 14 Anos atrás.

RE: LIferay 5.2.3 and Oracle Error

New Member Postagens: 16 Data de Entrada: 17/01/08 Postagens Recentes
OK,
We have explored a little bit more the error on the source code, and the method that originates the error is the formatImage in JournalArticleLocalServiceUtil. Especifically the method in line 2273 ends up invoking mentioned QUERY. Curiously, the elLanguage parameter always is, at least, an empty string when it should be null if the attribute is not present.


2262	                List<element> imageContents = el.elements("dynamic-content");
2263	
2264	                for (Element dynamicContent : imageContents) {
2265	                        String elLanguage = dynamicContent.attributeValue(
2266	                                "language-id", StringPool.BLANK);
2267	
2268	                        if (!elLanguage.equals(StringPool.BLANK)) {
2269	                                elLanguage = "_" + elLanguage;
2270	                        }
2271	
2272	                        long imageId =
2273	                                journalArticleImageLocalService.getArticleImageId(
2274	                                        groupId, articleId, version, elInstanceId, elName,
2275	                                        elLanguage);
</element>


Will update this if the other option works better (updating driver).
thumbnail
Iñaki Paz Rey, modificado 14 Anos atrás.

RE: LIferay 5.2.3 and Oracle Error

New Member Postagens: 16 Data de Entrada: 17/01/08 Postagens Recentes
Finally, we found our blocking problem. The DB script for oracle create-oracle.sql creates indexes on its end.
For us, the disturbing index is this one:

 create unique index IX_103D6207 on JournalArticleImage (groupId, articleId, version, elInstanceId, elName, languageId); 


Without the "unique", the problem has been solved. This is, executing this:


drop index IX_103D6207;
create index IX_103D6207 on JournalArticleImage (groupId, articleId, version, elInstanceId, elName, languageId);


It was not a driver problem, and it was really clear on the error message that the index was our problem.


12:41:33,174 ERROR [JDBCExceptionReporter:101] ORA-00001: restricción única (KAIOA.IX_103D6207) violada
12:41:33,212 WARN  [RequestProcessor:528] Unhandled Exception thrown: class com.liferay.portal.SystemException
12:41:33,215 ERROR [jsp:165] com.liferay.portal.SystemException: com.liferay.portal.kernel.dao.orm.ORMException: Could not execute JDBC batch update
        at com.liferay.portal.service.persistence.impl.BasePersistenceImpl.processException(BasePersistenceImpl.java:91)
        at com.liferay.portlet.journal.service.persistence.JournalArticleImagePersistenceImpl.updateImpl(JournalArticleImagePersistenceImpl.java:367)


Hoping I help someone else,

Iñaki
thumbnail
Gordon Augat, modificado 14 Anos atrás.

RE: LIferay 5.2.3 and Oracle Error

Regular Member Postagens: 107 Data de Entrada: 16/08/06 Postagens Recentes
Thanks, for the information. I really think the root of the problem is that Oracle uses NULL for empty strings in the database and Liferay did not account for this with the languageId for JournalArticleImage. I ended up customizing com.liferay.portlet.journal.service.persistence.JournalArticleImagePersistenceImpl in the ext environment. On line 1771, I modified the following code..

if (languageId == null) {
  query.append("languageId IS NULL");
}
else {
  query.append("languageId = ?");
}


to this...

if (languageId == null || languageId.length() = 0)  {
  query.append("languageId IS NULL");
}
else {
  query.append("languageId = ?");
}


and on line 1800, from

if (languageId != null) {
  qPos.add(languageId);
}


to

if (languageId != null &amp;&amp; languageId.length() &gt; 0) {
  qPos.add(languageId);
}


You may want to change the logic to just apply these changes if the database is Oracle.
thumbnail
Shea Brock, modificado 14 Anos atrás.

RE: LIferay 5.2.3 and Oracle Error

New Member Postagens: 9 Data de Entrada: 04/04/08 Postagens Recentes
Has anyone reported this issue @ http://issues.liferay.com/?

Dropping the index works as a temporary solution, as does patching the code, however, I'm sure we'd all love a more permanent solution emoticon
thumbnail
Lisa Simpson, modificado 14 Anos atrás.

RE: LIferay 5.2.3 and Oracle Error

Liferay Legend Postagens: 2034 Data de Entrada: 05/03/09 Postagens Recentes
I'm thinking that should be fixed permanenly as a patch... You can submit it along with the code to their Bug Tracker (go to the Issue Tracker tab)...
thumbnail
Denis Signoretto, modificado 14 Anos atrás.

RE: LIferay 5.2.3 and Oracle Error

Expert Postagens: 375 Data de Entrada: 21/04/09 Postagens Recentes
Shea Brock:
Has anyone reported this issue @ http://issues.liferay.com/?

Dropping the index works as a temporary solution, as does patching the code, however, I'm sure we'd all love a more permanent solution emoticon


It's reported as http://issues.liferay.com/browse/LPS-4792.
thumbnail
Lisa Simpson, modificado 14 Anos atrás.

RE: LIferay 5.2.3 and Oracle Error

Liferay Legend Postagens: 2034 Data de Entrada: 05/03/09 Postagens Recentes
I've voted for it. While we don't use Oracle yet, I suspect that it will be in our future.