Spring IDE Bean Graphs is blank for blueprint configuration file - spring-tool-suite

I have installed Spring IDE 3.7.2 (Core + OSGi Extension), in Eclipse Mars SR1 Java EE.
I am writing blueprint bundles, and the tooling seams to work except for Beans Graph, who remains empty (with no errors in error log),
With a similar configuration for spring, the beans graph is displayed
After investigating this, it seems there is no org.springframework.beans.factory.xml.NamespaceHandler implementation provided for http://www.osgi.org/xmlns/blueprint/v1.0.0 namespace.
I manage to write a "quick and dirty" implementation based on one I found in eclipse gemini blueprint as a proof of concept
Is it something you could be interested in as a contribution ?

Related

can equinox be used outside of eclipse?

I'm looking to understand osgi and find it confusing that every tutorial requires eclipse or is developed using eclipse (which complicates my understanding)
Is it possible to work with equinox without eclipse and is there an example of how this can be done?
You can create OSGi applications without eclipse. What you see in many tutorials is using the Eclipse Plugin Development Environment(PDE) for OSGi development. This is one way but not the only.
In many Apache projects like Apache Karaf you can see a very different maven based OSGi development. In this case you create normal maven projects and simply add a plugin to enhance the jar with the OSGi metadata. For simple bundles this is all you need.
As an example see the karaf examples and tutorials. In the case of karaf as a OSGi server you have the choice between equinox and felix for the OSGi framework.
A third approach is using bndtools. This again is a eclipse plugin and maven plugins but a completely different development workflow than PDE. The new examples for bndtools are also maven based like in Apache Karaf but they use a different assembly. As an example see this. It can be built with just maven but using the bndtools eclipse plugin makes it easier.
While Karaf uses features as primary assembly unit bndtools uses a OSGi repository + requirments.
So you have the choice of three different styles. Each with different pros and cons.
Especially the karaf style is also very applicable for intellij.
OSGi is a standard. Equinox is an implementation of this standard. As it is mentioned on Equinox homepage, equinox is even the reference implementation (http://www.eclipse.org/equinox/) :
The Equinox OSGi core framework implementation is used as the reference implementation and as such it implements all the required features of the latest OSGi core framework specification
As a consequence, yes it is possible to use other OSGi implementations : Apache Felix, ... (see https://en.wikipedia.org/wiki/OSGi_Specification_Implementations ). If you choose Felix, you will no longer use Equinox. But both implements the OSGi specification : https://osgi.org/javadoc/osgi.core/7.0.0/
In addition, you must distinguish the OSGi implementation from the development environment you choose (IDE). Eclipse is an ambiguous term that fits both. Even if you choose Felix implementation, you can code in eclipse.
I think that if most of the samples you find are based on eclipse Equinox and developed in Eclipse, it the result of the fact that :
- Equinox is the reference implementation of OSGi
- Eclipse IDE includes many tools to develop OSGi application through the PDE (Plugin Development Environment : https://www.eclipse.org/pde/ )
In conclusion, I would say that Eclipse probably cumulate the best IDE & implementation to work with OSGi. As far as I can see, it's a good thing for you to follow eclipse based tutorials, just remember that equinox is an OSGi implementation that you could replace by another like Felix.

What is the difference between Eclipse with Spring IDE plugin and Spring Tool Suite alone?

What's the difference between these
Eclipse with the Spring IDE plugin
Spring Tool Suite (STS) alone
I ask because STS says it's built on top of Eclipse, and I wonder what differences it has over simply using a plugin that adds similar functionality to "vanilla" Eclipse.
It's true, STS is built on top of Eclipse. The difference is only related to another products support from the STS installation, like Roo, Pivotal tc Server, Cloud Foundry and getting started guides, but you could also include this features in your Eclipse installation.
So STS gives a complete solution around Spring features and simplifies the developer environment install, that's the key difference.
As Martin Lippert explains in the forums:
"So you can end-up having the same features in STS and your existing
Eclipse installation after installing the STS features into it."
You could find more details on the Spring forums.
Details on features: STS features and Spring IDE plugin features.
Spring Tool suite has ready to go features specially designed to spring supported projects and cloud environment. And Eclipse is more generic where we've to add the plugins and extensions for our platform setup.
There is already an article about this in DZone Spring IDE and the Spring Tool Suite - Using Spring in Eclipse.
While the Spring IDE project provides a set of plugins for the Eclipse
IDE, the Spring Tool Suite comes as a ready-to-use distribution of the
latest Eclipse releases with the Spring IDE components pre-installed.
This includes the tc Server integration for Eclipse (another IDE
extension that is provided by Pivotal as an open-source project) and
various other additions to Eclipse that turn the pure Eclipse IDE into
a ready-to-use, best-of-breed environment for enterprise Spring
application development.

Enable weaving in an Eclipse RCP application

I use EclipseLink 2.4.1 in an RCP application. When starting the application I get warning messages like
Reverting the lazy setting on the OneToOne or ManyToOne attribute [...] for the entity class [class ...] since weaving was not enabled or did not occur.
The reason is explained here and here. The answers point to the eclipse link documentation and the eclipse link user guide. The solution to enable dynamic weaving is
... the EclipseLink agent must be used when starting the Java VM.
java -javaagent:eclipselink.jar
My question is
Do I have to include the bare jar eclipselink.jar in my distribution (where?) or is it sufficient to add a dependency to some special eclipse link plugin, e.g. to org.eclipse.equinox.weaving.hook?
After further research I see that Gemini/JPA may be a solution. However, I'm still puzzled how to get all pieces together.
Yes, Gemini JPA is the way forward as it provides Enterprise OSGi JPA support with EclipseLink. It also supports weaving using standard OSGi byte code weaving.
You can get Gemini JPA help on the forum: http://www.eclipse.org/forums/index.php?t=thread&frm_id=153
--Shaun

How to use spring-roo entities from Eclipse RCP/RAP project

I have created a domain model using spring-roo, which makes heavy use of Spring and AspectJ. My model is deploying nicely as a OSGi bundle, and from the Spring STS (eclipse-based) IDE, I can call the entity classes, etc.
I need to access these domain classes from a Eclipse RCP/RAP application, and this project I keep in the normal Eclipse IDE for RCP/RAP development (i.e. it has all the PDE tools). I also added the STS and AspectJ plugins.
I added my domain bundle to the target platform, and made my Eclipse RAP app dependent on it. When I run the RAP application, I can see that my domain bundle is deployed in OSGi (i.e. it is ACTIVE). I also see that it exists in the PDE editor when I added the dependency.
However, when I try to import and use any of the domain classes, I get nothing. I can't even see the domain packages from my Java file editor.
I have tried to add a AspectJ and Spring nature to my RAP project, but still nothing.
Also, when running the Eclipse RAP application, everything deploys fine, except the RAP application, which throws the following exception:
Mar 2, 2010 2:44:58 AM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from URL [bundleentry://168.fwk1096264275/META-INF/spring/applicationContext.xml]
Exception in thread "SpringOsgiExtenderThread-2" java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.close(DependencyWaiterApplicationContextExecutor.java:345)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.fail(DependencyWaiterApplicationContextExecutor.java:401)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:287)
at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:175)
at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:175)
at org.springframework.osgi.extender.internal.activator.ContextLoaderListener$2.run(ContextLoaderListener.java:718)
at java.lang.Thread.run(Thread.java:637)
Any help would be highly appreciated.
Maybe you should try not to build Roo project to jar, but reference this project from your RCP project.

Eclipse plugins for Spring / Hibernate development?

I have a running dynamic web project in Eclipse (Java EE + Maven + Spring). I am at the point where I need to integrate a persistence layer and want to use Hibernate with a MySql database.
I am wondering what plugins would be useful for me at this point? For Hibernate should I install hibernate tools or is it not necessary? Are then any plugins that are most widely use for connecting / exploring database connections that would be appropriate for the type of project I am working on? Thanks.
Hibernate Tools is definitely a nice plugin (that provides wizards, a nice console useful to setup the HQL queries, a mapping editor, etc). I'm actually tempted to say: why not using it? I use it in conjunction with the database support provided by the Eclipse Data Tools Platform (that is included in the Eclipse IDE for Java EE Developers or available via the update manager). In your case, I would maybe just consider using SpringSource Tools Suite as base instead of a vanilla Eclipse.
Update: As reminded by BalusC in a comment, the Hibernate Tools also include a database reverse engineering tool which is maybe the most powerful feature. I should have mentioned it, this is now fixed.
You can look at http://fast-code.sourceforge.net/ as well. You can create FooService and FooServiceImpl and the configurations just by typing foo. It has nice way to create unit tests as well.