Chinna Eranna

Ranch Hand
+ Follow
since Dec 08, 2009
Chinna likes ...
Java
Bangalore
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
4
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chinna Eranna

Siddharth Bhargava wrote:

Isn't it this the way it should happen ?



You can do it anyway you want. If you want your dispatchAction.jsp should be shown first, then put that page entry in welcome-file list of your web.xml.
9 years ago
Problem is in your global forward.

Why are you not sending parameter from there. As I said, your Dispatch Action always expects a parameter called "parameter".

Change your global forward to


Change your action class to DispatchAction before you test, after above change
9 years ago

Siddharth Bhargava wrote:
I am getting the following exception everytime.



Sorry I have to go back to your first post, as there is some confusion. When are you seeing this problem exactly ?
9 years ago
You can try to debug the problem in these ways.

1) When you hit the link, what is the url you see on the browser ? And at the same time, you can use FireBug to see if any other request parameters are sent.

Or

2) You can change your action class from DispatchAction to normal action (org.apache.struts.action.Action), and print the request parameter map, and see what request parameters are coming in the request.
9 years ago
DispatchAction needs a request parameter with name "parameter" whose value should define what method to execute in your action class.

ex., when you submit a add form, the action of form should look like "action=/dispatchAction?parameter=add"

You can also try to have hidden variable in your form as <input type="hidden" name="parameter" value="add"/>
9 years ago
You can also look at ScheduledExecutorService class.

Hama Kamal wrote:thank you guys ,, but i would apprecaite that if you could tell me how it works in detail....
what this line is doing exactly?



Causes the current thread to release the resource called "CPU/processor", and allow other threads to execute.

Sham Phadtale wrote:Client still uses old credentials which are invalid and so resulting in server error saying - User Invalid.



Assuming your client is completely in Java, Why will it use old credentials ? Probably some cache is not being updated.
I believe, you should fix this problem, rather looking for restarting the application.
9 years ago
Java cannot restart itself. Why do you want to do that ?

You may want to wrap the jvm in some script like shell script in unix.
9 years ago
Ramesh,

As you said For each Servlet instance, init() is called once.
If the Servlet Container is implemented to create multiple instances of servlet, then it will invoke init() method for each servlet instance.

BTW, SingleThreadModel is deprecated in Servlet 2.4 spec.
9 years ago
According to JavaDoc For InetAddress,

the argument to getAllByName can be a machine name or textual representation of ip address.

Why are you passing the protocol part to it ?
9 years ago
Are you sure that "http:\\\\www.google.co.in" works in another machine ?

What you are giving above is url, not the address. Just give the address part of it and try. (i.e., www.google.co.in)
9 years ago

Rose Jac wrote:
Also, the elements of the Array are coming as null, so i guess, the individual elements of the ArrayList would also come as null, isnt it?



When the elements of Array are coming as null, that means there are no ArrayList objects, at that index.

Then why do you even think of individual elements of ArrayList.. ?
9 years ago

S Thiyanesh wrote:Its a synchronization issue due to race condition.
................
If you have this logic, then you need to use synchronized.



That is true only in the case, when the variable is shared between threads.
If the variable is local to a method, it is not the reason.

Chets, You need to show your logic, that you are following to get the values from map.

chets patel wrote:
what if I store this map in some application context and fetch it in local variable whenever required?



That will not help unless you clone the complete map.

But I think, You need to look into your logic. Multiple threads reading a same map(assuming its not being muted at run time) will not cause this problem.