[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[skalli-dev] Guide: how to export Skalli as an Eclipse product

Hi all,

I want to deploy Skalli in our infrastructure based on the Jetty runtime. I will define an Eclipse product and features to export it directly from my workspace. I will describe here in comprehensive all steps I had to do to make it running.

Note: When cloning Skalli from Git repo, it can be started within IDE without any problems.


There is yet a feature contained in Skalli: org.eclipse.skalli.feature. This feature does include a feature com.sap.ldi.projectportal.orbit.feature, which is NOT available in repo.
Therefore, I've replaced this by a new feature org.eclipse.skalli.orbit.feature and included the 3rdParty libraries as described in [1].

This does include 11 plugins:
org.apache.lucene.lucene-core
org.apache.lucene.lucene-highlighter
org.apache.lucene.lucene-queries
com.springsource.com.thoughtworks.xstream
com.springsource.org.custommonkey.xmlunit
com.springsource.org.xmlpull
com.vaadin
org.codehaus.jettison.jettison
org.restlet
org.restlet.ext.servlet
org.restlet.ext.xstream

If I try to export org.eclipse.skalli.feature again, it does not work, with exception:
Processing inclusion from feature org.eclipse.skalli.eclipse.feature: Unable to find plug-in: org.eclipse.core.jobs_3.5.0.v20100515. Please check the error log for more details.

I've changed the org.eclipse.skalli.eclipse.feature, to use the latest versions of o.e.core.jobs, o.e.e.preferences, o.e.e.registry, o.e.e.security, o.e.e.security.win32.x86.

Note: If we include the windows specific platform security plugin, we should also consider to include the win32_64 and macosx version of these fragments. I will dont care for the moment, as I will deploy to Linux, but I've added a bug for this [5].

If I try to export org.eclipse.skalli.feature again, I got cycle references:
A cycle was detected when generating the classpath org.eclipse.skalli.common_0.1.0.201105251413, org.eclipse.skalli.testutil_0.1.0.201105251413, org.eclipse.skalli.api.java_0.1.0.201105251413, org.eclipse.skalli.common_0.1.0.201105251413.

AFAI understand it is related to the fragment "o.e.s.common.test", which is a fragment of "o.e.s.common". This bundle depends on o.e.s.testutil, which leads to a cycle.

Q1: I do NOT know how I can specify to IGNORE the test fragment when exporting a feature/product from IDE. Any idea?

My workaround was to close this project in workspace, which does work. I had to close those projects too to avoid cycle references:
org.eclipse.skalli.common.test
org.eclipse.skalli.core.model.test
org.eclipse.skalli.api.java.test
org.eclipse.skalli.api.rest.test

Q2: The o.e.s.testing.feature does only include test o.e.s.testutil bundle. I assume other bundles are missing? For what purpose does this feature will be needed for? 

Q3: Similar question about the feature for Skalli source bundles.

I've created now a product configuration with project org.eclipse.skalli.product/skalli.product.
I've added these features to this product:
org.eclipse.jetty.core
javax.servlet.jsp.glassfish
org.eclipse.skalli.feature

I've also added missing bundles to org.eclipe.skalli.eclipse.feature:
org.eclipse.equinox.common
org.eclipse.equinox.ds
org.eclipse.equinox.http.servlet 
org.eclipse.equinox.util
org.eclipse.osgi
org.eclipse.osgi.services

I've also added missing bundles to org.eclipe.skalli.orbit.features:
javax.mail
javax.activation
javax.xml
javax.xml.stream
org.apache.commons.codec
org.apache.commons.collections
org.apache.commons.httpclient
org.apache.commons.io
org.apache.commons.logging 
org.apache.velocity
org.jdom

I've set start level for bundles:
org.eclipse.equinox.ds=1
org.eclipse.equinox.common=2
org.eclipse.jetty.osgi.boot=3

I could not set o.e.e.ds and o.e.e.common via product editor, fixed it in text mode. Not sure whether its a bug, have to investigate.

If I validate the product, all dependencies are fine now.

I want to add also the Jetty configuration files to the deployment. I've added a folder to org.eclipse.skalli.feature/rootfiles, which contains all required Jetty config files. For a simple demo mode, I've also added the workdir with a preset of data to this rootfiles area.
I've added a simple start script bin/start_skalli.sh to start it with all required options:

java -Declipse.ignoreApp=true -Dosgi.noShutdown=true -Dequinox.ds.print=true -Djetty.home=./jetty -Dlogback.configurationFile=./jetty/etc/logback.xml -jar plugins/org.eclipse.osgi_*.jar -clear -console -consoleLog -configuration ./configuration

I will export the skalli.product with following configuration:
- Root directory: skalli
- do NOT Synchronize before exporting
- do NOT generate metadata
- allow for binary cycles


When starting the deployed skalli product now using bin/start_skalli.sh, I will get the next error messages:

Loading bundle org.eclipse.skalli.api.java.persistence will result in:
java.lang.NoClassDefFoundError: javax/xml/parsers/ParserConfigurationException

I am wondering why it is working in IDE. There are slight differences running OSGi from IDE and native.
See also [2], where the same problem has been reported.
Note: you can simulate this in IDE by setting the property -Dosgi.compatibility.bootdelegation=false in skalli launch config.

The reason for NoClassDefFoundError is that the org.eclipse.skalli.api.java.persistence bundle does NOT import javax.xml.parsers package.
I see two options:
a) import javax.xml.parsers in org.eclipse.skalli.api.java bundle
b) make javax packages visible to all bundles [3]
I would prefer option a) as this would allow to use different versions of XML parser.

