Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Optional import of a hibernate's package unexpectedly became unresolved
Optional import of a hibernate's package unexpectedly became unresolved [message #1006711] Fri, 01 February 2013 14:18 Go to next message
Anton Lem is currently offline Anton Lem
Messages: 11
Registered: January 2013
Junior Member
During a migration process my web-bundle unexpectedly threw the exception:
Could not instantiate bean class [com.liferay.portal.spring.hibernate.PortalHibernateConfiguration]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.<init>(LocalSessionFactoryBean.java:189)

I turned up, that org.springframework.orm_3.1.0.RELEASE bundle discontinued to resolve the optional import org.hibernate.cfg;version="[3.2.0, 5.0.0)";resolution:="optional". I have my own handmade hibernate 3.6 distribution bundle but it was being successfully resolved earlier. I've removed the "optional" directive from the org.hibernate.cfg import in the spring.orm bundle, repacked the bundle and the exception has disappeared.
Although, I've found and fixed the problem I don't like my solution to repack an existing system bundle. And a sudden appearance of an unresolved package I don't like too. Is this a normal resolver's behavior and I misunderstand something or is this some kind of bug?
Re: Optional import of a hibernate's package unexpectedly became unresolved [message #1006740 is a reply to message #1006711] Fri, 01 February 2013 16:24 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
Anton,

What do you mean by "migration process"?

Where is the handmade hibernate 3.6 bundle resides? in repository/usr?
Is there anything inside the liferay.war/lib directory?

Regards,
Dmitry
Re: Optional import of a hibernate's package unexpectedly became unresolved [message #1006750 is a reply to message #1006740] Fri, 01 February 2013 16:44 Go to previous messageGo to next message
Anton Lem is currently offline Anton Lem
Messages: 11
Registered: January 2013
Junior Member
I'm trying to port Liferay portal to Virgo. Firstly, I deployed Liferay like a single WAR. It's working, but very slowly. After that I converted WAR to the WAB and converted included jars to bundles as many as I can. All these bundles are placed into the user repository. Two native Liferay jars remain in the main WAB liferay.jar\WEB-INF\lib\
Re: Optional import of a hibernate's package unexpectedly became unresolved [message #1006778 is a reply to message #1006750] Fri, 01 February 2013 19:05 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
Those "native liferay" jars - can you do a jar -tf just so we see what packages are in them?
Just to remove them out of the equation. As bundles will prefer packages that they have to the imported packages just want to rule out some repackaged stuff.

Also, what version of virgo do you deploy to? Would you be able to share the war and repackaged jars in case we need to run it locally? DropBox or something similar?

Thanks
Dmitry
Re: Optional import of a hibernate's package unexpectedly became unresolved [message #1006838 is a reply to message #1006778] Sat, 02 February 2013 17:47 Go to previous messageGo to next message
Anton Lem is currently offline Anton Lem
Messages: 11
Registered: January 2013
Junior Member
Hi, Dmitry!
I'm using Virgo 3.6.0.RELEASE.
I've rechecked all jars in project once again by bnd-tool and have not found any packaging problems.
I've uploaded a working snapshot of my project http://sourceforge.net/projects/liferayforvirgo/files/Liferay-6.1.1/WAB/. It must work (there is not working liferay specific log4j extension and portlets autodeployment, but these don't influence another functionality).
There is an archive containing an unworking snapshot http://sourceforge.net/projects/liferayforvirgo/files/Liferay-6.1.1/broken-WAB/broken-liferay-6.1.1-wab.zip/download. To repeat the mentioned hibernate resolving problem, you should overwrite the working snapshot by the archive content, but DON'T OVERWRITE repository\ext\org.springframework.orm_3.1.0.RELEASE.jar. This jar is specially repacked as I wrote above to fix the problem.
Thanks a lot for help!
Re: Optional import of a hibernate's package unexpectedly became unresolved [message #1006856 is a reply to message #1006838] Sat, 02 February 2013 23:38 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
Anton,

My results a somewhat different from yours.

First I was able to deploy without a problem the WAB zip file.

With the broken-liferay zip I got a bunch of import resolutions vs. a hibernate issue you described. I must be missing something.

2013-02-02 17:24:06.173] fs-watcher                   <DE0002E> Installation of bundle 'com.liferay.portal' version '6.1.1' failed. org.eclipse.virgo.kernel.osgi.framework.UnableToSatisfyBundleDependenciesException: Unable to satisfy dependencies of bundle 'com.liferay.portal' at version '6.1.1': Cannot resolve: com.liferay.portal
    Resolver report:
        A Require-Bundle could not be resolved. Resolver error data <Require-Bundle: org.displaytag; bundle-version="0.0.0">. Caused by missing constraint in bundle <com.liferay.portal_6.1.1>
             constraint: <Require-Bundle: org.displaytag; bundle-version="0.0.0">
        An Import-Package could not be resolved. Resolver error data <Import-Package: custom-sql; version="0.0.0">. Caused by missing constraint in bundle <com.liferay.util.java_6.1.1>
             constraint: <Import-Package: custom-sql; version="0.0.0">
        An Import-Package could not be resolved. Resolver error data <Import-Package: org.apache.commons.beanutils; version="[1.8.2,1.9.0)">. Caused by missing constraint in bundle <org.displaytag_1.2.0>
             constraint: <Import-Package: org.apache.commons.beanutils; version="[1.8.2,1.9.0)">
        An Import-Package could not be resolved. Resolver error data <Import-Package: net.sf.ehcache; version="[2.4.6,2.5.0)">. Caused by missing constraint in bundle <org.openid4java_0.9.5.593>
             constraint: <Import-Package: net.sf.ehcache; version="[2.4.6,2.5.0)">
        An Import-Package could not be resolved. Resolver error data <Import-Package: javax.jcr; version="[2.0.0,2.1.0)">. Caused by missing constraint in bundle <org.apache.abdera_1.1.2>
             constraint: <Import-Package: javax.jcr; version="[2.0.0,2.1.0)">
        An Import-Package could not be resolved. Resolver error data <Import-Package: net.sf.ehcache; version="[2.4.6,2.5.0)">. Caused by missing constraint in bundle <org.jamwiki-core_1.0.6>
             constraint: <Import-Package: net.sf.ehcache; version="[2.4.6,2.5.0)">
        An Import-Package could not be resolved. Resolver error data <Import-Package: it.unimi.dsi.fastutil.chars; version="[5.0.5,5.1.0)">. Caused by missing constraint in bundle <com.browseengine.bobo_2.5.0.RC1>
             constraint: <Import-Package: it.unimi.dsi.fastutil.chars; version="[5.0.5,5.1.0)">
