Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » War shared library(deploying apache jackrabbit)
War shared library [message #716532] Wed, 17 August 2011 15:58 Go to next message
Erdal Karaca is currently offline Erdal Karaca
Messages: 747
Registered: July 2009
Senior Member
I have deployed a war (apache jackrabbit), but it needs a shared library to be deployed to the shared libs folder of the application server... how do I expose the missing library (javax.jcr packaged as osgi bundle) to the war? just uploading and starting the osgi bundle does not seem to work...

This is the error message:

JCR API Not Found

The javax.jcr.Repository interface from the JCR API could not be loaded.

To resolve this issue, you need to make the jcr-2.0.jar file available in the shared classpath of the servlet container.

[Updated on: Wed, 17 August 2011 16:01]

Report message to a moderator

Re: War shared library [message #716741 is a reply to message #716532] Thu, 18 August 2011 09:43 Go to previous messageGo to next message
Chris Frost is currently offline Chris Frost
Messages: 230
Registered: January 2010
Location: Southampton, England
Senior Member

Hi,

I've added the javax.jcr 2.0.0 bundle to the EBR but it will take a while for it to show on the website, it is available elsewhere however already packaged as an OSGi bundle. All you need to do is place the bundle in one of Virgos repositories, I suggest 'usr'. Then modify the manifest of your war file to include the following.

Import-Package: javax.jcr;version=[2.0.0,2.0.0]


Obviously append this to the list if you already have some import package declarations. Please ask back if your having difficulty still.

Chris.


------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
Re: War shared library [message #716781 is a reply to message #716741] Thu, 18 August 2011 13:09 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal Karaca
Messages: 747
Registered: July 2009
Senior Member
Is it ok to use the admin web console to uplaod and start bundles, too? Or do I always have to copy bundles in a repository on the file system?

I do not want to modify existing WARs (they are to be used as-is)... is there another way to make the WAR aware of the existence of the javax.jcr bundle?
Re: War shared library [message #716830 is a reply to message #716781] Thu, 18 August 2011 14:34 Go to previous messageGo to next message
Chris Frost is currently offline Chris Frost
Messages: 230
Registered: January 2010
Location: Southampton, England
Senior Member

It depends on what you are using the bundle for. Bundles in a repository are not installed and started, they are just available in case they are needed. Bundles in the pickup directory or uploaded by the admin console are actively installed and started with any dependencies they have being resolved. (If the dependancies can't be resolved then

If the War file worked before with no problem, in something like Tomcat, where was it getting javax.jcr from if it's not in it's lib directory?

Chris.


------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
Re: War shared library [message #716865 is a reply to message #716830] Thu, 18 August 2011 15:59 Go to previous messageGo to next message
Dmitry Sklyut is currently offline Dmitry Sklyut
Messages: 272
Registered: January 2010
Senior Member
Jackrabbit.war does not have any manifest imports for javax.jcr in its MANIFEST.MF. That is the reason why jcr bundle is not getting picked up from the repository locations.
In cases like that there are 2 things you can do:

1. Repackage war file with bnd or bundlor. Basically generate proper manifest entries for it.
2. Use "org.osgi.framework.bootdelegation" or "org.osgi.framework.system.packages"/"org.osgi.framework.system.packages.extra" system properties to specify that classloaders should load/wire the package from boot/system-bundle

As #1 is not an option, to get option #2 working you can:

1. Copy jcr.jar to $VIRGO_HOME/lib/kernel (Get it here for example: http://mvnrepository.com/artifact/javax.jcr/jcr/2.0. BTW this version already has osgi headers, but we don't really want to use it as an osgi bundle)
2. Modify $VIRGO_HOME/lib/java6-server.profile to add "javax.jcr, javax.jcr.*" to the org.osgi.framework.bootdelegation property. (for this property you can use wildcards where for system.packages you have to list each package you want to wire to)

Now anytime javax.jcr is requested - usual OSGi classloading will be skipped and package will be wired to boot classloader. There are draw backs to this as you can't have multiple version of jcr (i.e. 1 and 2) available in the server.

Here is a very good explanation of above mentioned properties: http://blog.springsource.com/2009/01/19/exposing-the-boot-classpath-in-osgi/

Re: War shared library [message #717101 is a reply to message #716865] Fri, 19 August 2011 10:14 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal Karaca
Messages: 747
Registered: July 2009
Senior Member
I just tried the latest tomcat RC1 build and I cannot install the jackrabbit war package anymore:

[2011-08-19 12:05:00.105] ERROR start-signalling-4 org.eclipse.virgo.medic.eventlog.default DE0006E Start failed for bundle 'jackrabbit-webapp-2.2.7' version '0.0.0'. org.eclipse.virgo.kernel.deployer.core.DeploymentException: Web application failed to start

At least, web server 2.1.1.RELEASE seemed to install it properly...

Re: War shared library [message #717106 is a reply to message #717101] Fri, 19 August 2011 10:49 Go to previous messageGo to next message
Violeta Georgieva is currently offline Violeta Georgieva
Messages: 238
Registered: October 2010
Senior Member
can you post here the exception that causes this?
you can find the log in <Virgo-Home>/serviceability
Re: War shared library [message #717132 is a reply to message #717106] Fri, 19 August 2011 11:50 Go to previous messageGo to next message
Chris Frost is currently offline Chris Frost
Messages: 230
Registered: January 2010
Location: Southampton, England
Senior Member

Could you modify the org.eclipse.virgo.web.properties properties file located in the $SERVER_HOME/repository/ext directory. Change the WABHeaders property to have a value of 'defaulted'. That may help you out.

------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
Re: War shared library [message #719932 is a reply to message #717132] Mon, 29 August 2011 13:56 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal Karaca
Messages: 747
Registered: July 2009
Senior Member
I set that option and noticed this warning:

WABHeaders set to 'defaulted' in org.eclipse.virgo.web.properties. This option may not be supported in future releases.

Anyways, what is that good for?
Re: War shared library [message #720303 is a reply to message #719932] Tue, 30 August 2011 10:41 Go to previous message
Chris Frost is currently offline Chris Frost
Messages: 230
Registered: January 2010
Location: Southampton, England
Senior Member

Hi,

So that setting makes Virgo add some headers to help out with Web Bundles but it isn't compliant with the spec so it is going away. The problem you have run in to is a know bug and should be fixed shortly but setting the WABHeaders is a work around that solves the bug for now. It will not be required once the bug fix is in and this will happen before we remove the WABHeaders switch.

Chris.


------------------------------------------------
Chris Frost, Twitter @cgfrost
Springsource, a divison of VMware.
Previous Topic:Equinox Bundles not supported yet
Next Topic:Virgo 3 and Virgo IDE
Goto Forum:
  


Current Time: Thu Oct 02 12:28:43 GMT 2014

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

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