vinodh rmahen

Greenhorn
+ Follow
since Jul 22, 2008
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
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 vinodh rmahen

Thanks for the information.
14 years ago
I am trying to make a request to a servlet using HTTPClient within contextInitialized(ServletContextEvent event) of a ServletContextListener, but I get an exception saying that the web module has not yet been loaded.
I am trying this on IBM WebSphere Application Server 6.0.x

Is there any setting which can be used have the servlet initialized and ready to server requests when the call from contextInitialized(ServletContextEvent event) is made
Or
Is there any restriction in the Servlet Specification which prevents this from happening.

Here is the exception:

[4/30/09 8:13:28:782 EDT] 0000007f WebGroup A SRVE0169I: Loading Web Module: MyListener.
[4/30/09 8:13:28:891 EDT] 0000007f SystemOut O Inside MyListener:contextInitialized()
[4/30/09 8:13:29:110 EDT] 00000082 WebContainer E SRVE0232E: Internal Server Error.
Exception Message: [com.ibm.ws.webcontainer.exception.WebAppNotLoadedException: Failed to load webapp: /MyListener
at com.ibm.ws.webcontainer.webapp.WebGroup.handleRequest(WebGroup.java:233)
at com.ibm.ws.webcontainer.VirtualHost.handleRequest(VirtualHost.java:210)
at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java(Compiled Code))
at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java(Compiled Code))
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java(Compiled Code))
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewInformation(HttpInboundLink.java(Compiled Code))
at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:288)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminaters(NewConnectionInitialReadCallback.java:207)
at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:109)
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.requestComplete(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.attemptIO(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager.workerRun(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.tcp.channel.impl.WorkQueueManager$Worker.run(WorkQueueManager.java(Compiled Code))
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java(Compiled Code))
]
[4/30/09 8:13:29:110 EDT] 0000007f HttpMethodBas W Going to buffer response body of large or unknown size. Using getResponseBodyAsStream instead is recommended.
[4/30/09 8:13:29:141 EDT] 0000007f SystemOut O <H1>SRVE0232E: Internal Server Error.
Exception Message: [Failed to load webapp: /MyListener]</H1>
<H3>Failed to load webapp: /MyListener</H3>
IBM WebSphere Application Server
[4/30/09 8:13:29:141 EDT] 0000007f VirtualHost I SRVE0250I: Web Module MyListener has been bound to default_host[*:80,*:10013,*:10010,*:10038,*:10035].
[4/30/09 8:13:29:157 EDT] 0000007f ApplicationMg A WSVR0221I: Application started: MyApp
14 years ago

Adam Michalik wrote:Yes, a reference takes always the same amount of memory.


Do references store only the memory address of the Object they are pointing to, if so then where is the information about the size of the Object they are referring to available?
15 years ago
Thanks for clarifying.
15 years ago

Ernest Friedman-Hill wrote: It's a simpler rule to remember, once you understand it correctly.

Yes I totally agree, thanks once again for all the information.
15 years ago
I remember reading that String literals are stored in a Pool and thus reused, consider the following snippet:



If I enter Hello as the input, result is:
true
true
false
true

So I understand that System.out.println("Hello" == qw); displays true, but how come the reference variable "as" is not pointing to the same Literal pointed to by variable "qw"?
15 years ago
I wanted some clarification regarding the amount of memory allotted to object reference variables.
Do, reference variables to different kinds of Objects occupy the same amount of memory (say 4 bytes) ex:



I assumed that these object reference variables store the memory address of their corresponding objects. I wanted to know if these 3 variables [a,b,c] occupy the same amount of memory (say 4 bytes)
OR
these variables occupy different amounts depending on the type of Object being referred to.
If the later is true, are different types of Objects(String, Integer, Dog) allotted space at pre-determined sections in the Heap.
15 years ago
Thanks for explanations, all this time I assumed that the Object itself gets copied.
Looking at a higher level is this behavior not similar to 'Pass By Reference' feature of languages like C, C++? I understand that the Object reference is 'passed by value' but with respect to the Original Object it can still be modified within the function, thus I feel that the name 'Pass By Value' in Java is a little misleading .
15 years ago

Rob Prime wrote:
However, both references still point to the same object on the heap. If you change that object both references will see those changes.



Thanks for mentioning about the code tags.
If this is the case, can you please explain why "a1+=10" doesn't modify the original Interger object (snippet 1).

Thanks.
15 years ago
We all know that Java uses Pass by Value and not Pass by Reference, as illustrated by the output of the following snippet :


Output :
Before - a=10
After - a=10

This is as expected as we are trying to modify a copy &amp; the original object is not affected.



But while trying the following snippet :


I was expecting the output to be :
Before - a.size()=0
After - a.size()=0

But the output is :
Before - a.size()=0
After - a.size()=1

Why this difference in behavior?
I could only think of the following :
In the first case the Object instance is copied and this copy is acted upon by function 'test', but in the second case a copy of the reference variable is sent thus we have two references to the same object instance(ArrayList, in this case) - is this what is actually happening?
15 years ago
Thanks for clarifying.
15 years ago
Thanks for the reply, apologize for the confusion, let me refine the question.
I want to know if its possible to display the date object in the same way as the String which contains the date, say for ex:
Consider the string 26/08/1994 is it possible to display a date object in this fashion?
A sample code will be very helpful, thanks.
15 years ago
Hi

Here is the requirement "how to convert a string into date without changing its format"
When i tried to do this using SimpleDateFormat :
SimpleDateFormat formatter = new SimpleDateFormat("dd/MM/yyyy");
Date date = formatter.parse(str);

Output
String 26/08/1994 gets parsed as Fri Aug 26 00:00:00 IST 1994.
The format gets changed is it possible to preserve the format?

Thanks in advance
15 years ago