Unable to open debugger port (127.0.0.1:50212): java.net.SocketException "socket closed"

Answered

 Hi,

We have 2 jetty projects running and communicating with each other.

Project1 uses port 8080 and project2 uses port 9090.

when running both from intelliJ in debug mode, project2 will only start if project1 is not currently running.

in other words: 

debug project2 -> debug project1 => works

debug project1 -> debug project2 => Unable to open debugger port (127.0.0.1:50212): java.net.SocketException "socket closed"

We found that it is related to the fact that Project1 uses port 8080. if we change its port - both directions will work (but this is not a solution).

Please advise.

Thanks

0
6 comments
Official comment
 
I still believe that the issue happens due to incorrect port detection for Jetty
 
As a workaround, please try to do the following:
- add following line to <Jetty home>/start.ini file:
  jetty.port=9090  
- save changes
- try to debug project1, then debug project2
 
Please let me know whether it helps.
 
In any case I'm going to fix http port detection for 172, you can track progress at https://youtrack.jetbrains.com/issue/IDEA-153406.
 
 
 
Avatar
Permanently deleted user

Thanks, but this is not the case- tried it.

Any other idea would be appreciated

0
Could you please provide following to help us reproduce the issue:
 
  • screenshots of Server tab of Jetty Run/Debug configuration for project1 and project2
  • run console output for both projects
  • <Jetty base directory>/etc/jetty-http.xml file(s) for projects
I expect to ask for some other inputs in future, so it is probably better to move the discussion to new youtrack. 
0
Avatar
Permanently deleted user

Thank you very much for the quick replies.

see below:

Project1: 

Project2:


Console for Project1:

"C:\Program Files\Java\jdk1.8.0_131\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:55497,suspend=y,server=n -DSaasConfiguration=false -DyamlFilePath=c:\git\nga\octane.yml -Xms1024m -Dsa_config_dir=c:\git\nga\mqm\site -Dservice.locator.properties.location=C:/nga_sync/service.locator.properties -Denable_services_integration=true -javaagent:C:\Users\razid\.IntelliJIdea2017.1\system\groovyHotSwap\gragent.jar -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2017.1.2\lib\idea_rt.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2017.1.2\lib\util.jar" -Dfile.encoding=UTF-8 com.intellij.rt.execution.CommandLineWrapper C:\Users\razid\AppData\Local\Temp\idea_classpath com.hp.mqm.MqmServer dev:true port:8080
Connected to the target VM, address: '127.0.0.1:55497', transport: 'socket'
Running in node: 6.10.2
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
Starting HTTP server on port 8080
yarn install v0.24.4
[1/4] Resolving packages...
success Already up-to-date.
Done in 1.60s.

Running "post-pull" task
>> Skipping post-pull, already performed post pull for this commit 12905cc88bec9a019f7fe693e4138736619e242c

Done, without errors.
Finished with ui asset preparation
Loading default log4j2 configuration from classpath: /C:/git/nga/mqm/Server/mqm-infra-common/api/target/classes/log4j2-conf.xml
יונ 21, 2017 9:39:43 AM com.hazelcast.config.XmlConfigLocator
INFO: Loading 'hazelcast.xml' from classpath.
getYamlFileLocation 1: c:\git\nga\octane.yml
Path of jetty file is not known


SERVER IS READY! (Boot time 133 seconds)


Console for SYNC (Project2):

