Cloudbees java (non-web) application listening to port? - cloudbees

I tried to deploy java application on cloudbees, following this doc (http://developer.cloudbees.com/bin/view/RUN/Java+Container) and this guidelines (How do you deploy a non-web Java app through CloudBees Jenkins "Deploy Now" feature?) and finally managed to run my app on cloudbees, but... I can't connect to it.
In the logs I can see it started just fine, and is listening to port:
Starting spray can on 8464
[INFO] [06/11/2014 08:15:33.237] [on-spray-can-akka.actor.default-dispatcher-3] [akka://on-spray-can/user/IO-HTTP/listener-0] Bound to localhost/127.0.0.1:8464
My app is on http://spray-can.pawelstawicki.eu.cloudbees.net/, but when I go there, I can see only 502 Bad Gateway. I also tried http://spray-can.pawelstawicki.eu.cloudbees.net:8464/ but nothing there is even listening on the port.
What am I doing wrong?

I guess the problem here could be that you specified the port when it is injected as an environmental variable ($app_port). Your application should be reachable in http://spray-can.pawelstawicki.eu.cloudbees.net/. Also I think that the output "localhost/127.0.0.1:8464" doesn't sound really good.

Related

Unable to access glassfish served content when using localhost

I created this simple dynamic web project (glassfish 4.1.1 latest atm) using eclipse java ee Mars.2 that I installed 2 days ago.
Checking on the admin, the app is deployed and running fine. I could not access the web app using the localhost:8080 url but it works when I use <computername>:8080.
I could access the admin using localhost:4848.
I tried disabling the firewall but the problem persists. What could be the problem?
The error is:
404 Not Found
No context found for request
In eclipse I see the log int he console that says: Automatic timeout occurred
As I pointed out in comments, you can configure listeners in Configuration -> needed configuration -> Network Config -> Network Listeners. However, it is still rather strange that your localhost doesn't work with 0.0.0.0 IP address, since it is a special address which means "listen on all available IPs on given port". Perhaps your network is somehow misconfigured.

Unable to open debugger port in IntelliJ IDEA

I have a problem that I can not set up my application in debug mode with IntelliJ IDE, but run mode is OK.
My OS is Windows 7, IDE is IntelliJ IDEA, web container is Tomcat 6. I have tried for a long time, changed the HTTP port and the JMX port, but it did not work.
When I set up the app in debug mode with IntelliJ, it failed and the event log is:
16:05:35 Error running tomcat: Unable to open debugger port :
java.net.BindException "Address already in use: JVM_Bind".
the key to the issue is in debugger port. I was having the same problem, I was killing every process listening on port 8081 (my http port), 1099 (JMX port), tomcat shutdown port, every java.exe, and still nothing.
The thing is this debugger port is different. If you run the application, it will go through the port you have Tomcat configured for, 8080, 8081 or whatever. But if you run it in Debug mode, it goes through a different port.
If you go edit your Tomcat configuration from IntelliJ, the last tab is Startup/Connection. Here go see the configuration for Debug mode, and you'll see its port. Mine was 50473. I changed it to 50472, and everything started working again.
If you're on windows you can bypass the socket issue completely by switching to shared memory debugging.
For me, IntelliJ Event Log (right bottom corner) had below logs:
Error running EntitmentTooling-Debug: Cannot run program "/path-to/apache-tomcat-8.5.15/bin/catalina.sh" (in directory "path-to/apache-tomcat-8.5.15/bin"): error=13, Permission denied
Error running EntitmentTooling-Debug: Unable to open debugger port (127.0.0.1:58804): java.net.SocketException "Socket closed"
The command
$ chmod a+x /path-to/apache-tomcat-8.5.15/bin/catalina.sh
to sufficiently change privileges worked for me.
I have encountered the same error while using IntelliJ. Since I have started multiple instances of IntelliJ. While starting two instance it started properly. However, when starting another one, it was giving below error.
unable to open debugger port (127.0.0.1:debug-port-number) java.net.socketexception interrupted function call accept failed
There are basically two places you can check your ports related to debugging in IntelliJ
JMX port - you can find this is
In Startup/Configuration, there is debug option just click this.
What to Check: If IntelliJ is throwing above error, means issue is any of the above listed ports. To verify this open event log (its available in right corner down) and check the exact message. Event log will have message like below
11:19 PM Error running 'Tomcat-tp': Address localhost:1098 is already in use
11:19 PM Error running 'Tomcat-tp': Unable to open debugger port (127.0.0.1:51787): java.net.SocketException "Interrupted function call: accept failed"
Solution-1
Check the JMX port of current intelliJ which is not starting with the working one and verify if JMX ports are not duplicated within IntelliJ instance or any of the software which is running in your machine is not using this port.
Solution-2
If JMX is not duplicated then verify your debug port, check in all IntelliJ instance and do the changes.
Surely either JMX or Debug port is having issue just use unique JMX and Debug port and it will work.
Hope this will help someone.
This works for me consistently (it happens to me from time to time, when I do things such a restart tomcat when I am running the integration tests, for example)
1) Find the process that has the port 1099 open
sudo netstat -anp | grep tcp | grep 1099
cp6 0 0 :::1099 :::* LISTEN 9857/java
2) kill it
kill 9857
3) Start Tomcat.
I had same issue in windows 7 and IntellijIdea 14.
I killed the java processes by going CTRL+ALT+ESc, find java and kill it.
Now Re-Run, the application again it should be fine..
You can also do it with command line or shell(linux), but I found this easier for myself
I solved the issue by this way.
I tried to kill all the java.exe processes but it was useless.
Then I tried deleting the Tomcat server
I re-deployed the project and restarted the project and it worked.
See these links for more information:
Delete Tomcat
Add a new Tomcat
I had this exact message.
The reason was that some IDE (I use Eclipse and Intellij) failed to shutdown the tomcat server. Or maybe crashed before it could do so.
The solution was to navigate to C:\...\apache-tomcat-xxx\bin and run shutdown.
All the other solutions unfortunately did not work.
This is what worked for me . I simply changed the debugger port to some other port number.
Intelij-> preferences->Build, execution, deployment ->Debugger-> Built in server->port(change value )
It happens occasionally that when I restart my computer, everything is OK. Perhaps there is a port conflict.
Restart the computer works because instances of Java or Tomcat are killed during the restart. You can also consider killing the specific processes from Task Manager
This also happens if there is an issue in the context.xml file. In my case, I had accidentally changed the context value.
I have the same issue,because my computer's DNS miss 127.0.0.1 localhost.
When I add 127.0.0.1 localhost to my host file,it become ok.
While debug I got this issue: It worked with
tried changing my Tomcat http port 8082 to 8083(In debug
configurations on IntelliJ and in Tomcat->conf->server.xml also)
tried changing JMX port from 1099 to 1009.
tried changing debug port in Startup/Connection in debug
configurations
killed all java processes in TaskManager->Processes.
There are various reasons for this.
- There might be the problem with debugger port---Please change it to resolve( answered by T.M )
- There might be some issue with intellij cache --Invalidate cache and restart will solve it ( answered by feng smith )
- There might be problem with any other Port, like JMX, AJP --- Please change these port numbers as well.
I wanted to add this as comment but not enough rep
My fix was the change debug port from 54444 to 7070
None of above methods worked in my case i.e. changing port number in run configuration, machine restart, invalidate cache in IntelliJ, killing process shown in netstat (nestat -anob | findstr <port-number> and then tskill <pid>). The only thing that finally helped was starting and shutting down tomcat manually via startup.bat and shutdown.bat (you should use correspondig .sh files on linux and macOS).
The only thing that worked for me is to go to Task Manager on Windows, and end all the Java processes that is running by right click -> end Task.
Check "Run" configuration to see which port it is using (8081).
Find all the other processes using that port lsof -t -i :8081
Kill the processes on that port. kill PROCESS_ID
Run Tomcat in Debug mode.
In my case, I wasted so much time on changing debugger port but it was not the issue. Since tomcat was not able to run on the port I chose in Run configuration, I was not able to debug my service.
In Server tab of Tomcat configuration in IntelliJ, change JMX port to another number.
Change debug port of your server configured in the Intelli J.
It will be fixed.
My assumption that this exception usually occurs when Tomcat is improperly closed and still holding the ports.
Usually it is enough to kill any process listening to 1099 port. For Window 10:
netstat -aon | find "1099"
taskkill /F /PID $processId
In my case I had another project open in IntelliJ, and had Tomcat running in debug mode in that project.
Stopping that instance of Tomcat resolved the issue.
In my case, there was a problem in server.xml for Tomcat/conf folder where I had extra comment tags under another comment tag. So I think, since there was some problem in server.xml, it was not able to start Tomcat. And moreover it copies the tomcat folder from your installation directory to C:\Users\username.IntelliJIdea2017.2\system\tomcat\Tomcat_service
This happens when you have application running on the same port number. One way to do this by killing the process forcefully. Open command prompt as an admin. Run command 'taskkill /IM "java.exe" /F'. This worked for me in Windows. Let me know if this works.
Probably you get the same error message if the standalone.xml in your standalone/configuration folder cannot be found. At least I have the same error when using a WildFly 14.0.1:
Just restart the Android studio before try these all. I face same right now and i fix it by this way.
Happy coding :)
For anyone who comes here with the similar message:
Unable to open debugger port (127.0.0.1:50470):
java.net.SocketException "Interrupted function call: accept failed"
This may be caused by something completely independent, i.e. it's not a port configuration. If you're running Tomcat, for instance, it may be that you have an invalid web.xml. Check your Event Log for any previous errors:
Cannot load C:\...\conf\web.xml: ParseError at [row,col]:[480,29]
Message: The element type "param-value" must be terminated by the matching end-tag "</param-value>".
I came in this scenario and as the above answers I tried to change the port like
Edit Configuration -> Startup/Connection -> debug -> change the Port
but it didn't solve my problem cause I was running my application in debug mode so once try to run the application as normal without debug.
it solved my problem!
This problem is sometimes just because of a misconfiguration.
Please, check if you have, for example, an SSL port number defined at your run configuration. If so, and if you don't have a right configuration for it at tomcat's server.xml, then it won't be possible to start your debug session correctly, and you will unfortunately have the same error. I think this can be shown as a different error. So, this is in my opinion an idea issue also..
The solution is, removing the SSL port number value from the run configuration of the IDE.
#intellij-idea
https://stackoverflow.com/questions/tagged/intellij-idea
This occurred to me, when I was running wildfly on intellij, and I switched the branch. I stopped wildfly, built the jar using maven, tried to re run Wildfly and got the error.
I tried changing port as mentioned in the accepted answer, but didn't work. I tried to find the process running on port, but netstat command didn't find it.
I tried restarting the OS, it also didn't help.
Then I checked the configuration folder of my Wildfly set up, that's when I realised
standalone.xml got replaced by standalone.xml.tmp
renaming it to standalone.xml helped me to resolve the error.
Running IntelliJ as Administrator in Windows did the magic for me:

