Mitan Chandihok

Greenhorn
+ Follow
since Dec 31, 2002
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 Mitan Chandihok

I work as an administrator for WebSphere on OS/390. I spoke with some of our distributed guys and they mentioned the aspects of JVMs within their application. When they have problems they usually have to bounce the JVM to get things back up and running.
My question is how does JVM fit in the distributed world? How does it differ in a Mainframe world? My understanding was the container runs all J2EE associated things and the container code ran within the JVM. Wouldn't bouncing a JVM be the end all process?
Any clarification is helpful.
21 years ago
I think his solution would be to take a look at the HTTP protocol RFC. You want a client written in Java to hit the servlet and get data back. If I understand properly, you want to POST to a servlet without a web browser but with Java code.
By checking out the RFC you can check what needs to be sent as a standard HTTP request to a server and how the POST should look like when being sent. Also, if you google, or maybe native Java libraries include classes that write requests and POST data for you.
Another solution is if *YOU* have access to the servlet your trying to hit, you can define the doGet method to call the doPost method, and then you can just send a request within Java with your name/value pairs in the querystring.
Good luck!
21 years ago
Sudd,
Well HTTP is a stateless protocol, basically its like this, the client (browser) asks a question, and the server (Web Server/App Server) answer the question back. It does not remember any previous communication nor does it talk back when not being spoken too.
Using HTTP for an application like u described would not be able to work without an auto-refresh built into the HTML because you would need to tell the server to reanswer your question.
Hope that explains some stuff.
21 years ago
Does anyone here have any familiarity or knowledge of IBM WebSphere on OS/390 or z/OS Mainframe? Is there any sort of discussion group for this sort of thing?
21 years ago
Are you trying to authenticate of a true WAS server or WSAD? Also, are you trying to authenitcate of the local OS?
As far as any other problems go, I have done some fooling with authentication. Start of easy, map your control servlet say with the name controlServlet to /controlServlet and /secure/controlServlet. Then in your security constraints throw in /secure/* as a protected resource. Define whats protected to that resource and try to logon using basic authentication. Once that works as planned, add in the getUserbyRole programmatic authorization code and test that. Remember, in order to authorize EJBs programmatic authorization code doesn't neccessarily have to be there.
21 years ago
I am a bit confused by your question. Do you want to add security credentials to block access to that directory? Is that directory home to a web application.
Please explain how you want to limit access? You can always do a chmod to the directory in its most rudimentry form.
21 years ago
Yes I did. Basically what I have done is not make Request and Response objects global, anything added or removed from the session is now within a synchronized method and all database access is open'd and closed in the doPost method. Works quite well too.
My application wasn't really a useful app, but more to test out our infrastrcuture setup.
21 years ago
Thanks for the understanding. I have reworked my entire servlet to get rid of "global" request, response, and session objects and pass them all throughtout my doPost method.
Maybe you can offer some expertise, but when using a Datasource what I do is do the lookup within the init() method of my servlet and open and close a connection again in my doPost method. Does that sounds like it will take advantage of connection pooling and things of that type?
21 years ago
I think your going to hate me now. I had private global variables in my servlet to have a global version of request, response, and session variables. I used these throughtout my servlet, and I have used this before. The thing I forgot (its been a while since I have done servlet programming) is that I didn't implement single thread model, wow do I feel dumb.
Thanks for your help!
21 years ago
Here is a stack trace of the errors occurred when running a load:
[1/2/03 12:41:52:634 EST] 11c7b616 WebGroup X Servlet Error: Context has not been prepared for next connection: java.lang.IllegalStateException: Context has not been prepared for next connection
at com.ibm.servlet.engine.srt.NilSRPConnection.getAttribute(SRTConnectionContext.java:454)
at com.ibm.servlet.engine.srt.SRTServletRequest.getAttribute(SRTServletRequest.java(Compiled Code))
at com.ibm.servlet.engine.srt.SRTServletRequest.getAttribute(SRTServletRequest.java(Compiled Code))
at com.ibm.servlet.engine.webapp.HttpServletRequestProxy.getAttribute(HttpServletRequestProxy.java(Compiled Code))
at com.ibm.servlet.engine.webapp.HttpServletRequestProxy.getAttribute(HttpServletRequestProxy.java(Compiled Code))
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.include(WebAppRequestDispatcher.java:119)
at com.bank.ControlServlet.doPost(ControlServlet.java:121)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java(Compiled Code))
at com.ibm.servlet.engine.webapp.StrictServletInstance.doService(ServletManager.java(Compiled Code))
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet._service(StrictLifecycleServlet.java(Compiled Code))
at com.ibm.servlet.engine.webapp.IdleServletState.service(StrictLifecycleServlet.java(Compiled Code))
at com.ibm.servlet.engine.webapp.StrictLifecycleServlet.service(StrictLifecycleServlet.java(Compiled Code))
at com.ibm.servlet.engine.webapp.ServletInstance.service(ServletManager.java(Compiled Code))
at com.ibm.servlet.engine.webapp.ValidServletReferenceState.dispatch(ServletManager.java(Compiled Code))
at com.ibm.servlet.engine.webapp.ServletInstanceReference.dispatch(ServletManager.java(Compiled Code))
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.servlet.engine.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java(Compiled Code))
at com.ibm.servlet.engine.srt.WebAppInvoker.doForward(WebAppInvoker.java:91)
at com.ibm.servlet.engine.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:184)
at com.ibm.servlet.engine.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:67)
at com.ibm.servlet.engine.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:106)
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:125)
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service(OSEListener.java:315)
at com.ibm.servlet.engine.http11.HttpConnection.handleRequest(HttpConnection.java:60)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:323)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java(Compiled Code))
at com.ibm.ws.util.CachedThread.run(ThreadPool.java:122)
21 years ago
I think you may be mistaken, I go from the servlet and use RequestDispatcher to forward the response to a JSP. I don't use jsp:forward tag at all, unless I should be using that in which case can you explain in a little more detail.
I understand that nothing should be commited as a response to a request to the client if I am going to forward my request, do you know of anyways that a response is committed? I don't set any header types or even instantiate printwriter. I am trying to adhere to an MVC style of programming and only contain "work related" code in servlets (like number crunching etc. etc.)
Thanks.
21 years ago
I don't do anything within the servlet, rather I add a bean to the request via request.setAttribute and then call the RequestDispatcher to forward that to a JSP. The buffer size problem could be the thing making my problems occur, but I think I am not understanding the fundamentals of this.
When a servlet is being called and it is NOT implementing single thread model, multiple instances of this servlet are used to handle multiple requests simulataneosly. If the servlet forwards responses to a JSP, are multiple instances of the JSP called as well? If so, do these multiple instances share the same buffer? I did try to force the JSP to use single thread by adding <%@ page isThreadSafe="false" %>, but I still get the same IllegalStateException problems when I run load through my application.
Just to reiterate, the application works pretty well when I am just clicking through from my browser, but when I run a fairly heavy load I get IllegalStateException's every few times. I also sycronized the method where request.setAttribute is called as to clear all bases.
21 years ago
I have an application that has a form control hit a servlet and then the servlet does some unit of work which then forwards the request to a JSP with a JavaBean carried over in the request. This works fine when I am manually doing things to my application but the minute I use a stress tool to push some "real" work through the application I get a lot of IllegalStateExceptions.
I don't understand why this would happen. I have tested this in a servlet which looks to a database for data as well as a servlet that concatenates two strings together and passes the resultant string along with the request.
I am using WebSphere on WAS/390 as well as testing on WSAD and I get the same results. Could this be attributed to anything you guys have seen in code?
[ January 02, 2003: Message edited by: Mitan Chandihok ]
21 years ago
I am an administrator for WebSphere running on an IBM mainframe and within that there are nuances between WebSphere on distributed and mainframe. Currently I am running tests on our servers to see what they can and cannot do (don't ever believe the vendors) but I guess its a fun job all in its own. Write once run anywhere is not quite yet there, but this is a step in the right direction and that is a good thing.
I have searched around for an answer but couldn't find one suitable. My understanding is if you use request dispatcher to forward your request, you must not have a request already pending. That makes sense to me, and seems as if working as expected within in App Server.
My problem is I am getting an IllegalStateException when I put some stress on my application. I ran a test with about 1000 requests and 4 or 5 came up with the IllegalStateExcpetion ERROR: Cannot forward. The response has already been committed.
Do any of you know what causes this or if there is a solution? Can it be locking of the JSP file (I thought as long as JSPs were thread safe they should be fine.) I am passing a Bean and using a jsp:useBean with scope="request".
I'll post some code if my description doesn't spark an answer.