I will add an import for packages 
javax.xml.parsers
java.xml.transform 
org.xml.sax 
for bundles
org.eclipse.skalli.api.java
org.eclipse.skalli.core

Server starts now fine, but JSPs will not be supported, due to fragment org.eclipse.jetty.osgi.boot.jsp is missing in feature org.eclipse.jetty.core. I've added this bundle to org.eclipse.skalli.eclipse.feature.

Note: I am not sure whether this is the right place. Probalby it has to be included in product export directly, as otherwise we get a reference from eclipse.feature to a specific runtime, here Jetty.

Now server starts, but when opening a browser JSP can NOT be compiled due to:
osgi> 2011-05-27 18:50:22.582:WARN::/search/login.jsp
java.lang.NoClassDefFoundError: javax/xml/parsers/ParserConfigurationException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
...
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1352)
at org.eclipse.skalli.view.internal.filter.ConfigFilter.doFilter(ConfigFilter.java:61)
at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1323)
...
Caused by: 
java.lang.ClassNotFoundException: javax.xml.parsers.ParserConfigurationException
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:513)


I've imported now the bundle org.apache.taglibs.standard.glassfish to my workspace, and added import packages for:
javax.xml.parser
org.xml.sax
org.xml.sax.helpers
You have to update your launch config to use the bundle from workspace now and not from target.

I've also added the o.e.s.view.theme bundle to include the right icons. For an product export the folder src/main/java has been missing, which I added to the project.

Now everything is working fine, either from IDE with -Dosgi.compatibility.bootdelegation=false set, or running as product export with commandline script.

I've added a bug to support product export [4], and will add my changes as a patch set. It would be helpful, to get a review of someone of Skalli team to check whether this is the right implementation.

 
Bye, Jochen

References:
[1] http://wiki.eclipse.org/Skalli/Contributor_Guide#Required_patches_.28as_of_2011-04-26.29
[2] https://bugs.eclipse.org/bugs/show_bug.cgi?id=284739
[3] http://wiki.eclipse.org/Equinox_Boot_Delegation
[4] https://bugs.eclipse.org/bugs/show_bug.cgi?id=347536
[5] https://bugs.eclipse.org/bugs/show_bug.cgi?id=347537