iconara/puck

example run fails

Closed this issue · 6 comments

Iv tried to run the example run used in the integration spec, it does run outside of the jar but fails when being run via:

java -jar example_app.jar server

Channels.java:67:in `checkNotNull': java.lang.NullPointerException: "in" is null!
    from Channels.java:347:in `newChannel'
    from ChannelDescriptor.java:829:in `open'
    from RubyFile.java:1242:in `sysopen'
    from RubyFile.java:1199:in `sysopenInternal'
    from RubyFile.java:1150:in `openFile19'
    from RubyFile.java:334:in `initialize19'
    from RubyFile$INVOKER$i$0$2$initialize19.gen:-1:in `call'
    from CachingCallSite.java:286:in `cacheAndCall'
    from CachingCallSite.java:81:in `callBlock'
    from CachingCallSite.java:85:in `call'
    from RubyClass.java:876:in `newInstance'
    from RubyIO.java:1144:in `open'
    from RubyIO$INVOKER$s$0$0$open.gen:-1:in `call'
    from DynamicMethod.java:217:in `call'
    from CachingCallSite.java:356:in `cacheAndCall'
    from CachingCallSite.java:213:in `callBlock'
    from CachingCallSite.java:222:in `callIter'
    from CallTwoArgBlockNode.java:62:in `interpret'
    from NewlineNode.java:105:in `interpret'
    from ASTInterpreter.java:74:in `INTERPRET_METHOD'
    from InterpretedMethod.java:182:in `call'
    from DefaultMethod.java:186:in `call'
    from CachingCallSite.java:326:in `cacheAndCall'
    from CachingCallSite.java:170:in `call'
    from CallOneArgNode.java:57:in `interpret'
    from LocalAsgnNode.java:123:in `interpret'
    from NewlineNode.java:105:in `interpret'
    from BlockNode.java:71:in `interpret'
    from RootNode.java:129:in `interpret'
    from ASTInterpreter.java:121:in `INTERPRET_ROOT'
    from Ruby.java:834:in `runInterpreter'
    from Ruby.java:2674:in `loadFile'
    from ExternalScript.java:66:in `load'
    from LoadService.java:359:in `load'
    from RubyKernel.java:1081:in `loadCommon'
    from RubyKernel.java:1073:in `load19'
    from RubyKernel$INVOKER$s$0$1$load19.gen:-1:in `call'
    from DynamicMethod.java:209:in `call'
    from DynamicMethod.java:205:in `call'
    from CachingCallSite.java:326:in `cacheAndCall'
    from CachingCallSite.java:170:in `call'
    from classpath:jar-bootstrap.rb:39:in `block_0$RUBY$__file__'
    from classpath_3a_jar_minus_bootstrap$block_0$RUBY$__file__:-1:in `call'
    from CompiledBlock19.java:135:in `yield'
    from Block.java:142:in `yield'
    from RubyArray.java:1610:in `eachCommon'
    from RubyArray.java:1617:in `each'
    from RubyArray$INVOKER$i$0$0$each.gen:-1:in `call'
    from CachingCallSite.java:316:in `cacheAndCall'
    from CachingCallSite.java:145:in `callBlock'
    from CachingCallSite.java:154:in `callIter'
    from classpath:jar-bootstrap.rb:36:in `__file__'
    from classpath:jar-bootstrap.rb:-1:in `load'
    from Ruby.java:807:in `runScript'
    from Ruby.java:800:in `runScript'
    from Ruby.java:669:in `runNormally'
    from Ruby.java:518:in `runFromMain'
    from Main.java:390:in `doRunFromMain'
    from Main.java:279:in `internalRun'
    from Main.java:221:in `run'
    from Main.java:201:in `main'
    from JarBootstrapMain.java:57:in `main'

Im using:

java version "1.7.0_25"
OpenJDK Runtime Environment (IcedTea 2.3.10) (7u25-2.3.10-1ubuntu0.13.04.2)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

I'll have a look and see what's wrong. If you run rake spec does it run then?

From the project parent I don't see such a task:

% rake -T
rake build # Build puck-1.0.0.pre2.gem into the pkg directory
rake install # Build and install puck-1.0.0.pre2.gem into system gems
rake release # Create tag v1.0.0.pre2 and build and push puck-1.0.0.pre2.g...

Should I run from an inner folder?

Thanks

Ok iv run rspec from the root folder and it worked fine (all tests green),

Ok, I think iv found the issue my JAVA_HOME was broken

As a side note the specs passed even when there was an error:

/usr/local/rvm/gems/jruby-1.7.4@puck/gems/simplecov-0.7.1/lib/simplecov.rb:34 warning: tracing (e.g. set_trace_func) will not capture all events without --debug flag

bin/puck
  creates a self-contained Jar that exposes the app's bin files
  outputs an error when the named script can't be found
Puma 2.0.1 starting...Errno::EADDRINUSE: Address already in use - bind - Address already in use
        initialize at org/jruby/ext/socket/RubyTCPServer.java:118
               new at org/jruby/RubyIO.java:856
  add_tcp_listener at file:/home/ronen/code/puck/spec/resources/example_app/build/example_app.jar!/META-INF/gem.home/puma-2.0.1-java/lib/puma/binder.rb:167
  add_tcp_listener at (eval):2
               run at file:/home/ronen/code/puck/spec/resources/example_app/build/example_app.jar!/META-INF/gem.home/puma-2.0.1-java/lib/rack/handler/puma.rb:33
            (root) at classpath:/META-INF/app.home/bin/server:12
              load at org/jruby/RubyKernel.java:1073
            (root) at classpath:jar-bootstrap.rb:39
              each at org/jruby/RubyArray.java:1617
            (root) at classpath:jar-bootstrap.rb:36
  exposes JRuby's bin files
  exposes all gem's bin files

Puck::Configuration
  #get
    returns the default configuration when ARGV is empty
    with command line arguments
      sets :extra_files option to the list of files specified after --extra-files
      sets the :base_dir option to the value of --base-dir
      sets the :build_dir option to the value of --build-dir
      sets the :app_name option to the value of --app-name
      sets the :jruby_complete option to the value of --jruby-complete
      handles multiple command line flags together
  .get
    is a shortcut for .new + #get

Puck::Jar
  #create!
    creates a Jar named from the current working dir
      with standard options
        sets the Main-Class attribute to JarBootstrapMain
        sets the Created-By attribute to Puck
        puts the project code in META-INF/app.home
        includes the project's bin dir
        includes the JRuby core
        includes the Ruby stdlib
        puts gems into META-INF/gem.home
        correctly handles gems with a specific platform
        supports git dependencies
        does not include gems from groups other than "default"
        creates a jar-bootstrap.rb and puts it in the root of the JAR
        adds all gems to the load path in jar-bootstrap.rb
        adds all gem's bin directories to a constant in jar-bootstrap.rb
        adds each gem only once, even if it is depended on by multiple gems
        adds code that will run the named bin file
      with custom options
        includes extra files
        uses an alternative jruby-complete.jar
error while reading original manifest in file: /tmp/d20130819-15312-2j7v3t/example_app/build/example_app.jar due to MALFORMED
        includes gems from the specified groups

Finished in 1 minute 27.71 seconds
30 examples, 0 failures
Coverage report generated for RSpec to /home/ronen/code/puck/coverage. 237 / 239 LOC (99.16%) covered.

It seemed that I had another instance running on the same port

Sorry, yeah, there wasn't any rake spec, just rspec.

Are you sure you weren't running the example app at the same time you ran the tests? The test output says that the app launched by the integration tests couldn't bind to the port 3344, but it looks like the tests still succeeded (and they wouldn't unless there was something else running on that port, that spoke HTTP.

Since you didn't include the line after "Finished in..." I can't tell if any of the other tests failed or not.

I just edited the after finished part and yes there was another process running its just that id expect a failure in this case since the pucked application failed to start.

Its not the most crucial thing, any case its all good now.

Thank you