Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Virgo » Equinox based War to Virgo plan(Trying to migrate to VTS)
Equinox based War to Virgo plan [message #1052355] Mon, 29 April 2013 21:21 Go to next message
Neil Corbet is currently offline Neil Corbet
Messages: 12
Registered: October 2012
Junior Member
Hello All,

So I came back from EclipseCon with all sorts of wonderful plans for my current project. One of these plans was to migrate out project to VTS instead of plain old Tomcat. After reading the user and programmer guides I decided I wanted to do a plan based deployment.

Today I floundered. I floundered bad. Let me describe my project. My first migration is a DOSGI CXF based server application that uses EclipseLink to connect to a sql server DB. We also use SpringDM. We have been developing in Eclipse using the PDE and we do our builds with Tycho. So these are Eclipse based plugins. This application just exposes services. It is packaged up as a war file with Equinox as it's OSGI runtime and dropped into a Tomcat7 instance. After deployment I can hit all my services as RESTful based url's and I get JSON responses. If I just throw my war file into the pickup directory in Virgo, I get the same result. I should also note we use a lot of fragments to hold configuration information in properties files.

I think my initial question is this one, do I needs to include all of my bundles from my Equinox config.ini that I am currently using in my Virgo plan ( minus the Equinox bundles )? Or do I just include the delta between what already exists in the Virgo repository/ext directory and my config.ini ? Then include the rest in usr? Or, is there another way? Reading over the guides I couldn't really gauge what I should be doing. And I will save the WAB questions for when I get all these bundles started.

Initially, I just threw my application bundles in the pickup directory and just waited to see what dependencies were missing and slowly added dependency bundles one by one. This widdled down my dependencies, but this felt pretty dirty and doesn't get me to a plan based ( i.e controlled ) deployment.

Can anyone give my some guidance to get started? I am hoping that once I am up and running I can blog or post my trials and tribulations towards success.

Thanks,
Neil


Re: Equinox based War to Virgo plan [message #1057800 is a reply to message #1052355] Wed, 08 May 2013 16:40 Go to previous messageGo to next message
Neil Corbet is currently offline Neil Corbet
Messages: 12
Registered: October 2012
Junior Member
So, after lots of work and an upgrade of CXF here is my config.ini to virgo plan.

We use SpringDM, EclipseLink, and CXF for Restful web services.

After dropping the plan into pickup, everything loads, and then I can drop a simple client bundle in pickup. This bundle binds to a service that queries the database (bound through EclipseLink jpa) and returns the result. Awesome stuff.

Unfortunately, I am still struggling with exposing my service through CXF in a WAB. Mad

Old config.ini that is housed in my war.

#Product Runtime Configuration File
osgi.bundles.defaultStartLevel=4
osgi.bundles=com.springsource.org.aopalliance@start,\
  com.springsource.org.apache.commons.beanutils@start,\
  com.springsource.org.apache.commons.collections@start,\
  com.springsource.org.apache.commons.dbcp@start,\
  com.springsource.org.apache.commons.pool@start,\
  com.springsource.org.apache.log4j@start,\
  com.springsource.org.jdom@start,\
  com.springsource.slf4j.api@start,\
  com.springsource.slf4j.log4j,\
  com.springsource.slf4j.nop,\
  com.springsource.slf4j.org.apache.commons.logging@start,\
  cxf-dosgi-ri-dsw-cxf@start,\
  cxf-dosgi-ri-topology-manager@start,\
  org.syntech.ambassador.shared.log4j.config,\
  org.syntech.ambassador.server.fuelmaster.dao@start,\
  org.syntech.ambassador.server.fuelmaster.dao.jpa@start,\
  org.syntech.ambassador.server.fuelmaster.dao.jpa.sqlserver,\
  org.syntech.ambassador.server.fuelmaster.data.datasource.sqlserver@start,\
  org.syntech.ambassador.server.fuelmaster.data.datasource.sqlserver.config,\
  org.syntech.core.server.persistence.sqlserver.jtds@start,\
  org.syntech.core.shared.commons.services@start,\
  org.syntech.core.shared.commons@start,\
  org.syntech.core.shared.domain@start,\
  org.syntech.ambassador.shared.fuelmaster.domain@start,\
  org.syntech.ambassador.server.remoting.exporter.dosgi.jaxrs@start,\
  org.syntech.ambassador.server.remoting.exporter.dosgi.jaxrs-httpservice,\
  org.syntech.ambassador.server.security@start,\
  org.syntech.ambassador.shared.fuelmaster.services@start,\
  org.syntech.ambassador.server.fuelmaster.services@start,\
  org.eclipse.jetty.util@start,\
  jcl.over.slf4j@start,\
  joda-time@start,\
  org.apache.commons.lang@start,\
  org.apache.cxf.bundle-minimal@start,\
  org.apache.felix.gogo.runtime@start,\
  org.apache.felix.gogo.shell@start,\
  org.apache.geronimo.specs.geronimo-activation_1.1_spec@start,\
  org.apache.geronimo.specs.geronimo-annotation_1.0_spec@start,\
  org.apache.geronimo.specs.geronimo-javamail_1.4_spec@start,\
  org.apache.geronimo.specs.geronimo-jaxws_2.2_spec@start,\
  org.apache.geronimo.specs.geronimo-jms_1.1_spec@start,\
  org.apache.geronimo.specs.geronimo-jpa_2.0_spec@start,\
  org.apache.geronimo.specs.geronimo-servlet_2.5_spec@start,\
  org.apache.neethi@start,\
  org.apache.servicemix.bundles.opensaml@start,\
  org.apache.servicemix.bundles.wsdl4j-1.6.1@start,\
  org.apache.servicemix.bundles.xmlresolver@start,\
  org.apache.servicemix.specs.jaxb-api-2.2@start,\
  org.apache.servicemix.specs.jsr311-api-1.1.1@start,\
  org.apache.servicemix.specs.saaj-api-1.3@start,\
  org.apache.servicemix.specs.stax-api-1.0@start,\
  org.apache.ws.xmlschema.core@start,\
  org.codehaus.jettison.jettison@start,\
  org.eclipse.core.contenttype@start,\
  org.eclipse.core.expressions@start,\
  org.eclipse.core.jobs@start,\
  org.eclipse.core.runtime@start,\
  org.eclipse.equinox.app@start,\
  org.eclipse.equinox.common@start,\
  org.eclipse.equinox.console@start,\
  org.eclipse.equinox.ds@start,\
  org.eclipse.equinox.http.registry@start,\
  org.eclipse.equinox.http.servlet@start,\
  org.eclipse.equinox.http.servletbridge@start,\
  org.eclipse.equinox.preferences@start,\
  org.eclipse.equinox.registry@start,\
  org.eclipse.equinox.servletbridge.extensionbundle,\
  org.eclipse.equinox.util@start,\
  org.eclipse.osgi.services@start,\
  org.eclipse.persistence.antlr@start,\
  org.eclipse.persistence.asm@start,\
  org.eclipse.persistence.core@start,\
  org.eclipse.persistence.jpa@start,\
  org.eclipse.persistence.jpa.jpql@start,\
  org.springframework.aop@start,\
  org.springframework.asm@start,\
  org.springframework.beans@start,\
  org.springframework.context@start,\
  org.springframework.core@start,\
  org.springframework.data.commons@start,\
  org.springframework.expression@start,\
  org.springframework.jdbc@start,\
  org.springframework.orm@start,\
  org.springframework.osgi.core@start,\
  org.springframework.osgi.extender@start,\
  org.springframework.osgi.io@start,\
  org.springframework.transaction@start,\
  org.springframework.security.core@start,\
  osgi.enterprise@start,\
  slf4j.api@start,\
  spring-data-jpa@start


This is my Virgo plan:
<?xml version="1.0" encoding="UTF-8"?>
<plan name="ambassador-server" version="1.0.0" scoped="false" atomic="false"
        xmlns="http://www.eclipse.org/virgo/schema/plan"
		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		xsi:schemaLocation="
		        http://www.eclipse.org/virgo/schema/plan
		        http://www.eclipse.org/virgo/schema/plan/eclipse-virgo-plan.xsd">			
    <artifact type="bundle" name="osgi.enterprise" />
	<artifact type="bundle" name="org.springframework.data.commons"/>	
	<artifact type="bundle" name="org.apache.aries.blueprint"/>
	<artifact type="bundle" name="org.apache.aries.util"/>
	<artifact type="bundle" name="org.apache.aries.proxy"/>
	<artifact type="bundle" name="spring-data-jpa" version="[1,2)"/>     
	<artifact type="bundle" name="org.apache.servicemix.specs.jsr311-api-1.1.1"/> 
    <artifact type="bundle" name="org.apache.servicemix.specs.jsr339-api-m10"/>	
	<artifact type="bundle" name="com.springsource.org.apache.commons.beanutils"/>
	<artifact type="bundle" name="com.springsource.org.apache.commons.collections"/> 

	<!-- Bundles containing domain and service interfaces -->
    <artifact type="bundle" name="org.syntech.core.shared.domain" version="[0.0.1, 1.0.0)"/>
	<artifact type="bundle" name="org.syntech.core.shared.commons" version="[0.0.1, 1.0.0)"/>
	<artifact type="bundle" name="org.syntech.core.shared.commons.services" version="[0.0.1, 1.0.0)"/>
	<artifact type="bundle" name="org.syntech.ambassador.shared.log4j.config" version="[0.0.1, 1.0.0)"/>
	<artifact type="bundle" name="org.syntech.ambassador.shared.fuelmaster.domain" version="[0.0.1, 1.0.0)"/>
	<artifact type="bundle" name="org.syntech.ambassador.shared.fuelmaster.services" version="[0.0.1, 1.0.0)"/>	
	
	<!-- JPA Dependencies inlcuding my DataSource, DAO's, Persistence, and ORM configurations-->
	<artifact type="bundle" name="com.springsource.org.apache.commons.dbcp"/>
	<artifact type="bundle" name="com.springsource.org.apache.commons.pool"/>
	<artifact type="bundle" name="org.eclipse.persistence.antlr"/>
	<artifact type="bundle" name="org.eclipse.persistence.asm"/>
	<artifact type="bundle" name="org.eclipse.persistence.core"/>
	<artifact type="bundle" name="org.eclipse.persistence.jpa.jpql"/>
	<artifact type="bundle" name="org.eclipse.persistence.jpa"/>  
	<artifact type="bundle" name="org.syntech.core.server.persistence.sqlserver.jtds" version="[0.0.1, 1.3.0)"/>	
	<artifact type="bundle" name="org.syntech.ambassador.server.fuelmaster.data.datasource.sqlserver" version="[0.0.1, 1.3.0)"/>
	<artifact type="bundle" name="org.syntech.ambassador.server.fuelmaster.dao" version="[0.0.1, 1.0.0)"/>   
    <artifact type="bundle" name="org.syntech.ambassador.server.fuelmaster.dao.jpa" version="[0.0.1, 1.0.0)"/>
	<artifact type="bundle" name="org.syntech.ambassador.server.fuelmaster.services" version="[0.0.1, 1.0.0)"/>	
	<artifact type="bundle" name="org.syntech.ambassador.server.security" version="[0.0.1, 1.0.0)"/>
	
	<!-- CXF web services dependencies. -->
	<artifact type="bundle" name="org.codehaus.jettison.jettison"/>	
	<artifact type="bundle" name="org.apache.neethi"/>	
	<artifact type="bundle" name="org.apache.servicemix.bundles.opensaml"/>
	<artifact type="bundle" name="org.apache.servicemix.bundles.wsdl4j-1.6.1"/>
	<artifact type="bundle" name="org.apache.servicemix.bundles.xmlresolver"/>
    <artifact type="bundle" name="org.apache.servicemix.bundles.asm"/>	
	<artifact type="bundle" name="org.apache.ws.xmlschema.core"/>	
	<artifact type="bundle" name="org.eclipse.jetty.util"/>	
    <artifact type="bundle" name="org.apache.cxf.cxf-api"/>
	<artifact type="bundle" name="org.apache.cxf.cxf-rt-core"/>
	<artifact type="bundle" name="org.apache.cxf.cxf-rt-transports-http"/> 
	<artifact type="bundle" name="org.apache.cxf.cxf-rt-rs-extension-providers"/>
	<artifact type="bundle" name="org.apache.cxf.cxf-rt-frontend-jaxrs"/>
	<artifact type="bundle" name="org.apache.cxf.cxf-rt-databinding-jaxb"/>
	<artifact type="bundle" name="org.apache.cxf.cxf-rt-bindings-xml"/>	
	
	<!-- My WAB to expose the REST Services -->
	<artifact type="bundle" name="org.syntech.ambassador.server.remoting.exporter.dosgi.jaxrs" version="[0.0.1, 1.0.0)"/>
</plan>
Re: Equinox based War to Virgo plan [message #1057802 is a reply to message #1057800] Wed, 08 May 2013 16:51 Go to previous messageGo to next message
Neil Corbet is currently offline Neil Corbet
Messages: 12
Registered: October 2012
Junior Member
Some other things to note when I made this transition.

Virgo and Gemini blueprint are much more picky when it comes to Import-package in your manifests. I found that if a class was referenced in your spring/**-context.xml file, then you better have it in the imports. Eclipse and Equinox not so much....

Why did I upgrade CXF? I was getting this error:
[2013-04-24 11:54:56.823] region-dm-6                  <AG0000E> Application context creation failure for bundle 'org.apache.cxf.cxf-bundle-minimal' version '2.5.2'. org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 27 in XML document from OSGi resource[bundleentry://168.fwk13933553/OSGI-INF/blueprint/osgiservlet.xml|bnd.id=168|bnd.sym=org.apache.cxf.cxf-bundle-minimal] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 27; columnNumber: 87; cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'cm:property-placeholder'.
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:396)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:209)
	at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:180)
	at org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:170)
	at org.eclipse.gemini.blueprint.context.support.OsgiBundleXmlApplicationContext.loadBeanDefinitions(OsgiBundleXmlApplicationContext.java:140)
	at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
	at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:527)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.access$800(AbstractDelegatedExecutionApplicationContext.java:60)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext$3.run(AbstractDelegatedExecutionApplicationContext.java:242)
	at org.eclipse.gemini.blueprint.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.startRefresh(AbstractDelegatedExecutionApplicationContext.java:220)
	at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.stageOne(DependencyWaiterApplicationContextExecutor.java:224)
	at org.eclipse.gemini.blueprint.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor.refresh(DependencyWaiterApplicationContextExecutor.java:177)
	at org.eclipse.gemini.blueprint.context.support.AbstractDelegatedExecutionApplicationContext.refresh(AbstractDelegatedExecutionApplicationContext.java:157)
	at org.eclipse.gemini.blueprint.extender.internal.activator.LifecycleManager$1.run(LifecycleManager.java:211)
	at org.eclipse.virgo.kernel.agent.dm.ContextPropagatingTaskExecutor$2.run(ContextPropagatingTaskExecutor.java:95)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:722)
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element 'cm:property-placeholder'.
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:198)
	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:134)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:437)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:368)
	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:325)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:453)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3232)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:1912)
	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:741)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:376)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2717)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:607)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:116)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:489)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:835)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:764)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:123)
	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:237)
	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
	at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
	at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
	... 21 common frames omitted


It has been discovered that the CXF guys use an aries blueprint NameSpaceResolver ( or something ). The newest CXF-Dosgi 1.4 has the supporting aries bundles. They no longer had the minimal-bundle so I had to figure out which ones I needed in its place. I included those aries bundles in repository/usr as well as the cxf bundles and a few other dependencies. Exception gone. Still working on exposing my restful services that *just worked* in my war. I will posting more for some help.

As far as EclipseLink was concerned, I had to add extra things to my spring/module-context.xml file where I define my entity manager, jpa vendor, and database. First I had to add this:
<bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor" />

Didn't need it in Eclipse or Equinox.

When I defined my jpa:repositories base package, If one of my DAO's used an @Query annotation with a jpql statement I had to make sure I did this:
<jpa:repository id="dashBoardDao" query-lookup-strategy="create-if-not-found"/>


Otherwise, it failed.

Hope this helps others.

[Updated on: Thu, 09 May 2013 08:51]

Report message to a moderator

Re: Equinox based War to Virgo plan [message #1212884 is a reply to message #1057802] Tue, 26 November 2013 22:06 Go to previous messageGo to next message
Andrew Soloninka is currently offline Andrew Soloninka
Messages: 6
Registered: November 2013
Junior Member
When you got rid of the exception, was scoped set to true or false?
Re: Equinox based War to Virgo plan [message #1220669 is a reply to message #1212884] Thu, 12 December 2013 20:29 Go to previous message
oumi casha is currently offline oumi casha
Messages: 8
Registered: December 2013
Location: china
Junior Member

it need change war to a web bundle
Previous Topic:Virgo as windows service
Next Topic:Vrigo tooling does not copy static resources to 'work' after change
Goto Forum:
  


Current Time: Sat Jul 26 11:21:39 EDT 2014

Powered by FUDForum. Page generated in 0.03063 seconds