Announcement Announcement Module
Collapse
No announcement yet.
Plan files and properties artifacts Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Plan files and properties artifacts

    I'm trying to use a properties artifact in Plan file like its described in the dm Server roadmap. Using dm Server M2.


    Here is the plan file.
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <plan name="multi-artifact.plan" version="1.0.0" scoped="true" atomic="true"
    xmlns="http://www.springsource.org/schema/dm-server/plan"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springsource.org/schema/dm-server/plan
    http://www.springsource.org/schema/dm-server/plan/springsource-dm-server-plan.xsd">
    <artifact type="properties" name="prodmserver.vehicle.db" version="[1.0.0,1.0.0]"/> 
    <artifact type="bundle" name="com.apress.prodmserver.vehicle.domain" version="[1.0.0,1.0.0]"/>
    <artifact type="bundle" name="com.apress.prodmserver.vehicle.infrastructure.derby" version="[1.0.0,1.0.0]"/>
    <artifact type="bundle" name="com.apress.prodmserver.vehicle.repository" version="[1.0.0,1.0.0]"/>
    <artifact type="bundle" name="com.apress.prodmserver.vehicle.repository.jpa" version="[1.0.0,1.0.0]"/>
    <artifact type="bundle" name="com.apress.prodmserver.vehicle.service" version="[1.0.0,1.0.0]"/>
    <artifact type="bundle" name="com.apress.prodmserver.vehicle.web" version="[1.0.0,1.0.0]"/>
    </plan>
    I keep getting a null pointer, as if the properties artifact can't be located. I've tried various names (e.g prodmserver.vehicle.db, prodmserver.vehicle.db.properties,etc) and keep getting a null pointer.

    I should also mention that using the syntax described in the dm Server roadmap I get another type of error. The roadmap doc suggests the following notation:
    Code:
     <artifact type="properties" name="prodmserver.vehicle.db" version="${plan.version}"/>
    But leaving the version for expansion generates the following:
    Code:
    <SPDE0006E> Hot re-deploy failed for resource '/home/daniel/Desktop/springsource-dm-server-2.0.0.M2/pickup/vehicle_wproperties.plan'.
    java.lang.RuntimeException: Failed to read plan descriptor
    	at com.springsource.kernel.repository.plan.PlanReader.read(PlanReader.java:81)
    	at com.springsource.kernel.deployer.app.PlanApplication.<init>(PlanApplication.java:80)
    	at com.springsource.kernel.deployer.app.PlanApplicationFactory.create(PlanApplicationFactory.java:105)
    	at com.springsource.kernel.deployer.core.internal.StandardApplicationDeployer.createDeployableArtefact(StandardApplicationDeployer.java:540)
    	at com.springsource.kernel.deployer.core.internal.StandardApplicationDeployer.deploy(StandardApplicationDeployer.java:377)
    	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.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:307)
    	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.doInvoke(ServiceInvoker.java:58)
    	at org.springframework.osgi.service.importer.support.internal.aop.ServiceInvoker.invoke(ServiceInvoker.java:62)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	at org.springframework.osgi.service.importer.support.LocalBundleContextAdvice.invoke(LocalBundleContextAdvice.java:59)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	at org.springframework.aop.support.DelegatingIntroductionInterceptor.doProceed(DelegatingIntroductionInterceptor.java:131)
    	at org.springframework.aop.support.DelegatingIntroductionInterceptor.invoke(DelegatingIntroductionInterceptor.java:119)
    	at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
    	at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
    	at $Proxy98.deploy(Unknown Source)
    	at com.springsource.kernel.deployer.hot.HotDeploymentFileSystemListener.deploy(HotDeploymentFileSystemListener.java:191)
    	at com.springsource.kernel.deployer.hot.HotDeploymentFileSystemListener.onChange(HotDeploymentFileSystemListener.java:91)
    	at com.springsource.util.io.FileSystemChecker.notifyListeners(FileSystemChecker.java:182)
    	at com.springsource.util.io.FileSystemChecker.check(FileSystemChecker.java:145)
    	at com.springsource.kernel.io.fs.WatchTask.run(WatchTask.java:67)
    	at java.lang.Thread.run(Thread.java:619)
    Caused by: org.xml.sax.SAXParseException: cvc-pattern-valid: Value '${plan.version}' is not facet-valid with respect to pattern '[\[\(]{1}( )*(\d(.\d(.\d(.([\w_-])+)?)?)?)( )*,( )*(\d(.\d(.\d(.([\w_-])+)?)?)?)( )*[\]\)]{1}|\d(.\d(.\d(.([\w_-])+)?)?)?' for type '#AnonType_versionartifactType'.
    	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
    	at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
    	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
    	at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(XMLSchemaValidator.java:410)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.reportSchemaError(XMLSchemaValidator.java:3165)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processOneAttribute(XMLSchemaValidator.java:2748)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.processAttributes(XMLSchemaValidator.java:2685)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator.java:2037)
    	at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.emptyElement(XMLSchemaValidator.java:705)
    	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:377)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2747)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
    	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:140)
    	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:510)
    	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:807)
    	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
    	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:107)
    	at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:225)
    	at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:283)
    	at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:124)
    	at com.springsource.kernel.repository.plan.PlanReader.readDocument(PlanReader.java:89)
    	at com.springsource.kernel.repository.plan.PlanReader.read(PlanReader.java:77)
    	... 28 more
    Also a little fuzzy on how you modify a bundle to read these properties value (I'm guessing a similar syntax like ${jdbc.url} inside bundle descriptors module-context.xml). But at this juncture, I can't even get a properties file to be read in a Plan file.

  • #2
    You've just stepped a little beyond the bleeding edge, unfortunately.

    We're planning our next sprint today and the current intention is that it'll include DMS-193 which will go some way to providing this functionality. I say some way, as it's likely that you'll have to deploy the properties file separately. Support for referencing a properties file from a plan will most likely come a little later.

    Once a properties file has been deployed, you'll be able to access its content via ConfigurationAdmin. You can hide this if you're using Spring DM by getting it to handle the ConfigurationAdmin lookup, and just treat it like any other set of properties in your application context file, as described in section 10.1.1.

    Comment


    • #3
      Just tried to use a properties artifact in a Plan file with the latest M3 release (noticing it use of ConfigurationAdmin , per the blog post)

      While a Plan file now apparently can parse a properties artifact statement (unlike the initial post in this thread), it still can't seem to find it. I keep getting the following error:

      Code:
      Unable to install application from location 'file:/dm-server/pickup/vehicle_plan.plan' Could not satisfy constraints for bundle 'multi-artifact.plan' at version '1.0.0'. Unable to find 'properties, vehicle.db, [1.0.0,1.0.0]' in repository.
      I've attempted placing a file named vehicle.db, vehicle,db.properties in the repository, as well as under the pickup and config directories. But the Plan file still seems unable to locate the properties file.

      Is this already supported ? Are is it still in development? By the message it seems its trying to ocate a bundle, also curious as to how versioning a properties file would work given its a flat file with no MANIFEST.MF


      Thanks for any info on the subject.

      Comment


      • #4
        There's no support just yet for referencing a properties file from a plan as the dm Server repository doesn't yet understand properties files. In the latest nightlies you can deploy a properties file through the admin console, or by dropping it into the pickup directory.

        We're planning our next sprint tomorrow and there's a good chance that it'll include deploying a properties file from a repository, i.e. by referencing it from a plan. Keep an eye on the sprint 8 release in JIRA. I'll also make a note to post back here once this functionality's in a nightly build.

        Comment

        Working...
        X