Results 1 to 7 of 7

Thread: Addon development on Windows

  1. #1
    Join Date
    Oct 2009
    Posts
    7

    Default Addon development on Windows

    I am having trouble getting started developing an addon on windows with cygwin. I checked out the trunk and ran the following maven command:

    mvn clean eclipse:clean eclipse:eclipse compile

    I see log messages that state that the roo_classpath file was created (see below) but the file does not exist in the target directory. It seems like it got confused the second time as it added the "d:" drive to the begging of URL.

    [echo] Cached ROO classpath file will be written to '/cygdrive/d/apps/springsource/workspace/spring-roo/bootstrap/target/roo_classpath.txt'
    [echo] Cached ROO classpath file will be be created in 'd:\cygdrive\d\apps\springsource\workspace\spring-roo\bootstrap\target'

    The file was in fact created but ended up in a wrong place (d:\cygdrive\d\apps\springsource\workspace\spring-roo\bootstrap\target). I took the file and manually copied it into the bootstrap/target directory. Then I attempted to start roo-dev and got a java.lang.NullPointerException exceptions (see below).

    $ ./roo-dev.bat
    ____ ____ ____
    / __ \/ __ \/ __ \
    / /_/ / / / / / / /
    / _, _/ /_/ / /_/ /
    /_/ |_|\____/\____/ 1.0.0.RC3 [rev 347]


    Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.
    java.lang.NullPointerException
    at org.springframework.roo.addon.maven.MavenProjectMe tadataProvider.get(MavenProjectMetadataProvider.ja va:100)
    at org.springframework.roo.metadata.internal.DefaultM etadataService.get(DefaultMetadataService.java:106 )
    at org.springframework.roo.metadata.internal.DefaultM etadataService.get(DefaultMetadataService.java:124 )
    at org.springframework.roo.process.manager.internal.D efaultFileManager.notify(DefaultFileManager.java:1 41)
    at org.springframework.roo.metadata.internal.DefaultM etadataDependencyRegistry.notifyDownstream(Default MetadataDependencyRegistry.java:269)
    at org.springframework.roo.addon.maven.MavenProjectMe tadataProvider.onFileEvent(MavenProjectMetadataPro vider.java:299)
    at org.springframework.roo.file.monitor.polling.Polli ngFileMonitorService.publish(PollingFileMonitorSer vice.java:324)
    at org.springframework.roo.file.monitor.polling.Polli ngFileMonitorService.scanAll(PollingFileMonitorSer vice.java:306)
    at org.springframework.roo.process.manager.internal.M onitoringRequestCommand.callback(MonitoringRequest Command.java:36)
    at org.springframework.roo.process.manager.internal.M onitoringRequestCommand.callback(MonitoringRequest Command.java:15)
    at org.springframework.roo.process.manager.internal.D efaultProcessManager.doTransactionally(DefaultProc essManager.java:131)
    at org.springframework.roo.process.manager.internal.D efaultProcessManager.completeStartup(DefaultProces sManager.java:53)
    at org.springframework.roo.bootstrap.ProcessManagerPo stConstructBeanPostProcessor.onApplicationEvent(Pr ocessManagerPostConstructBeanPostProcessor.java:32 )
    at org.springframework.roo.bootstrap.ProcessManagerPo stConstructBeanPostProcessor.onApplicationEvent(Pr ocessManagerPostConstructBeanPostProcessor.java:20 )
    at org.springframework.context.event.SimpleApplicatio nEventMulticaster.multicastEvent(SimpleApplication EventMulticaster.java:98)
    at org.springframework.context.support.AbstractApplic ationContext.publishEvent(AbstractApplicationConte xt.java:280)
    at org.springframework.context.support.AbstractApplic ationContext.finishRefresh(AbstractApplicationCont ext.java:739)
    at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:390)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:139)
    at org.springframework.context.support.ClassPathXmlAp plicationContext.<init>(ClassPathXmlApplicationCon text.java:83)
    at org.springframework.roo.bootstrap.Bootstrap.<init> (Bootstrap.java:68)
    at org.springframework.roo.bootstrap.Bootstrap.main(B ootstrap.java:52)

    The first entry in roo_classpath.txt looks something like:

    d:\apps\springsource\workspace\spring-roo\bootstrap\target\classes

    So I am guessing it may be confused and looking for \cygwin\d\apps\springsource\workspace\spring-roo\bootstrap\target\classes. So then I tried starting roo-dev.bat in windows command line and received the same error

    Am I missing a step? Do you think working with cygwin in windows is hopeless? Did you just use dos command line in windows in your tests? I tried running mvn compile in dos command line and got "'svn' is not recognized as an internal or external command," error, so I could try next to install svn in dos cmd.

    Thank you!!!
    Last edited by DimaMay; Oct 23rd, 2009 at 12:26 AM.

  2. #2
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    We have not tested Cygwin due to the "odd" way you need to handle paths. Specifically, java.exe expects X:\ style paths whereas Cygwin expects /some/path in the normal *nix style. We do test with the standard Windows command prompt, though, and we expect this to work and treat failure for it to work in the command prompt environment as a bug.

    The SVN error is being raised because Roo's pom.xml includes the buildnumber-maven-plugin, which in turn is expecting the "svnversion" command to be available. Also when Roo starts in development mode it will expect "svnversion" to be available so it can correctly report the engineering build number:

    Code:
        ____  ____  ____  
       / __ \/ __ \/ __ \ 
      / /_/ / / / / / / / 
     / _, _/ /_/ / /_/ /  
    /_/ |_|\____/\____/    ENGINEERING BUILD [rev 352]
    
    
    Welcome to Spring Roo. For assistance press TAB or type "hint" then hit ENTER.
    Sorry you're experiencing these difficulties setting up. To be honest we develop most of Roo on Ubuntu machines and the Windows support is not quite as good. If you make any enhancements to scripts etc to ease your Windows development experience, please feel free to log them as Jira issues at https://jira.springsource.org/browse/ROO and we'll be pleased to apply them.
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  3. #3
    Join Date
    Oct 2009
    Posts
    7

    Default

    Thanks for a detailed response! I installed Ubuntu and it's been a smooth ride!

    With that said I want to continue setting up roo-dev on windows environment and hopefully make it easier for the developers in the future. After the installation of subversion (http://subversion.tigris.org/getting.html#windows) I was able to make further progress. The project was successfully generated (project --topLevelPackage com.codeinuse.search.roo.addon --template ROO_ADDON_SIMPLE) but the installation failed.

    The current issues are:
    1. "perform eclipse" and "perform assembly" return silently without executing underlying maven commands. However "mvn eclipse:eclipse" and "mvn assembly:assembly" worked
    2. Addon installation did not properly work. Please also note that it failed to restart roo after the addon installation (see below)
    3. roo-dev did not start after the failed addon install (see trace below). The exception is "java.lang.ClassNotFoundException: org.springframework.roo.shell.CommandMarker", I checked the roo_classpath.txt file and it in fact has "D:\apps\springsource\workspace\spring-roo\shell\target\classes\org\springframework\roo\s hell\CommandMarker.class"

    I am giving up for tonight please let me know what to try next. Thanks a lot!

    Code:
    roo> addon install --url  file:D:\apps\springsource\addon-search\target\com.codeinuse.search.roo.addon-0.1.0-SNAPSHOT.zip
    Downloading file:D:/apps/springsource/addon-search/target/com.codeinuse.search.roo.addon-0.1.0-SNAPSHOT.zip
    Received 18878 bytes
    Written to C:\Documents and Settings\DimaMay\roo-dev\add-ons\com.codeinuse.search.roo.addon-0.1.0-SNAPSHOT.zip
    Performing clean
    
    Roo home.....: C:\Documents and Settings\DimaMay\roo-dev
    Add-ons dir..: C:\Documents and Settings\DimaMay\roo-dev\add-ons
    Work dir.....: C:\Documents and Settings\DimaMay\roo-dev\work
    
    >>>>> com.codeinuse.search.roo.addon-0.1.0-SNAPSHOT.zip
    SAVED com.codeinuse.search.roo.addon-0.1.0-SNAPSHOT.jar
    
    Restarting Spring Roo
    Total execution time: 30375 ms
    
    D:\apps\springsource\addon-search>
    D:\apps\springsource\addon-search>roo-dev
    Exception in thread "main" org.springframework.beans.factory.CannotLoadBeanClassException:
     Error loading class [com.codeinuse.search.roo.addon.Commands] for bean with name 'command
    s' defined in URL [jar:file:/C:/Documents%20and%20Settings/DimaMay/roo-dev/work/com.codein
    use.search.roo.addon-0.1.0-SNAPSHOT.jar!/com/codeinuse/search/roo/addon/Commands.class]: p
    roblem with class file or dependent class; nested exception is java.lang.NoClassDefFoundEr
    ror: org/springframework/roo/shell/CommandMarker
            at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(
    AbstractBeanFactory.java:1220)
            at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.pr
    edictBeanType(AbstractAutowireCapableBeanFactory.java:568)
            at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(Abs
    tractBeanFactory.java:1287)
            at org.springframework.beans.factory.support.AbstractBeanFactory.isFactoryBean(Abs
    tractBeanFactory.java:842)
            at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstant
    iateSingletons(DefaultListableBeanFactory.java:525)
            at org.springframework.context.support.AbstractApplicationContext.finishBeanFactor
    yInitialization(AbstractApplicationContext.java:730)
            at org.springframework.context.support.AbstractApplicationContext.refresh(Abstract
    ApplicationContext.java:387)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(Class
    PathXmlApplicationContext.java:139)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(Class
    PathXmlApplicationContext.java:83)
            at org.springframework.roo.bootstrap.Bootstrap.<init>(Bootstrap.java:68)
            at org.springframework.roo.bootstrap.Bootstrap.main(Bootstrap.java:52)
    Caused by: java.lang.NoClassDefFoundError: org/springframework/roo/shell/CommandMarker
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(Unknown Source)
            at java.security.SecureClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.defineClass(Unknown Source)
            at java.net.URLClassLoader.access$000(Unknown Source)
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at sun.misc.Launcher$ExtClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at org.springframework.util.ClassUtils.forName(ClassUtils.java:255)
            at org.springframework.beans.factory.support.AbstractBeanDefinition.resolveBeanCla
    ss(AbstractBeanDefinition.java:397)
            at org.springframework.beans.factory.support.AbstractBeanFactory.doResolveBeanClas
    s(AbstractBeanFactory.java:1239)
            at org.springframework.beans.factory.support.AbstractBeanFactory.resolveBeanClass(
    AbstractBeanFactory.java:1209)
            ... 10 more
    Caused by: java.lang.ClassNotFoundException: org.springframework.roo.shell.CommandMarker
            at java.net.URLClassLoader$1.run(Unknown Source)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(Unknown Source)
            at sun.misc.Launcher$ExtClassLoader.findClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClass(Unknown Source)
            at java.lang.ClassLoader.loadClassInternal(Unknown Source)
            ... 27 more

  4. #4
    Join Date
    Aug 2004
    Location
    Sydney, Australia
    Posts
    2,768

    Default

    I just checked into SVN revision 361 a fix for the failed restart. I changed the exit code to 100 to represent a restart request but didn't update the roo-dev.bat.

    The problem with the classpath is probably because we're loading the add-ons using -Djava.ext.dirs (see roo-dev.bat). As shown in roo-dev (*nix version) we are expanding the JAR list in ~/roo-dev/work and adding it to the classpath. We probably need to do the same under Windows. I didn't do it under Windows because it's relatively complex to list the JARs in a directory and add them to the classpath variable. We can do it in one line in *nix (see line 17 of roo-dev). Apparently Java 6 and above supports wildcards in the classpath, so for the Windows roo-dev.bat it might be reasonable just to require Roo developers wanting to use Windows must have Java 6 or above. The only mainstream group still on Java 5 are Apple users, but they're using the *nix script anyway. If you're able to make your roo-dev.bat work (either using wildcards and therefore requiring Java 6+ or alternately with a little scripting magic that expands the JAR list in a directory), would you please post it into a Jira task so we can apply it to SVN? Thanks!
    Ben Alex
    Project Founder, Spring UAA, Spring Roo and Spring Security

  5. #5
    Join Date
    Oct 2009
    Posts
    7

    Default

    Created a ticket with a proposed solutions:

    http://jira.springframework.org/browse/ROO-420

    Thanks for all the help!!!

  6. #6
    Join Date
    Mar 2005
    Location
    The Netherlands
    Posts
    121

    Default

    I've committed a patch: it does follow your advice to not use the java.ext.dirs system property, but does not rely on Java 6 classpath wildcards to keep Roo Java 5 compatible.
    For people that want to give this a try: you can find an updated version that will also work with RC3 here: https://anonsvn.springframework.org/...ap/roo-dev.bat

  7. #7
    Join Date
    Oct 2009
    Posts
    7

    Default

    Tested! Variable expansion fix to avoid Java 6 dependency is definitely a superior solution. Thanks for the prompt attention!

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •