Eli Ean

+ Follow
since Jun 06, 2015
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Eli Ean

Hi everyone,
I have an Android application which send strings, and get strings from a tomcat server.
When I run Tomcat in my local machine: the job gets done and everything works well.
When I run tomcat in remote server, things from the server are being sent to the application except  the JSON strings.

I will try to show you an example.

This is a code in an Android application that SENDS string to the web application in the remote server (The Tomcat). It works fine!

works well ! no problem to send (I verified by the console output - it is being send) and reaching the right place.

This is a code in an WEB application in the remote server (The Tomcat), that SENDS string back to the Android  application (After quering the DB and got an answer. I verified of course it has the right answer from the DBand it has).
Not any Error with this part neither.


Now, This  is the Android application which suppose to get the answer  from the server:

Here is the problem:  the second row will throw java.lang.NumberFormatException invalid int "null"
becaue id didn't recieve anything from the Server.

Here is the strange part: When the same code is running vs the local server it works.
When it is running vs remote server it doesn't work.
No Errors but the Sending from Tomcat to the Application, doesn't arrive when JSON is involved (I guess it has something with the way of sending:  "response.getOutputStream().write(output.getBytes());"
that the server forbid, but I really don't know. it just doesn't send (without any error).

when I send send from the server a simple string this way:

it works fine.


7 years ago
Problem was solved.  
Thanks Tim.
7 years ago
Hi everyone,
When I used Eclipse I could see all the output messages (of System.out.println) shown LIVE in the console of Eclipse.
Now there is running Tomcat in a remote server without an Eclipse around.

The places I've searched so far:

1. tomcat/logs/stdout.log   - Shows the wanted messages - bot not in LIVE. I mean with this file (tomcat/logs/stdout.log ), in order to watch the updated
messages I need to open the file every time again and again and again,
while I would like to watch the messages immediately as they come (as in Eclipse console..I call it LIVE).
2. tomcat/logs/catalina.log  -shows just details about the tomcat lasts startup.
3. catalina.out - I've been told it might be there but I don't find that file

Do you know where can I find this kind of living stream?

7 years ago
Hi there,
Prbblem was solved!
Instead of writting a number and ports, just write the domain name (without www).
For example: If the domain is www.abc.com, the
url will be:

Tim thanks for the note about :

The "ROOT" part indicates that the app is deployed not as a separate project,
which means the "myServletProjectName" part of the URL should be omitted.

It helped.

Thank you,
7 years ago
Hi Tim, thank you for your answer.
I tried what you wrote:

and it didn't work. When I write "didn't work", I mean there is no connection between my application and the Tomcat server.
I checked The tomcat and it is running.

Is there maybe other thing I need to do in order to have a connection between them?

When I used the application in my house, my wireless connection was enabled because I made the phone and the
computer surf on the same new (a WiFi net from my router).

Here I don't do anything. should I?

I can say that where I check if I can surf the www.domainName.com from my phone
through the regular internet I can.

So, in your opinion, is it the Url issue or something else?


7 years ago
Hi everyone !
I have an Android application which connects to a servlet (On Tomcat) which queries an SQL server.

First I tried it in my computer. My Tomcat was running in my local machine.
The tree (in Eclipse) was seen like this:
myServletProjectName--->java resources--->src---->myServletPackName---->myServletClassName

The url from my application didn't mention all this path, but only the servletProjectName and the servletClassName:

Everything works fine.

Now, I upload a war file of the servlet to a remote server (not the Tomcat is running on that server).
The tree over there (not in Eclipse but in regular folders is):

May you please tell me, what should be my url in order to connect  my Android application to this servlet? (Ofcours I know the ip address,
but I don't know what are the folders I should write in the url -- I don't see my project name in this tree).

Thanks a lot,
7 years ago
Hi Tim and Jayesh. Thanks for helping someone who deals with servers for the first time.
Ok, I'm using SQL server and not MySql because 2 simple reasons: My ex workplace had SQL Server, and when I started develop
the application, I naturally went to my familiar DB and it was a free version (express version).
Now it will be little difficult to move to MySql, because I have already more than 250 stored procedures which I use them.
If there isn't a simple way to convert them to MySql, I would prefer to avoid this option.

