Java EWS API works under windows but not on linux - java

I have compiled and executed some proof-of-concept code using the java-ews-api, and have had success when running it under windows. THe same code times out when I run it under linux. Firewalls seem as if they are the most likely suspect, but I can ping the exchange server from eh Linux server.
Could you offer suggestions as to what I should test or research?
Thanks in advance

Thinking about the situation some, it became clear to me that it's simply a firewall issue. The simplest way for me to test connectivity to my Exchange server (using https) was via netcat:
netcat webmail.mydomain.com 443 < /dev/null; echo $?
That will print zero (0) if port 443 is open on that host, and a one (1) if it is closed.

Related

Oracle Weblogic 12c Shutdown not working for two ports

I have recently turned on SSL port 7003 for my managed server on Weblogic, earlier it was running on non-ssl port 7002. I have disabled non-ssl port by unchecking listen port enabled. Now the Managed Server is only working on SSL port 7003. This is when it gets strange..... I turn off managedserver and I could still see 7003 running (I can access the server on browser). Now I turned off Weblogic (stopWeblogic.sh) and still I can access 7003 port. Can someone explain why on earth is this happening? I went on to a lot of sites and no help.
Thank you so much
Most likely the server didn't stop. Check with netstat -tanp and see what process is using the port. If it is java, there you are. If you dare (test or production?) do a kill -9 pid to get rid of it. I assume you are running on Linux, otherwise there are similar commands for Windows (netstat, task manager or pskill).

Deploy a Java Application made with sockets?

I wrote a Java Application that works with sockets (you know, I open a SocketServer in some port, for example 8000). The application works very well, but now I want to deploy it to some server. I've tried with Heroku, but it just opens ports 80 and 443. I also tried with AWS and Digital Ocean, but both require a Credit Card (I don't have one :'( ) to get access to a Virtual Machine, and have the control of it.
What do you suggest me (another PaaS or another solution)? Thanks, beforehand.
Oh, I could solve it. It seems that there is an environmental variable called PORT, and all the connections to port 80 are redirected to that port. I'll run my Application in PORT, and it will be all. All the messages from port 80 will be redirected to PORT.
Did you try a -p option for changing the port with heroku?
heroku local -p 7000

Client-Server Chat application JAVA

I have a simple java written client and server chat application(with sockets). When running on the same network/computer it works fine. However when i try to run the client from a different network it doesn't connect. I tried using the public IP address of the server to connect the client to the server but without luck. How would I be able to connect to the server app from a different network? any help would be appreciated.
It sounds like you have more of a firewall issue than a problem with the application. Instead of trying to connect with the Java client, first try connecting with Telnet to the server from the same computer, then from the other computer. The first effort will show you what to expect when it works. For instance, if your server is running on port 999, use telnet server.example.com 999.
If the machines are Linux boxes, use iptables -L to see whether there is a block on the port you are trying to access.
If you're still having problems reaching the server, run tcpdump -i tcp:999 on the server host to see what traffic is making it to your server socket, then run the telnet commands again. You should see the tcp connection established when connecting from the local machine, maybe or maybe not when connecting from other machines. If you don't see it while connecting from other machines, run tcpdump there too to make sure the client is definitely sending the traffic to the server.
After you are sure that the server can receive traffic and that your client is sending the traffic, there are no mysteries about what is actually going on and you should find your problem.
It worked after I did port forwarding on router. Most of the ISP provided modem/routers wont let you manipulate ports so had to buy my own modem/router, forwarded the port and worked like a charm. Information on what port forwarding is can be found here : http://www.howtogeek.com/66214/how-to-forward-ports-on-your-router/

how to open a process in a remote server using apache telnet

i encountered a problem using the apache commons-net telnet api, and hope you can help me with it.
i am connecting to a remote unix server via telnet and running a script , that at some point run an .sh file. that file open a server that needs to continue running even after the telnet connection to the client is closed. the problem is that when i close the client connection the process stops. i think that when the connection is lost there is no reference to the running process and the os is killing it but im not sure.
if that is the case i understand that if a could open the server process as a deamon process the problem will be resolve.
maybe there are other ways to do it...
can someone help me to solve this thing?
thank
moshe ben noun
A combination of nohup and running the process in the background using & should do what you are looking for.
http://www.livefirelabs.com/unix_tip_trick_shell_script/june_2003/06022003.htm

Opening port 80 with Java application on Ubuntu

What I need to do is running a Java application which is a RESTful service server side writtern by Restlet. And this service will be called by another app running on Google App Engine.
Because of the restriction of GAE, every http call is limited to port 80 and 443 (http and https) with HttpUrlConnection class. As a result, I have to deploy my server side application on port 80 or 443.
However, because the app is running on Ubuntu, and those ports under 1024 cannot be accessed by non-root user, then a Access Denied exception will be thrown when I run my app.
The solutions that have come into my mind includes:
Changing the security policy of JRE, which is the files resides in /lib/security/java.policy, to grantjava.net.SocketPermission "*.80" "listen, connect, accept, resolve" permission。However, neither using command line to include this file or overrides the content in JRE's java.policy file, the same exception keeps coming out.
try to login as a root user, however because my unfamiliarity with Unix, I don't know how to do it.
another solution I haven't try is to map all calls to 80 to a higher port like 1234, then I can deploy my app on 1234 without problem, and GAE call send request to port 80. But how to connect the missing gap is still a problem.
Currently I am using a "hacking" method, which is to package the application into a jar file, and sudo running the jar file with root privilege. It works now, but definitely not appropriate in the real deployment environment.
So if anyone have any idea about the solution, thanks very much!
You can use iptables to redirect using something like this:
iptables -t nat -A PREROUTING -i eth0 -p tcp --dport http -j REDIRECT --to-ports 8080
Make the changes permanent (persist after reboot) with:
iptables-save
Solution 1: It won't change anything, this is not a Java limitation, it's the OS that is preventing you to use privileged port numbers (ports lower than 1024).
Solution 2: Not a good idea IMO, there are good reasons to not run a process as root.
Solution 3: Use setcap or iptables. See this previous question.
A much easier solution is to set up a reverse proxy in Apache httpd, which Ubuntu will run for you on port 80 from /etc/init.d.
There are also ways of getting here with iptables, but I don't have recent personal experience. I've got such a proxy running right now.

Categories