how to make sur that Jboss is well installed and configured?

I m using eclipse indigo and i installed the Jboss Server earlier.i though that every thing is fine;
But when i make a right clik on a JSP page for exemple ,there is no "Deploy" ,and if i what to deploy the whole project..the same thing i can't do it because the is no "Deploy" option.
iand if i ighone all that and do a "Run As" --> "Run on a server" i get a http 404 error saying the requested ressource is not available.
i have Jboss in my eclipse ,is there any why to know that Jboss is well insatlled??
Thank you
The easiest way to check whether JBoss 7 is running is to access native management interface.
Usually it's bound to 9999 port.
In order to verify the port look for port attribute of management native interface socket binding in standalone.xml (standalone-full.xml or whatever configuration you are using)
For localhost it would be:
http://localhost:9999
Another way to check JBoss 7 status is to use management console.
Usually it's bound to 9990 port.
In order to verify the port look for port attribute of management HTTP interface socket binding in standalone.xml (standalone-full.xml or whatever configuration you are using).
For localhost it would be:
http://localhost:9999
Additionally, you can check the so called marker files.
Just go to deployments directory and look for .deployed file (if the file exists it means that your application is successfully deployed).
You can read more about deployment descriptors at:
https://docs.jboss.org/author/display/AS7/Application+deployment

