Issues with start levels for gogo console bundles - osgi

I just migrated an older OSGi project to the current equinox version (Kepler SR1). When using the gogo console I encountered a problem when starting the gogo bundles with start level 1 (that's what I usually do with all relevant framework bundles). The gogo console won't startup though all four bundles are active and running. Typing help would result in a NullPointerException. The solution is to start all gogo bundles with the default start level. Did I miss anything or is this just a case of bad design of the bundle lifecycle? Bundles should not depend on start levels in order to work.
Mike

It's possible to run Equinox and have all bundles started with a start level of 1. Using the following start configuration works as expected:
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -console -clean"/>
<stringAttribute key="target_bundles" value="org.apache.felix.gogo.command#1:true,org.apache.felix.gogo.runtime#1:true,org.apache.felix.gogo.shell#1:true,org.eclipse.equinox.console#1:true,org.eclipse.osgi#-1:true"/>
Bear in mind that Eclipse caches a lot of stuff with its product launches, and very often errors can creep in by virtue of the fact it doesn't get rid of the workspace between launches. This can sometimes cause errors like the one you've seen above. You can delete the launch configuration which will also clean the associated folders, then add it back in again afterwards.
To verify that this works as expected, create a new runtime configuration as an OSGi Framework and add the four bundles, with the start level 1 and autostart true.
Note that the org.eclipse.osgi bundle is the framework bundle, and should have a start level of -1 to indicate the default; perhaps that is the problem you're seeing.

I found the reason for the exception:
We are using some old style CommandProviders. There seems to be a bug in the equinox.console bundle when printing the help for the legacy commands. The set of legacyCommandProviders in the class org.eclipse.equinox.console.commands.HelpCommand seems to contain null-entries (for whatever reasons) which lead to the exception. This only occurs sometimes. Seems we need to convert our legacy commands... :-(

Related

i am getting error when i try to create web service client in Spring STS

i am getting this error when try to create new web service client.
IWAB0503E Unable to update Java build path. Please check your system environment.
Some web searching uncovered that what this error really means is “The Web Services generation tool detected multiple versions of the javax.xml.soap plug-in installed. Resolve this error by removing the conflicting plug-in.”
Sure enough, when I checked in Eclipse there were two versions.
WebService
I encountered two speed bumps when testing this theory:
There’s no easy way to uninstall a plug-in within the Eclipse UI, so I had to resort to removing the directory from eclipse\plugins directly from Windows Explorer.
Which version should I remove? It took me two tries to figure out which version was causing the error. Turns out that newer is not always better…in this case 1.3 was at fault and 1.2 (javax.xml.soap_1.2.0.v200905122109) was the version to keep.
This is old but, in my case the details of the error were:
IWAB0503E Unable to update Java build path. Please check your system environment.
java.io.FileNotFoundException: /lib/saaj.jar
So \lib\saaj.jar was not found in folder
C:\sts-4.8.0\sts-4.8.0.RELEASE\plugins\javax.xml.soap_1.3.0.v201105210645\
I created the folder lib and copied saaj.jar in it from another STS instance that I had and then it worked.

Grails auto-compile on edit

I have been writing grails applications on Windows, and when I am editing the .groovy files and save they are automatically compiled while the application is running and the changes are available without restarting the app. On OSX this is not happening, in neither interactive mode or by starting the application with grails run-app.
Looking up online I couldn't find a reason for this, and also I know other people working on OSX where this feature works.
Any suggestions as to what might cause this?
Grails 2.3.7
OSX 10.9.4
Java 1.7.0_55
If you are not running in forked mode, you will need to specify the -reloading explicitly.
Starting at some point, the initial JVM has reloading disabled and forks a new JVM with options specified in the grails.project.fork = [...] in BuildConfig.groovy.
As an alternative to passing -reloading each time, you can also modify the startGrails script included with the distribution and change the following option to false:
DISABLE_RELOADING=false
For me, the startGrails script is found in the GVM directory at ~/.gvm/grails/2.3.11/bin/startGrails.

Starting an Existing Java project that has not been documented

I have only worked on projects that I started from scratch, but now I got to work on a pre-existing project(Web applicaation) with no documentation and no guidance. All the folks that worked on the project are gone, and my client wants me to start working on the project.
I need the best Steps to do this, and start running it in my IDE.
Is there any efficient and non-time consuming method to start out? Any tools that might help?
All I got so far-->
1)Project.EAR file --> (module) one War file. (backup exported from server)
2)Versions used--> Java1.4, Websphere app server v5.1, Sapjco Connectors.
3)jars in lib folder(Frameworks) list.
acegi-security-1.0.2.jar
activation.jar
antlr.jar
antlr-2.7.6.jar
asm.jar
aspectjweaver-1.5.2.jar
cglib-2.1.3.jar
chartengineapi.jar
clickstream-1.0.2.jar
com.ibm.icu_4.0.1.v20090415.jar
commons-beanutils.jar
commons-cli-1.0.jar
commons-codec-1.3.jar
commons-collections.jar
commons-dbcp.jar
commons-digester.jar
commons-fileupload.jar
commons-io.jar
commons-lang.jar
commons-logging.jar
commons-logging-1.1.jar
commons-pool.jar
commons-validator.jar
coreapi.jar
crosstabcoreapi.jar
dataadapterapi.jar
dataaggregationapi.jar
dataextraction.jar
displaytag-1.1.jar
dom4j-1.6.1.jar
dteapi.jar
dwr.jar
ehcache-1.2.3.jar
emitterconfig.jar
engineapi.jar
flute.jar
itext-1.3.3.jar
jakarta-oro.jar
jaxen-full.jar
js.jar
jstl.jar
jta.jar
log4j-1.2.11.jar
mail.jar
modelapi.jar
modelodaapi.jar
odadesignapi.jar
org.apache.commons.codec_1.3.0.v20080530-1600.jar
org.eclipse.emf.common_2.5.0.v200906080927.jar
org.eclipse.emf.ecore_2.5.0.v200906080927.jar
org.eclipse.emf.ecore.xmi_2.5.0.v200906080927.jar
org.w3c.css.sac_1.3.0.v200805290154.jar
oscache-2.3.2.jar
sapjco.jar
saxpath.jar
scriptapi.jar
servletapi-2.3.jar
sitemesh-2.2.1.jar
spring.jar
spring-batch-infrastructure-1.1.2.jar
spring-mock.jar
standard.jar
struts.jar
struts-el.jar
struts-menu-2.4.2.jar
taglibs-datetime.jar
taglibs-mailer.jar
taglibs-string.jar
urlrewrite-3.0-beta.jar
utility.jar
velocity-1.4.jar
velocity-tools-view-1.1.jar
I know starting out is always time consuming. But i need better way to start this project
NEED:--
1) What frameworks used in this project.
2) Whats the best way to start. (Clear steps please)
3) Which (open source)Server I can use as alternative to Websphere v5.
Regards.
Edited
Jars added (sorry i forgot to mention some jars in lib)
"Write once, run anywhere" unfortunately doesn't mean you can compile the source code or start the result without errors.
The first step is probably to identify which IDE was used to develop the project with. Look for some specific files:
.project and .classpath -> Eclipse
*.ipr -> IDEA
pom.xml -> Maven
Import the project using the original IDE (make sure you use the same version if you can) so you can start and compile the project without errors.
If there are no such files, curse the people who did it. If they still work at your place, get in touch with their manager and give them input for the next performance interview ("leaves project zombies behind").
If you run into big trouble doing this step: Ask colleagues for help. Web projects are all similar but there are many subtle problems to get them working, so it's much more effective to pair with someone than, say, asking here.
You can also try to locate the original team members; they probably haven't all left the planet. Google is your friend here and maybe someone at your company stayed in contact.
Now your questions:
What frameworks used in this project.
Lots. Apparently, they just took whatever they needed. That said, this list looks pretty common for most web projects that go beyond "hello world."
Whats the best way to start.
See above.
Which (open source)Server I can use as alternative to Websphere v5.
WebSphere has a lot of .... "features" which can't be found anywhere else.
I suggest to try to get the app working with WebSphere first and then try Tomcat or Jetty.
In order not to get insane with WebSphere's startup times, get a powerful machine with lots of RAM, install it locally and use scripting to configure/control WebSphere (at the bottom of the page are scripts for WebSphere 5).

