Question

I have inherited an application written in java for the RCP framework (eclipse).

The code comes complete with build system (maven), and pom files, and everything seems to build.

The final application exe cannot run however. I get a popup with an error, and then a link to a log file describing numerous error. Problem is, I'm very new at RCP, I pretty much don't know what OSGI is, and I don't understand all of maven. So I have difficulty trying to figure out what the problem is, or even where to begin.

The log file starts out like this:

!ENTRY org.eclipse.osgi 4 0 2013-10-14 13:38:14.717 !MESSAGE Application error !STACK 1 java.lang.RuntimeException: Application "com.company.prod.app.rcp.application" could not be found in the registry. The applications available are: org.eclipse.equinox.app.error, org.eclipse.help.base.infocenterApplication, org.eclipse.help.base.helpApplication, org.eclipse.help.base.indexTool. at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:242) at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:368) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:559) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:514) at org.eclipse.equinox.launcher.Main.run(Main.java:1311)

!ENTRY org.eclipse.osgi 2 0 2013-10-14 13:38:14.751 !MESSAGE One or more bundles are not resolved because the following root constraints are not resolved: !SUBENTRY 1 org.eclipse.osgi 2 0 2013-10-14 13:38:14.751 !MESSAGE Bundle update@plugins/com.company.prod.app.data_2.0.5-SNAPSHOT.jar was not resolved. !SUBENTRY 2 com.company.prod.app.data 2 0 2013-10-14 13:38:14.751 !MESSAGE Missing imported package microsoft.sql_0.0.0.

!ENTRY org.eclipse.osgi 2 0 2013-10-14 13:38:14.778 !MESSAGE The following is a complete list of bundles which are not resolved, see the prior log entry for the root cause if it exists:

It then goes on to list each and every package in the application, listed as version 0.0.0. I'm assuming that version number has something to do with the problem, since they all of course don't have version 0.0.0.

Searching through all pom.xml files will not list a single dependency as version 0.0.0.

I don't understand where the microsoft.sql_0.0.0 imported package that is mentioned as the "root" cause comes from. I know that the code uses microsoft.sqlserver. It is imported in one java file, like this:

import com.microsoft.sqlserver.jdbc.SQLServerException;

And the package containing that import statement has microsoft.sqlserver listed as a dependency, like this:

<dependency>
  <groupId>com.microsoft.sqlserver</groupId>
  <artifactId>sqljdbc</artifactId>
  <version>4.0</version>
</dependency>

Also, there is a "bundle" (?) somewhere that exports it, like this:

<Export-Package>
    org.hsqldb.*,
com.microsoft.sqlserver.*
</Export-Package>

So, to me it seems to be exported, and imported correctly. But I don't understand maven that good (or is it an osgi or rcp error? not even sure).

Also. I have sqlserver.sqljdbc in my maven repository, at:

.m2\repository\com\microsoft\sqlserver\sqljdbc\4.0

Any hints at how to try and solve this will be appreciated.

Was it helpful?

Solution

Ok, here's some stuff I did to make it work. Not sure I understand everything still, but at least the application can run now.

I failed to notice that the missing import was microsoft.sql and not com.microsoft.sqlserver. I don't know what microsoft.sql is, or how it's automatically added to the imports in the manifest file, but it is (maybe it's used by com.microsoft.sqlserver.XXXX?). Adding microsoft.sql to the export-package solved the problem.

I don't believe my problem had anything to do with the version 0.0.0. It seems that is just the default version, and must be explicitly declared on the export/import section to be changed, which is never done anywhere. I had it mixed up with the sections. I wasn't aware what OSGI was, and that the project was using the felix plugin.

OTHER TIPS

Ok... I think you should start to understand how Maven works, first. Did you read the Maven documentation? When I worked with Maven the first time, I wrote a small application, using Maven to include all jar dependencies.

As a short, hopefully simple explanation: With Maven you can manage dependencies outside the project in such a way, that needed artifacts (i.e. 3rd party JARs, like de Microsoft SQL driver package) are stored in the Maven repository and retrieved if needed. With this you can build a central hub for managing artifacts for your builds, also in different versions. The 0_0_0 ist the declared version - please see the dependency declaration.

After all that, I think it would be helpful to read the OSGi article on wikipedia (if you haven't already) and start with an eclipse RCP tutorial. The eclipse RCP framework really is complex, so plan accordingly. Unfortunately this isn't something learned in two or three afternoons.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top