Deploy & Debug remote Jetty with IntelliJ 12

I've been hacking and googling for a while now, and I've found several statck overflow threads that seemed like they were written for older versions of intellij, with various application servers. Usually they tell you to enter
java -Xdebug -Xrunjdwp:transport=dt_socket,address=51887,suspend=n,server=y
One answer suggests using something like
-agentlib:jdwp:transport=dt_socket,address=51887,suspend=n,server=y
But then I get this:
Error occurred during initialization of VM
Could not find agent library: libjdwp:transport.jnilib (searched /Library/Java/JavaVirtualMachines/1.6.0_37-b06-434.jdk/Contents/Libraries:/System/Library/Java/Extensions:/Library/Java/Extensions:.)
Then after one or the other of the above they tell you something like "Edit Configurations> jetty > remote and enter localhost, 51887" (the port number varies)
However in 12, the page you land on after you select remote has a plethora of options, and is asking for JNDI ports, not jdwp ports on another tab it actually suggests the jdwp parameters above.
Researching the JNDI port bit, generally yields instructions to add args like this to your command line...
-Dcom.sun.management.jmxremote= \
-Dcom.sun.management.jmxremote.port=1099 \
-Dcom.sun.management.jmxremote.ssl=false \
-Dcom.sun.management.jmxremote.authenticate=false\
I've done that too and I can see port 1099 held by java (using lsof) and I can telnet to 1099, so I know the JVM is listening. (We'll try not to worry about the fact that that appears to say, open up a port by which anyone install arbitrary java code over the network to your computer without a password)
However, in Intellij whenever I try to deploy and debug it gives me the following message:
I can see java RMI communications over 1099 when I snoop port 1099 with wireshark (but they are illegible). Evidently, the communications are not satisfactory for Intellij, so I'm wondering if there's something I need to do to Jetty to get it to play nice. Note that changing the Jetty version is not presently an option, so let's not go there :).
I've also tried removing the artifact, disabling make, and trying to just connect the debugger, but it still gives me the same red baloon and error message, so evidently the JNDI (port 1099) part is required.
Does anyone see something I'm doing wrong, or know of something else I should do to get this to work?
(I'm wondering if it is something similar to this: http://youtrack.jetbrains.com/issue/IDEA-65746 jboss issue)
Edit: Thanks to this google groups post I've discovered that it is possible to get the debugger connected if you don't specify Edit Configurations> + > jetty > remote, but instead choose Edit Configurations > + > remote, but debug and deploy is what I'm after so that's only a half solution.
Jetty remote configuration requires several manual steps which are performed automatically when you start Jetty directly from IDEA using the local configuration instead.
If you absolutely must use the remote configuration, try the following steps:
In the Remote staging section of the Server tab of the IDEA Jetty remote run configuration:
specify Same file system for Type and Host
specify path to the <Jetty home>/contexts folder in the Local path field of the contexts section
(settings will differ if you have Jetty running on another machine than IDEA, but I assume it's the same machine in your case)
Pass the following VM parameters to the Jetty process:
-Dcom.sun.management.jmxremote=
-Dcom.sun.management.jmxremote.port=<JNDI port>
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.ssl=false
-DOPTIONS=jmx
<JNDI port> value should be the same as specified in the JNDI port field of the IDEA Jetty run configuration
Pass the following configuration files to the Jetty process (in the command line):
etc/jetty-jmx.xml
etc/jetty.xml
If you need to debug, you should also pass to Jetty process VM parameters taken from IDEA Jetty run configuration: Startup/Connection tab, select Debug list item under the To debug remote server JVM ...
Here is the sample command line to start Jetty process with all the required options:
java -Xdebug -Xrunjdwp:transport=dt_socket,address=60208,suspend=n,server=y -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 -Dfile.encoding=UTF-8 -classpath start.jar etc/jetty-jmx.xml etc/jetty.xml

glassfish load balancer principle of operation

I have configured cluster with two instances on glassfish 3.1.1 and iPlanet Web Server as a load-balancer (on the same machine). For test application provided with glassfish everything works ok (and this application has session replication enabled).
But when I try to make my own application working following situation takes place: it responds when I send requests on ports of a particular instances (that is 28080 and 28081), but when I try to send request through load balancer (port 81) I get error 404. My application has not session replication enabled yet, but it can just make a connection and create two other sessions for each instance. I would like to get similar effect with load balancer.
So I would like to determine:
Is session replication strongly required to load balancer works fine?
Does anyone know any other reasons of this error?
Message from iPlanet log:
[23/Aug/2012:05:44:16] failure ( 4120) myHost: for host 127.0.0.1 trying to GET /myApp/login.jsp, service-j2ee reports: PWC6117: File "c:/webserver7/https-myHost/docs/myApp/login.jsp" not found
Additional conclusions:
(81 - http-listener port on iPlanet)
When I send GET http://localhost:81/testApp then loadbalancer passes it to glassfish and returns correct site. But when I try the same with my test application, GET http://localhost:81/myApp then iPlanet looks for this site in its own resources (docs directory as in log above)
fragment of myHost-obj.conf:
<Object name="default">
AuthTrans fn="match-browser" browser="*MSIE*" ssl-unclean-shutdown="true"
NameTrans fn="name-trans-passthrough" name="lbplugin" config-file="C:/WebServer7/https-myHost/config/loadbalancer.xml"
NameTrans fn="assign-name" name="perf" from="/.perf"
NameTrans fn="ntrans-j2ee" name="j2ee"
NameTrans fn="pfx2dir" from="/mc-icons" dir="C:/WebServer7/lib/icons" name="es-internal"
PathCheck fn="uri-clean"
PathCheck fn="check-acl" acl="default"
PathCheck fn="find-pathinfo"
PathCheck fn="find-index-j2ee"
PathCheck fn="find-index" index-names="index.html,home.html,index.jsp"
ObjectType fn="type-j2ee"
ObjectType fn="type-by-extension"
ObjectType fn="force-type" type="text/plain"
Service method="(GET|HEAD)" type="magnus-internal/directory" fn="index-common"
Service method="(GET|HEAD|POST)" type="*~magnus-internal/*" fn="send-file"
Service method="TRACE" fn="service-trace"
Error fn="error-j2ee"
AddLog fn="flex-log"
</Object>
First, if you are running the Load Balancer plugin, then you may have a support contract (a GlassFish license is required before you put the plugin into production). If so, calling support is a good option.
To answer your first question, session replication is not required for the Load Balancer to work.
As a shameless plug, I have a 5-part youtube series on setting this up. You can skip the videos on downloading and installing and go straight to setup/configuration/testing. Based on what you describe, I suspect the issue isn't the plugin itself, but the loadbalancer.xml configuration. Look at loadbalancer.xml and see if myApp is configured.
Hope this helps.