"C:\Program Files\Java\jdk1.8.0_131\bin\java" -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:55664,suspend=y,server=n -DSTOP.PORT=0 -Dcom.sun.management.jmxremote= -Dcom.sun.management.jmxremote.port=1099 -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false -DOPTIONS=jmx -javaagent:C:\Users\razid\.IntelliJIdea2017.1\system\groovyHotSwap\gragent.jar -Dsync.configuration.properties=c:/nga_sync/sync.application.properties -Dopb.configuration.properties=c:/nga_sync/opb.application.properties -Dservice.locator.properties.location=c:/nga_sync/service.locator.properties -Djetty.http.port=9090 -Dfile.encoding=windows-1252 -classpath "C:\nga_sync\jetty\start.jar;C:\Program Files\Java\jdk1.8.0_131\lib\tools.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2017.1.2\lib\idea_rt.jar" org.eclipse.jetty.start.Main --module=jmx C:\Users\razid\AppData\Local\Temp\context2916config\jetty-contexts.xml
[2017-06-21 09:46:43,300] Artifact opb-service-webapp:war exploded: Server is not connected. Deploy is not available.
[2017-06-21 09:46:43,300] Artifact saas-portal-mock:war exploded: Server is not connected. Deploy is not available.
[2017-06-21 09:46:43,300] Artifact sync-webapp:war exploded: Server is not connected. Deploy is not available.
Detected server http port: 8080
Connected to the target VM, address: '127.0.0.1:55664', transport: 'socket'
2017-06-21 09:46:45.557:INFO::main: Logging initialized @2222ms
2017-06-21 09:46:45.643:WARN:oejs.HomeBaseWarning:main: This instance of Jetty is not running from a separate {jetty.base} directory, this is not recommended. See documentation at http://www.eclipse.org/jetty/documentation/current/startup.html
STOP.PORT=55677
STOP.KEY=1bjy6382ag7i8
2017-06-21 09:46:45.827:INFO:oejs.Server:main: jetty-9.3.12.v20160915
2017-06-21 09:46:45.856:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:///C:/nga_sync/jetty/webapps/] at interval 1
2017-06-21 09:46:45.861:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:///C:/Users/razid/AppData/Local/Temp/context7226deploy/] at interval 1
2017-06-21 09:46:45.893:INFO:oejs.AbstractConnector:main: Started ServerConnector@2f4948e4{HTTP/1.1,[http/1.1]}{0.0.0.0:9090}
2017-06-21 09:46:45.894:INFO:oejs.Server:main: Started @2559ms
Connected to server
[2017-06-21 09:46:45,922] Artifact opb-service-webapp:war exploded: Artifact is being deployed, please wait...
[2017-06-21 09:46:45,922] Artifact saas-portal-mock:war exploded: Artifact is being deployed, please wait...
[2017-06-21 09:46:45,922] Artifact sync-webapp:war exploded: Artifact is being deployed, please wait...
2017-06-21 09:47:01.729:INFO:oeja.AnnotationConfiguration:Scanner-1: Scanning elapsed time=3200ms
2017-06-21 09:47:01.924:INFO:/sync:Scanner-1: Spring WebApplicationInitializers detected on classpath: [org.glassfish.jersey.server.spring.SpringWebApplicationInitializer@1d660285]
2017-06-21 09:47:02.513:INFO:/sync:Scanner-1: Initializing Spring root WebApplicationContext
??? 21, 2017 9:47:08 AM com.hazelcast.config.FileSystemXmlConfig
INFO: Configuring Hazelcast from 'C:\nga_sync\mock_deployment\hazelcast.xml'.
2017-06-21 09:47:10.514:INFO:oejsh.ContextHandler:Scanner-1: Started o.e.j.w.WebAppContext@71112c0f{/sync,file:///C:/git/indi/sync/sync-webapp/target/sync/,AVAILABLE}
[2017-06-21 09:47:10,676] Artifact sync-webapp:war exploded: Artifact is deployed successfully
[2017-06-21 09:47:10,676] Artifact sync-webapp:war exploded: Deploy took 24,754 milliseconds
2017-06-21 09:47:18.441:INFO:oeja.AnnotationConfiguration:Scanner-1: Scanning elapsed time=2628ms
2017-06-21 09:47:18.583:INFO:/opb:Scanner-1: Spring WebApplicationInitializers detected on classpath: [org.glassfish.jersey.server.spring.SpringWebApplicationInitializer@641a7095]
ERROR StatusLogger No log4j2 configuration file found. Using default configuration: logging only errors to the console.
2017-06-21 09:47:18.937:INFO:/opb:Scanner-1: Initializing Spring root WebApplicationContext
??? 21, 2017 9:47:22 AM com.hazelcast.config.FileSystemXmlConfig
INFO: Configuring Hazelcast from 'C:\nga_sync\mock_deployment\hazelcast.xml'.
2017-06-21 09:47:24.126:INFO:oejsh.ContextHandler:Scanner-1: Started o.e.j.w.WebAppContext@752fcb3a{/opb,file:///C:/git/indi/opb/opb-service/opb-service-webapp/target/opb/,AVAILABLE}
[2017-06-21 09:47:24,216] Artifact opb-service-webapp:war exploded: Artifact is deployed successfully
[2017-06-21 09:47:24,216] Artifact opb-service-webapp:war exploded: Deploy took 38,294 milliseconds
2017-06-21 09:47:25.674:INFO:oeja.AnnotationConfiguration:Scanner-1: Scanning elapsed time=874ms
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
Reading mock portal configuration from /C:/git/indi/gsp/gsp-dev-tools/saas-portal-mock/target/portal/WEB-INF/portalProperties.xml
2017-06-21 09:47:25.829:INFO:oejsh.ContextHandler:Scanner-1: Started o.e.j.w.WebAppContext@7dcd8f3e{/portal,file:///C:/git/indi/gsp/gsp-dev-tools/saas-portal-mock/target/portal/,AVAILABLE}
serverUrl : http://localhost:8080
createTenantPattern : {
"tenantId":TENANT_ID_PLACEHOLDER,
"tenantName":"TENANT_NAME_PLACEHOLDER",
"customerId":958265673,
"customerUser":"CUSTOMER_USER_PLACEHOLDER",
"isActive":true,
"tenantType":"Paid",
"purchaseStatus":"trial",
"integrationUsers":{
"internal": {
"id": "D45749D826A10F57E040A8C0A40B1E98",
"username":"590761911.internal.integration@saas.hp.com",
"password":"zTF7091JpD815A0H219k"
},
"external": {
"id": "D45749D826A10F57E040A8C0A40B1E66" ,
"username":"590761911.external.integration@saas.hp.com",
"password" :"LfnxE1Z6T4f8tIZo30NB"
}
},
"licenseDetails": [ {
"licenseKey":"9BSE B9MA H9PQ CHWY UYA4 HW2F Y9JL KMPL F2ND 5CNQ 8RMW LHWE 9ATG XNSL CMRG HPMR UHPU A5G9 EFEA M2Z9 M8BW 25U4 J9QJ LJVP KARV DJ8M S88J Y3R3 BTC5 W444 FEEU CJ52 BP2H 65PB LK4U R4WA R86G KDYX KSC5 WDN4 ENW9 A8VC CZU7 2E7X \"HP eSaaS\"",
"licenseObject": {
"orderId":"3AA00000207",
"apOrderId":"apo10009",
"autopassProductCode":"HPCONNIT",
"autopassProductVersion":"1.0",
"autopassFeatureId":3700,
"autopassFeatureVersion":"1",
"autopassFeatureDescription":"HP Connector Java Message Service User software",
"tenantId":"100",
"startDate":1372204800566,
"expirationDate":1382831999566,
"ipRange":"",
"capacity":40,
"deviceId":"100",
"macAddress":"",
"hostId":"",
"cloudId":"",
"createdTime":1372232260362,
"licenseId":"13722322603470",
"licenseType":"",
"licenseModel":"",
"autopassFeatureType":"",
"createdBy":"",
"notes":"",
"subscriptionId":"16750",
"status":"ACTIVE"
}
}],
"extendedInfo": [{
"product": "AGM",
"productExtendedInfo":{
"url":"http://some.url.here/with/path",
"locations":["loc name 1", "loc name 2", "loc name n"],
"applicationName": "APPLICATION_NAME",
"fireAlerts":"false "
}
},
{"product": "Storm",
"productExtendedInfo":{
"region":"Americas",
"timeZone":" America/Dawson_Creek"
}
}]
}

lastLoginCount : 100
sharedSpaceUrl : /sample-app/shared_spaces
saasIntegrationUser : saas.integration.user@hp.com
createSharedSpacePattern : {
"name":"SHARED_SPACE_NAME_PLACEHOLDER"
}

lastLoginPath :
[2017-06-21 09:47:26,236] Artifact saas-portal-mock:war exploded: Artifact is deployed successfully
[2017-06-21 09:47:26,236] Artifact saas-portal-mock:war exploded: Deploy took 40,314 milliseconds

 

Project1 uses embedded jetty, so it doesnt have jetty-http file
Jetty-http for project 2:
<?xml version="1.0"?>
<!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">

<!-- ============================================================= -->
<!-- Configure the Jetty Server instance with an ID "Server" -->
<!-- by adding a HTTP connector. -->
<!-- This configuration must be used in conjunction with jetty.xml -->
<!-- ============================================================= -->
<Configure id="Server" class="org.eclipse.jetty.server.Server">

<!-- =========================================================== -->
<!-- Add a HTTP Connector. -->
<!-- Configure an o.e.j.server.ServerConnector with a single -->
<!-- HttpConnectionFactory instance using the common httpConfig -->
<!-- instance defined in jetty.xml -->
<!-- -->
<!-- Consult the javadoc of o.e.j.server.ServerConnector and -->
<!-- o.e.j.server.HttpConnectionFactory for all configuration -->
<!-- that may be set here. -->
<!-- =========================================================== -->
<Call name="addConnector">
<Arg>
<New id="httpConnector" class="org.eclipse.jetty.server.ServerConnector">
<Arg name="server"><Ref refid="Server" /></Arg>
<Arg name="acceptors" type="int"><Property name="jetty.http.acceptors" deprecated="http.acceptors" default="-1"/></Arg>
<Arg name="selectors" type="int"><Property name="jetty.http.selectors" deprecated="http.selectors" default="-1"/></Arg>
<Arg name="factories">
<Array type="org.eclipse.jetty.server.ConnectionFactory">
<Item>
<New class="org.eclipse.jetty.server.HttpConnectionFactory">
<Arg name="config"><Ref refid="httpConfig" /></Arg>
<Arg name="compliance"><Call class="org.eclipse.jetty.http.HttpCompliance" name="valueOf"><Arg><Property name="jetty.http.compliance" default="RFC7230"/></Arg></Call></Arg>
</New>
</Item>
</Array>
</Arg>
<Set name="host"><Property name="jetty.http.host" deprecated="jetty.host" /></Set>
<Set name="port"><Property name="jetty.http.port" deprecated="jetty.port" default="9090" /></Set>
<Set name="idleTimeout"><Property name="jetty.http.idleTimeout" deprecated="http.timeout" default="30000"/></Set>
<Set name="soLingerTime"><Property name="jetty.http.soLingerTime" deprecated="http.soLingerTime" default="-1"/></Set>
<Set name="acceptorPriorityDelta"><Property name="jetty.http.acceptorPriorityDelta" deprecated="http.acceptorPriorityDelta" default="0"/></Set>
<Set name="acceptQueueSize"><Property name="jetty.http.acceptQueueSize" deprecated="http.acceptQueueSize" default="0"/></Set>
</New>
</Arg>
</Call>

</Configure>

 

0
Avatar
Permanently deleted user

Michael Golubev

Your workarround worked.

Funny, I tried something similar before that didnt work- I added jetty.http.port instead of jetty.port.

I will follow the fix you mentioned.

Thanks

0

Please sign in to leave a comment.