I understood It is not the best idea to have Microsoft Sql Server and Tomcat in the same server.
The reason is that Tomcat runs best on Linux OS and MS Server can not run over there, so I need to have 2 servers (and not
2 accounts as I thought before).

Jayesh, about your line:

Actually, Amazon will give you a small server for free for 1 year.

Must say sounds strange...well, do you think it is a good solution in a case I preserve my will to use Tomcat and MS Sql
for the application ? I remind this server will use only 1 client - me. All my goal for now is to be able to use thw application every place,
and not as I do these days - only in places are not farther than 30 meters from my router.

7 years ago
Hi Tim, thanks for the answer. The first option sounds little bit scary so I won't use that one.
About the second option you mentioned, I've just connected an hosting company which said it is not possible to
have my application on one server because I don't use MySql  (I'm using SQL Server).
I need to have 2 accounts:
1 that will contain the tomcat server (tomcat hosting) , and then a second account will be the sql server (ASP.Net. hosting) with SQL
server on it.
This way the phone will send a message to the Tomcat in the first server, then the Tomcat will query the Db in the ASP.net server.
Sounds not the best solution for performance issue..
A better solution?
7 years ago
Hi everyone! I have an Android application which uses Tomcat in a servlet this way:

1. The user click on a button in the phone (the client).
2. The client sends a message to a Tomcat which is running on my personal computer.
3. The Tomcat sends a message forward to SQL server (which also in my personal conputer).
4. The SQL server sends an answer back to the Tomcat .
5. The Tomcat sends the answer forward to the client (the phone) .
Until now everything works well.

Now, I have a router which creates a little private net in my house,
so my phone and my computer are connected to the same net (this little net in my house by my router).
It means, I can use this application wireless but only inside my house (or 20 meters around the router).

The question is, what do I need to do now, in order to use this application everywhere without being depend in the distance from my router.
I guess there are things I need to do about moving to a server.
How do I move all the JAVA code (I wrote in the Tomcat side), and SQL code (I wrote in SQL server) to a server.
Thanks you,
P.S  As you can notice from my message, I'm not so familiar with servers  
7 years ago
Got it. Thank you Tim. Appreciate your help.
I guess there are some people in the world who can learn something from this conversation.
Problem solved.
8 years ago
Wow. You surprised me. Do you say I don't need to change any XML file as web.xml and things like these?
and no new object is needed like ComboPooledDataSource??

Nothing else is needed for Pooling, and my servlet is using now Pooling?
8 years ago
Hi Tim, due to your explanation I feel I understand the pooling issue much better, the thing is that I still remained with
the problem of not knowing how to implement the pooling issue.

Today the way of getting a connection (after moving to JDBC driver instead of jdbc-odbc, thank to Claude, Dave and your advice ) is:
1. In the init() I create the data source by:

2 In the doPost(), I use the connection and close it by:

Now, how do I insert the Pooling issue? I mean which new object should I use in the Java code?
which new changes should I make in some xml files?
8 years ago
Hi all, Wanted to say I moved to JDBC driver by 3 steps:
1. Installed the sqljdbc4.jar
2. As Claude suggested I configurated the data in servlet container (I mean in ProjectName/WebContent/META-INF/context.xml):
<?xml version="1.0" encoding="UTF-8"?>

3.In the servlet code I got the connection this way:

It works.

The thing is that after reading about Pooling , I understand the idea, but I didnt realize what is the diference in the code.
I mean, I didn't see any diffrent code for pooling, than what I wrote above.

May you tell me what are the changes I should add for this Pooling goal?

8 years ago
Tim, Dave, and Claude, thank you very much for your responses.
I'll try and update
8 years ago
Hi Claude, It's obviously you know about this (much) more than I do, so thank you for your advices. I must tell you that few months ago when I tried few ways to connect to
Sql Server through the servlet I had really lot of attempts, and the JdbcOdbc way was the only one which did the work, so I'm little bit afraid to go and try again all this mess.
Inspite of that, I think I don't have any choice and I need to do what you wrote.
A little question about this sentence :

Moreover, I would not define manually my datasource. I would configurate it in my servlet container, and then I would execute a lookup via JNDI

Is this suggestion for how to use the JDBC driver (the new way I'm going to try) , or for the current JdbcOdbc driver (my current way)?
8 years ago