Re: Optional import of a hibernate's package unexpectedly became unresolved [message #1006960 is a reply to message #1006856] Sun, 03 February 2013 08:39 Go to previous messageGo to next message
Anton Lem is currently offline Anton Lem
Messages: 11
Registered: January 2013
Junior Member
I successfully repeated all these steps:
1) Download and unpack Virgo 3.6.0.RELEASE http://mirror.tspu.ru/eclipse/virgo/release/VP/3.6.0.RELEASE/virgo-tomcat-server-3.6.0.RELEASE.zip
2) Download and unpack Liferay for Virgo WAB http://citylan.dl.sourceforge.net/project/liferayforvirgo/Liferay-6.1.1/WAB/liferay-6.1.1-virgo-wab.zip
3) Start Virgo and check that Liferay is working http://virgo-host:virgo-port (can take about five minutes)
4) Stop Virgo
5) Download broken Liferay WAB http://citylan.dl.sourceforge.net/project/liferayforvirgo/Liferay-6.1.1/broken-WAB/broken-liferay-6.1.1-wab.zip
6) Unpack and overwrite "pikup" and "repository/usr" directories. Don't delete the whole working user repository. You should just overwrite existing files by new files form the broken archive.
7) Start Virgo. (don't forget the -clean startup option)
8) Liferay WAB is resolved, installed but fails during its startup with the spring exception
Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.liferay.portal.spring.hibernate.PortalHibernateConfiguration]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org/hibernate/cfg/Configuration

Re: Optional import of a hibernate's package unexpectedly became unresolved [message #1006997 is a reply to message #1006960] Sun, 03 February 2013 18:08 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
Anton,

I strongly believe it is the problem with your repackaged hibernate bundle.

You have imports in there that might not be resolvable at the time of the the spring-orm bundle start up. There are 50 imports from com.liferay.portal:6.1.1 into hibernate:3.6.0.FINAL. Because spring-orm is started earlier than liferay.portal WAB and because org.hibernate imports are optional - it is free to drop them if it can't resolve them fully and it can't resolve them fully because hibernate jar can't resolve liferay imports because WAB is not started.

Chicken and Egg issue here. You might want to restructure your hibernate bundle to only have hibernate classes and also extract everything that is portal dependent from WAB and attach it as a fragment maybe.

If you start up "broken" WAB - you can clearly see in the OSGI Explorer Admin that lines from hibernate-distribution point back to the liferay WAB - and you don't want that - you want lines from WAB to point to hibernate bundle.

These are all imports from hibernate bundles that point back to liferay WAB.
Imported packages
com.liferay.portlet.social.model.impl;6.1.1
com.liferay.portlet.asset.model.impl;6.1.1
com.liferay.portlet.shopping.model.impl;6.1.1
com.liferay.portlet.dynamicdatalists.model.impl;6.1.1
com.liferay.portal.model.impl;6.1.1
com.liferay.portlet.announcements.model.impl;6.1.1
com.liferay.portlet.expando.model.impl;6.1.1
com.liferay.portlet.documentlibrary.model.impl;6.1.1
com.liferay.portlet.wiki.model.impl;6.1.1
com.liferay.portlet.messageboards.model.impl;6.1.1
com.liferay.portlet.bookmarks.model.impl;6.1.1
com.liferay.portlet.polls.model.impl;6.1.1
com.liferay.portlet.ratings.model.impl;6.1.1
com.liferay.portlet.blogs.model.impl;6.1.1
com.liferay.portlet.mobiledevicerules.model.impl;6.1.1
com.liferay.portlet.softwarecatalog.model.impl;6.1.1
com.liferay.mail.model;6.1.1
com.liferay.counter.model.impl;6.1.1
com.liferay.portlet.calendar.model.impl;6.1.1
com.liferay.portlet.journal.model.impl;6.1.1


Hope this helps.

Regards,
Dmitry
Re: Optional import of a hibernate's package unexpectedly became unresolved [message #1007008 is a reply to message #1006997] Sun, 03 February 2013 19:52 Go to previous message
Anton Lem is currently offline Anton Lem
Messages: 11
Registered: January 2013
Junior Member
Thanks a lot, I understood the cause of the problem.
Previous Topic:Configuration bundles for managed service factory
Next Topic:Initial artifact vs plan deployed in pickup
Goto Forum:
  


Current Time: Thu Oct 23 12:27:25 GMT 2014

Powered by FUDForum. Page generated in 0.02986 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software