Announcement Announcement Module
Collapse
No announcement yet.
Maven Par Pom for the Weather app Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Maven Par Pom for the Weather app

    Hello
    The weather app that is included in the spring-osgi-1.2.0 samples has features I'd like to explore so I'm trying to get it deployed to DM Server 2.0.0.4m as a par.

    I've followed the instructions in: Getting Started Chapter 7: Automated Build. My par gets created and it contains the jars for the individual bundles but I'm having issues.

    First is that my "par-provided" directory winds up with the bundle jars as well as third party dependencies. That did not happen when I built greenpages. Just the third party jars were put there. It does not seem I should be copying my bundle jars to repository/bundles/usr if a par containing them is in the pickup directory. Is thet correct?

    Second, when I deploy the par to pickup I get the following:
    Code:
    [2009-08-28 11:03:32.295] fs-watcher               <HD0001I> Processing 'INITIAL' event for file 'weather-par-1.2.0.par'.                                                                          
    [2009-08-28 11:03:37.684] fs-watcher               <DE0010I> Deployment of 'weather-par' version '1.2' completed.                                                                                  
    [2009-08-28 11:03:37.699] fs-watcher               <HD0001I> Processing 'INITIAL' event for file 'com.springsource.server.repository.hosted-2.0.0.M4.par'.                                         
    [2009-08-28 11:03:41.009] fs-watcher               <DE0010I> Deployment of 'com.springsource.server.repository.hosted' version '2.0.0.M4' completed.                                               
    [2009-08-28 11:03:41.067] fs-watcher               <HD0001I> Processing 'INITIAL' event for file 'com.springsource.server.splash-2.0.0.M4.war'.                                                    
    [2009-08-28 11:03:42.356] fs-watcher               <DE0056I> Installing bundle 'com.springsource.server.splash' version '2.0.0'.                                                                   
    [2009-08-28 11:03:43.052] fs-watcher               <DE0057I> Installed bundle 'com.springsource.server.splash' version '2.0.0'.                                                                    
    [2009-08-28 11:03:43.452] fs-watcher               <DE0059I> Starting bundle 'com.springsource.server.splash' version '2.0.0'.                                                                     
    [2009-08-28 11:03:43.646] fs-watcher               <DE0060I> Started bundle 'com.springsource.server.splash' version '2.0.0'.                                                                      
    [2009-08-28 11:03:43.951] server-dm-5              <DE0020E> Application context creation failure for bundle 'weather-par-1.2-org.springframework.osgi.samples.wiring.bundle'. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'weatherServiceBundle': Cannot resolve reference to bean 'weatherServiceVirtualBundle' while setting bean property 'bundle'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'weatherDaoBundle': Invocation of init method failed; nested exception is java.lang.IllegalStateException: cannot execute action start on bundle null                                                                                                                                         
            at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:315)                                                            
            at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)                      
    ...
    Caused by: java.io.FileNotFoundException: ${localRepository}/org/springframework/osgi/samples/weather-dao/1.2.0/weather-dao-1.2.0.jar (No such file or directory)
            at java.io.FileInputStream.open(Native Method)
            at java.io.FileInputStream.<init>(FileInputStream.java:106)
            at java.io.FileInputStream.<init>(FileInputStream.java:66)
            at sun.net.www.protocol.file.FileURLConnection.connect(FileURLConnection.java:70)
            at sun.net.www.protocol.file.FileURLConnection.getInputStream(FileURLConnection.java:161
    The telnet console shows:
    Code:
    Framework is launched.
    
    id      State       Bundle
    94      ACTIVE      weather-par-1.2-org.springframework.osgi.samples.weather-dao_1.2.0
    95      ACTIVE      weather-par-1.2-org.springframework.osgi.samples.weather-extension_1.2.0
    97      ACTIVE      weather-par-1.2-org.springframework.osgi.samples.weather-service-test_1.2.0
    98      ACTIVE      weather-par-1.2-org.springframework.osgi.samples.weather-service_1.2.0
    99      ACTIVE      weather-par-1.2-org.springframework.osgi.samples.wiring.bundle_1.0.0
    So the exception makes it look like things did not go well but the telnet console say everything is cool. Which is correct? If everything is okay is there a way to avoid the ugly exception?

    Here's my weather-par pom:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
      <parent>
        <artifactId>weather</artifactId>
        <groupId>org.springframework.osgi.samples</groupId>
        <version>1.2.0</version>
        <relativePath>../pom.xml</relativePath>
      </parent>
    
      <modelVersion>4.0.0</modelVersion>
      <groupId>org.springframework.osgi.samples</groupId>
      <artifactId>weather-par</artifactId>
      <name>Weather Par</name>
      <packaging>par</packaging>
    
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-par-plugin</artifactId>
            <version>1.0.0.RELEASE</version>
            <configuration>
              <applicationSymbolicName>weather-par</applicationSymbolicName>
            </configuration>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-dependencies</id>
                <phase>package</phase>
                <goals>
                  <goal>copy-dependencies</goal>
                </goals>
                <configuration>
                  <outputDirectory>${project.build.directory}/par-provided</outputDirectory>
                  <overWriteIfNewer>true</overWriteIfNewer>
                  <excludeGroupIds>com.springsource.dmserver,org.apache.log4j</excludeGroupIds>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    
      <dependencies>
        <dependency>
          <groupId>org.springframework.osgi.samples</groupId>
          <artifactId>weather-extension</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework.osgi.samples</groupId>
          <artifactId>weather-dao</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework.osgi.samples</groupId>
          <artifactId>weather-service</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework.osgi.samples</groupId>
          <artifactId>wiring-bundle</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework.osgi.samples</groupId>
          <artifactId>weather-service-integration-test</artifactId>
          <version>${project.version}</version>
        </dependency>
        <dependency>
          <groupId>org.springframework.osgi.samples</groupId>
          <artifactId>weather-service-test</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>
    </project>
    Thanks
    Tom

  • #2
    While I'm still struggling with this but I have made some progress in that I have found what I think is my error. I just cannot figure out what to do about it.

    The weather app is packaged to run as a Maven build with the tests providing a demo of the implemented functionality. My problem is that I'm trying to package the app as a par and deploy it to a running Spring DM instance. The "spring.xml" file in the wiring-bundle project uses the osgi:bundle tag to define the weatherDaoBundle. It specifies the "location" of the bundle as:
    Code:
      
    location="file:${localRepository}/org/springframework/osgi/samples/weather-dao/${pom.version}/weather-dao-${pom.version}.jar
    The ${localRepository} I believe is a reference to the Maven local repository ($HOME/.m2/repository). This is fine when running Maven build but I'm not running from DM Server.

    It appears I need to specify the location of the bundle. The bundle is in the par. How do I specify the bundle location?

    Thanks
    Tom

    Comment


    • #3
      As you've figured out, the osgi:bundle tag is being used to install one of the application's bundles from the local Maven repository. However, as you've packaged the application as a PAR, and therefore all the bundles have been installed already, the bundle doesn't need to be installed explicitly in your application context. You should just be able to remove this line from the spring.xml file.

      Comment

      Working...
      X