Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: Error running grails project on alternative port with STS2.6.0

  1. #1
    Join Date
    Nov 2010
    Posts
    5

    Default Error running grails project on alternative port with STS2.6.0

    Hi,

    since I have upgraded STS from 2.5.2 to 2.6.0-64 (latest developer snapshot on Win7-64 with JDK1.6.0_22-64) I am not longer able to run/debug a grails (1.3.7) project on an alternative port from within STS. I have tried several ways to specify the port (e.g. pass -Dserver.port=9090 as program or vm argument in the run configuration, add grails.server.port=9090 to BuildConfig.groovy) but startup always ends with the following stacktrace:

    HTML Code:
    Running Grails application..
    2011-03-30 14:43:59,313 [main] ERROR http11.Http11Protocol  - Error initializing endpoint
    java.net.SocketException: Unrecognized Windows Sockets error: 10106: create
    	at java.net.ServerSocket.createImpl(ServerSocket.java:255)
    	at java.net.ServerSocket.getImpl(ServerSocket.java:205)
    	at java.net.ServerSocket.bind(ServerSocket.java:319)
    	at java.net.ServerSocket.<init>(ServerSocket.java:185)
    	at java.net.ServerSocket.<init>(ServerSocket.java:141)
    	at org.apache.tomcat.util.net.DefaultServerSocketFactory.createSocket(DefaultServerSocketFactory.java:50)
    	at org.apache.tomcat.util.net.JIoEndpoint.init(JIoEndpoint.java:503)
    	at org.apache.coyote.http11.Http11Protocol.init(Http11Protocol.java:176)
    	at org.apache.catalina.connector.Connector.initialize(Connector.java:1057)
    	at org.apache.catalina.core.StandardService.initialize(StandardService.java:675)
    	at org.apache.catalina.core.StandardServer.initialize(StandardServer.java:793)
    	at org.apache.catalina.startup.Tomcat.start(Tomcat.java:285)
    	at org.apache.catalina.startup.Tomcat$start.call(Unknown Source)
    	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
    	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)
    	at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212)
    	at grails.web.container.EmbeddableServer$start.call(Unknown Source)
    	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:40)
    	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
    	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
    	at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
    	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)
    ...
    ...
    LifecycleException:  Protocol handler initialization failed: java.net.SocketException: Unrecognized Windows Sockets error: 10106: create
    	at org.grails.tomcat.TomcatServer.start(TomcatServer.groovy:212)
    	at grails.web.container.EmbeddableServer$start.call(Unknown Source)
    	at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy:158)
    	at _GrailsRun_groovy$_run_closure5_closure12.doCall(_GrailsRun_groovy)
    	at _GrailsSettings_groovy$_run_closure10.doCall(_GrailsSettings_groovy:280)
    	at _GrailsSettings_groovy$_run_closure10.call(_GrailsSettings_groovy)
    	at _GrailsRun_groovy$_run_closure5.doCall(_GrailsRun_groovy:149)
    	at _GrailsRun_groovy$_run_closure5.call(_GrailsRun_groovy)
    	at _GrailsRun_groovy.runInline(_GrailsRun_groovy:116)
    	at _GrailsRun_groovy.this$4$runInline(_GrailsRun_groovy)
    	at _GrailsRun_groovy$_run_closure1.doCall(_GrailsRun_groovy:59)
    	at RunApp$_run_closure1.doCall(RunApp.groovy:33)
    	at gant.Gant$_dispatch_closure5.doCall(Gant.groovy:381)
    	at gant.Gant$_dispatch_closure7.doCall(Gant.groovy:415)
    	at gant.Gant$_dispatch_closure7.doCall(Gant.groovy)
    	at gant.Gant.withBuildListeners(Gant.groovy:427)
    	at gant.Gant.this$2$withBuildListeners(Gant.groovy)
    	at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
    	at gant.Gant.dispatch(Gant.groovy:415)
    	at gant.Gant.this$2$dispatch(Gant.groovy)
    	at gant.Gant.invokeMethod(Gant.groovy)
    	at gant.Gant.executeTargets(Gant.groovy:590)
    	at gant.Gant.executeTargets(Gant.groovy:589)
    Server failed to start: LifecycleException:  Protocol handler initialization failed: java.net.SocketException: Unrecognized Windows Sockets error: 10106: create
    As soon as I remove the alternative server port setting, everything works fine. I am still able to run the project with alternative port in STS 2.5 as well as from the command line without any issues so I'm wondering if this is a bug with STS2.6 or the latest version of the greclipse plugin? Any hints how to fix this?
    Thanks in advance
    Thomas

  2. #2
    Join Date
    May 2009
    Location
    Vancouver
    Posts
    274

    Default

    Hi Thomas,

    I just tried exactly what you described (-D program argument and BuildConfig change) in STS 2.6.0 (Win7-64 but I was using 32bit VM and STS) - it worked for me. Are you absolutely sure something has not been left running on that same port from earlier?

    Can you perhaps try using those settings and specifying a different port? (or a reboot to clear any old processes hanging around)

    cheers
    Andy
    ---
    Andy Clement
    SpringSource Tool Suite

  3. #3
    Join Date
    May 2009
    Location
    Vancouver
    Posts
    274

    Default

    A bit more searching around - your specific error:
    "java.net.SocketException: Unrecognized Windows Sockets error: 10106: create" revealed:

    http://msdn.microsoft.com/en-us/libr...=vs.85%29.aspx
    WSAEPROVIDERFAILEDINIT
    10106
    Service provider failed to initialize.
    The requested service provider could not be loaded or initialized. This error is returned if either a service provider's DLL could not be loaded (LoadLibrary failed) or the provider's WSPStartup or NSPStartup function failed.

    And one comment:
    "This usually happens when you use an exe file as a wrapper to launch java.exe but that exe file is not getting all the environment variables to export to the java executable such as SystemRoot"

    That latter comment is interesting as I know we had an issue in that space at the end of STS 2.6.0 development, the bug was: http://issetracker.springsource.com/browse/STS-1662

    I saw a different end result when I raised that issue, but the underlying problem was that the environment was getting damaged when being passed to the process.

    I hesitate to recommend this (as you'll pick up more than just the fix), but if you go to the nightly build you will definetly pick up the fix for 1662 (which I had thought had made it into 2.6.0 final, but possibly it did not). The nightly update site is here: http://dist.springsource.com/snapsho.../nightly/e3.6/ - just grab the grails tools from the Extensions area.

    cheers
    Andy

  4. #4
    Join Date
    Nov 2010
    Posts
    5

    Default

    Hi Andy,

    Thanks for your replies and advises. I am sure that there are no port conflicts because a) I have rebooted several times and b) I was able to run the grails app from STS2.5.2 and the command line with the -Dserver.port=9080 parameter without any issues. So the problem was definitly related to STS2.6

    As you suggested I have meanwhile updated to the latest nightly and could work around that issue by adding the line

    grails.server.port.http=9080

    to the BuildConfig.groovy. Simply setting the -Dserver.port=9080 didn't work, the grails app was started on port 8080 only.

    According to the STS Jira ticket STS-1662 the bugfix was released with 2.6.0...

    Thanks for your help again
    Thomas

  5. #5
    Join Date
    May 2009
    Location
    Vancouver
    Posts
    274

    Default

    Hi Thomas,

    As you suggested I have meanwhile updated to the latest nightly and could work around that issue by adding the line

    grails.server.port.http=9080

    to the BuildConfig.groovy. Simply setting the -Dserver.port=9080 didn't work, the grails app was started on port 8080 only.
    Once you had updated, did you find that -Dserver.port=9080 (in the VM arguments settings for the run configuration) just didn't have any effect (and 8080 was still used), or were you still getting the same cryptic error as yesterday?

    According to the STS Jira ticket STS-1662 the bugfix was released with 2.6.0...
    Yes, it does say that - but the copy of the grails tools accessible through the dashboard hadn't been updated properly and was still at 2.6.0.RC3. This meant if the dashboard was used to install the grails tools then the version of the tools downloaded would not include the fix. Yesterday I got it updated so that the dashboard now points to 2.6.0.RELEASE.

    I just tried again, just modifying the -Dserver.port=9080 in the run configuration for my RunAs(run-app)
    Running Grails application..
    Server running. Browse to http://localhost:9080/XXY
    Can you confirm what level of grails tools you are now on?
    Help>AboutSpringsourceToolSuite then click the SpringSource leaf icon, and look at the date on the grails plugin. Mine is 2.6.0.201103161000-RELEASE - I expect yours to be a bit later than that if you updated from the nightly yesterday.

    cheers
    Andy

  6. #6
    Join Date
    May 2010
    Posts
    398

    Default

    I think I know what is going on with run-app and -Dserver.port. The way I understand how this works is that the launch configuration that gets used when you launch run-app from the "Run as" menu, is that it creates a brand-new launch configuration each time. So changes made to the launch configuration in the launch configuration tabs are not taken into account.

    So any changes you made to the launch configuration in the launch configuration tabs is lost.

    However, if you go to the launch configuration editor, find the run-app conf that was created edit it, and launch it right from there it will work... (until the next time you use the "Run as" menu).

    I gather andy was trying from the launch configuration editor, so it worked for him, and you were using the run as menu, so it doesn't work for you.

    I tried both and I got the behavior that I just described.

    Of course, this is not right, but so far nobody has complained so I hadn't thought it a real issue and haven't done anything about fixing it.

    Nevertheless, this as a bug. The correct behavior would be for the "run-app" and "test-app" launch shortcuts first to try to reuse an existing launch configuration. I'll raise an issue for that.

    (I do have one worry with always reusing the existing launch configuration, there is some potential for users to mess with these, or for old launch confs from "way back" to stick around. This could break the run-app / test-app menus if those confs are somehow getting broken and the user would have to manually delete them to fix that problem.)

    I'll raise a Jira issue for that.

    In the mean time, a workaround that may work for you is to use the preferences page in 2.6 under "windows >> preferences >> Grails >> Launch" there you can specify extra system properties that will be passed along (like -Dxxx=blah) to any grails command. So you could add the server.port property there and it should work for run-app.

    The caveat is that these properties are global so you won't be able to set different ports on individual apps via that mechanism.
    Kris De Volder -- SpringSource

  7. #7
    Join Date
    May 2010
    Posts
    398

    Default

    Kris De Volder -- SpringSource

  8. #8
    Join Date
    Mar 2011
    Posts
    3

    Default Windows Error

    I just downloaded the latest STS production release, created a Grails project with no changes and tried to run it. I get the same the Windows error message above. It runs fine if I use run-app from the command line. I am using Win7-64 with JDK1.6.0_22-64

  9. #9
    Join Date
    May 2010
    Posts
    398

    Default

    Hi eelan,

    As you may already have learned, there was an issue with the update site on the dashboard page. So if you installed Grails tooling from the dashboard extension page chances are you have actually installed the STS.2.6.RC3 instead of the actual release.

    That update site still has the bug in it, so please make sure that you actually have the 2.6.RELEASE of grails tooling.

    To make sure please reinstall the Grails support extension from this update site:
    http://dist.springsource.com/release....RELEASE/e3.6/

    (Go to Help >> Install new software, instead of using the extension page on the dashboard).

    Hopefully that will fix your problem.

    Kris
    Kris De Volder -- SpringSource

  10. #10
    Join Date
    Nov 2010
    Posts
    5

    Default

    Hi Andy,

    since I have installed the nightly last Thursday, my Grails plugin version is 2.7.0.201103301705-CI-R7118-B326.

    Cheers
    Thomas

Posting Permissions

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