Passing arguments to OSGi application

I'm in a team that is converting a suite of Java applications to use OSGi. Previously, we used our own home-brew class loader system that has some similarities to OSGi, but it was nothing but trouble; we expect that by moving to using a system like Apache Felix we can have a system that works better while requiring less overall effort on our part to support.
We have been converting the modules that make up the applications into OSGi bundles, a largely painless affair with the use of Spring DM.
However, we — well, I as it's my responsibility in the team — need some way to reliably produce applications from this via a tool like Maven (or Jenkins); having a redistributable application installer that will install everything for the user is an absolute requirement. (We know our userbase fairly well; they want a simple install that won't download extra things after installation, well, not unless they decide to install extra plugins, but that's another story.) We do not wish to have to build the application manually at a console, or by using a GUI, as manual processes are too likely to run into silly human errors; we want to get it right and debugged once.
Moreover, some of the applications in our suite have to take command line arguments “like a conventional application”. (The application in question does significant processing internally, and sometimes needs to be invoked from other processes, such as web portals.) I know this causes some issues with the default Felix main, which only allows command line arguments for its own purposes instead of providing a way by default to export those to the bundles. (I know we could wrap things with a shell script so as to pass them in as properties, but… ewwww… there's got to be a better way. I suspect that making a custom main that exports a service providing access to the command line arguments is the best method.)
So, my question is what is a recommended way of building whole OSGi applications automatically, and am I using a reasonable approach to provide the command line arguments?
I'm guessing your best option is to write your own main that does specifically what you want. Since OSGi R4.2 the launching API is standard and pretty straightforward. You can just start from Felix' Main since it is already generic (i.e., it can launch any R4.2 framework, such as Felix or Equinox) and change it how you wish.
If the command line args represent configuration properties, you could just push them into Config Admin. Otherwise, just expose them how you see fit.
The Apache Sling Maven Launchpad Plugin generates a finished OSGi app from a list of bundles to include, and the Sling installer can be used to include initial configurations as well.
Even though they come from the Sling project, those module do not require your app to use the Sling app model, they are just used to build, launch and configure it.
For your arguments, use metatype. It will allow your bundles to load with default values and when the user configures the bundle via the web console or config files, metatype will inject the values into your variables. An installer would also be able to set these values at install time via the config files.

Problem in plug-in development: Eclipse 3.4 can't find a bundle that is definitively there!

Today I had a problem with my old Eclipse 3.4 installation and I had to re-download the entire package. However, I don't think that I got the exact package as before, and I'm having some problems.
The problem can be summarized as follows: when developing a plug-in, I cannot resolve dependencies towards 'org.eclipse.jdt.ui'. When trying to add the missing plugin, in the dialog the closest match is 'org.eclipse.jdt.ui**.source**'. A similar thing happens with other core plugins.
In order to test, I created a new plug-in using the wizard and I obtained a non-compiling plugin: one of the classes uses the class org.eclipse.jdt.ui.JavaUI and it cannot be resolved. Similarly, the MANIFEST.MF includes a dependency towards 'org.eclipse.jdt.ui', but the 'Bundle 'org.eclipse.jdt.ui' cannot be resolved'.
Now a summary of my platform:
I'm running Mac OS X 10.4 Tiger and Java 1.5.0_19-138
I'm running Eclipse Version: 3.4.1 Build id: M20080911-1700
I downloaded the modeling package, which comes in a file called 'eclipse-modeling-ganymede-SR1-incubation-macosx-carbon.tar.gz'
I've performed a fresh installation, in a new folder and using a new workspace.
If I look at the Plug-in Registry view, I can find the 'org.eclipse.jdt.ui' plugin in there, and it appears to be running. By the way, if it is disabled, then the workbench breaks and stops working.
I cannot understand what is happening. Is my installation broken? I wonder if the Eclipse package that I downloaded has an error and they included the sources instead of the compiled files. But in that case, the plug-in shouldn't be working in the workbench, isn't it?
In any case, why I cannot find the plug-in when I'm adding the dependencies, even if I see it in the Plug-in Registry?
Thanks for your help!
Problem solved: just restart the computer.
I don't restart my computer very frequently, so it took me a lot of time to find out that this was the solution. After I restarted it, everything started to work perfectly again. It seems that either Eclipse leaves something in the memory after running, or that some of my initial failures had left something nasty behind. In any case, I had checked and there were no Eclipse related processes running .... weird, but at least now it's fixed!

Resources