Showing posts with label xml. Show all posts
Showing posts with label xml. Show all posts

Monday, March 1, 2010

Apache Beehive Moved into Apache Attic

Our long time friend, Apache Beehive framework, which was  from BEA WebLogic Workshop Framework donated to Apache Software Foundation has reached its end of life. Personally I have encountered this framework a few times when dealing with production application developed using BEA WebLogic Workshop Framework 8.1.x (the BEA's proprietary IDE), and also the development that we did using BEA WebLogic Workshop Framework 9.2 (the Eclipse based IDE).

The framework consisted of NetUI, Control and Web Service Metadata.

The Beehive NetUI is a framework built on top of Struts 1.x (I think it was 1.1, but not from 1.3.x for sure). I remembered when using  the BEA WebLogic Workshop IDE, we can configure the page flow using diagrams. It was quite a mess after a while, when you have a lot of page flows though.

The Beehive Controls framework was a superb innovation that time. It simplifies a lot of things (taking into account that at those time it took a lot of extra jobs when you want to configure EJB 2.1 invocation yourself). I believe was based on EJBGen, and predates the Java annotations. The major setbacks with Controls frameworks were that it make it difficult for developers to decouple the application from the BEA WebLogic Workshop Framework, and even more difficult to decouple with the WebLogic Workshop IDE! The IDE did a lot of magic behind the scene (at least for WebLogic 8.1.x), such as generating Ant build files that uses weblogic.jar classes.

Most of the contribution from BEA Systems Inc had been absorbed into the Java Annotations. Well, I think the Beehive Control framework served its duty at its time, yet now it became less and less compelling to use for the reason that it's been obsolete. With almost every comparable framework providing the similar ease of use without having to couple with some jars; who wants to use this "maintenance mode" framework for new developments.

The Beehive WSM (web service metadata), has also served its duty during its time, as new web service standards and frameworks have rolled out one by one. It's been obsolete just as many other web service frameworks. it's cousin, the XMLBeans framework (http://xmlbeans.apache.org) seems to survive much longer. It has just released version 2.5.0 last December 14th, 2009. I personally enjoy using this component framework, generating Java classes and XML mapping. Though we have some other frameworks like Jibx, I personally feel that this XMLBeans is more sophisticated.

Commiters of the project eventually voted to close the Apache Beehive project (http://beehive.apache.org) due to lack of activity. It is moved to Apache Attic (http://attic.apache.org) - such an affectionate name :D

The project was lacking activities, and I agree that it should be shelved into the attic. I believe legacy applications that uses this component should not have any problems because the component is still there, the source code is still there, and more or less it is stable enough.

Recommendations for replacement components are shown in the page, Spring Web Flow/Struts 2 to replace Beehive NetUI, Spring Framework Core to replace Beehive Controls, and Axis2 to replace Beehive WSM.

Good bye, old friend!

Wednesday, July 1, 2009

Adding Embedded ActiveMQ to Spring Container (on Maven 2 Project)

Today, we need to add a queue to our application to better manage long running transaction on our web application. The choice fell into using embedded ActiveMQ.We plan to use the latest version available (which currently ActiveMQ 5.2.0). Previous version of our application use our proprietary code which I believe was an example of reinventing the wheel. For our latest version of application, we try to use as much as possible open standard and open source technologies. ActiveMQ is under the Apache Software Foundation umbrella which is suitable for us.

First I add the dependency for the latest version of ActiveMQ (version 5.2.0):

[sourcecode lang="xml"]
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>activemq-core</artifactId>
<version>5.2.0</version>
<optional>false</optional>
</dependency>
[/sourcecode]

Now it's time to add something into the Spring application context configuration file.
As suggested by the documentation, I added new namespace amq in my XML. It points to "http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd" schema location.

[sourcecode lang="xml"]
<?xml version="1.0" encoding="UTF-8" ?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:amq="http://activemq.apache.org/schema/core"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
[/sourcecode]

I tried to run a JUnit test just to make sure that the new change in the configuration works well. There were some 2 errors. It turns to be a stale schema location. I figured it out from opening the URL http://activemq.apache.org/schema/core and see what's in there. So now need to modify a bit, change "http://activemq.apache.org/schema/core/activemq-core.xsd" to "http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd".

So here goes the correct version that works (syntactically correct XML):

[sourcecode lang="xml"]
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:amq="http://activemq.apache.org/schema/core"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core-5.2.0.xsd">
[/sourcecode]

Now the next beast coming in, when I tried to use the new namespace by adding this inside the <beans/> tag.

[sourcecode lang="xml"]
<amq:broker useJmx="false" persistent="false">
<amq:transportConnectors>
<amq:transportConnector uri="tcp://localhost:0" />
</amq:transportConnectors>
</amq:broker>
[/sourcecode]

It produced this error:

[sourcecode lang="shell"]

java.lang.ExceptionInInitializerError
at com.triquesta.tcm.core.services.MessagingServiceTest.init(MessagingServiceTest.java:17)
[...deleted...]
Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [tcm_configs.xml]; nested exception is org.springframework.beans.FatalBeanException: NamespaceHandler class [org.apache.xbean.spring.context.v2.XBeanNamespaceHandler] for namespace [http://activemq.apache.org/schema/core] not found; nested exception is java.lang.ClassNotFoundException: org.apache.xbean.spring.context.v2.XBeanNamespaceHandler
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:420)
[...deleted...]
Caused by: org.springframework.beans.FatalBeanException: NamespaceHandler class [org.apache.xbean.spring.context.v2.XBeanNamespaceHandler] for namespace [http://activemq.apache.org/schema/core] not found; nested exception is java.lang.ClassNotFoundException: org.apache.xbean.spring.context.v2.XBeanNamespaceHandler
at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:134)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1292)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1287)
[...deleted...]
Caused by: java.lang.ClassNotFoundException: org.apache.xbean.spring.context.v2.XBeanNamespaceHandler
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at org.springframework.util.ClassUtils.forName(ClassUtils.java:211)
at org.springframework.beans.factory.xml.DefaultNamespaceHandlerResolver.resolve(DefaultNamespaceHandlerResolver.java:123)
... 37 more
[/sourcecode]