Performance Analysis: java classes run fast, but http response is delayed
Hello,
I´m analysing a performance issue on our application and I have the following symptons:
- A profile analysis with YourKit Java Profiler 7.5 told us that our java classes are running "fast" ( mostly less than 10s ).
- The access_log of the Oracle HTTP Server (httpd.conf LogFormat %T parameter) show us that the time taken to process the entire request is 130s
- The users told us that the application runs fast for a while, but after some minutes, the entire application runs slowly. After some minutes again, the entire application runs fast again.
- There are no overload of CPU, MEM, IO, Networking. All have been checked and are ok.
- At the same time the application A runs slowly, the application B on the same server ( but another instance ) runs normally.
- There is no database botleneck. All the application queries have been profiled and optimized for best run.
- A huge number of application threads exists on the java virtual machine. The peak was 187 threads ( mostly sleeping. Just one or two were running ). The threads average in the vm is 150.
- Our application has few EJB ( 4 ), few ejb-calls. All the EJB calls are cached with EhCache. The cache timeout is 2hours. When time-out occurs, the cache is invalidated, cleared and reloaded.
- We have only 10 users.
My hypothesis are:
1. Application server thread blocking. Some threads take until 13 minutes to finish, even when the java processing took only 23 seconds.
2. Some problem with the size of the AJP packages between HTTPServer and Application server.
I´m really desperate for help. Any help will be widely appreciated.
Oracle Application Server 9.0.3.3 running on
Sun Solaris 5.9
Sun Java Development Kit 1.4.1_05-b01
Is there any way to configure the max number of threads in the application server? Where?
Thanks in advance,
Murilo
You can tweak the application server threads as described here:
http://download.oracle.com/docs/cd/B31017_01/web.1013/b28950/threadpool.htm#BHBDGJBI
Oh just noticed you are on 9.0.3.3 -- that is a very, very, very* old release. I don't think we had a tunable thread-pool back then. The oldest doc I can find is for 10.1.2, which I think is where we first introduced the thread-pool manager:
http://download.oracle.com/docs/cd/B15904_01/web.1012/b14011/advanced.htm#i1014357
Is there any garbage collection occurring that could account for the slow-down in ART? I guess not if APP-B continues to run well over the same period.
-steve-
Similar Messages
-
Hi Gurus,
We are using Report 10g on 10g Application server and solaris. we created a report on a table which has 10,000 rows. The report has 25 columns. when we run this query in Toad it took 12 sec for fetching all these 10,000 rows
But when we run the report with Destype = 'FILE' and Desformat = 'DELIMITEDDDATA', it is taking 5 to 8 minutes
to open in excel ( we concatenated mimetype=vnd-msexcel at the end of the url if the Destype=FILE). We removed the layout in the report as it is taking 10 to 15 mins to run to Screen with Desformat=HTML/PDF(formating pages taking more time). We are wondering why DELIMITEDDATA format is taking long time as it runs only query.
Does RWSERVLET take more time of writing the data to the Physical file in the cache dir? Our cache size is 1 GB. we have 2 report servers clustered. Tracing is off.
Please advise me if there are any report server settings to boost the performance.
Thanks alot,
Ram.Duplicate of Strange problem... Query runs faster, but report runs slow... in the Reports forum.
[Thread closed] -
I have a 3.2 GHz Intel Core i3, 27 inch, Mid 2010. It used to run fast but now it seems to have slowed down like when surfing or opening applications. I downloaded all the updates restarted but it still seem slow. How do I speed it up? Thanks - ManongCA
Activity Monitor – Monitor Performance Problems
Why is my computer slow
Why your Mac runs slower than it should
Things you can do to resolve slowdowns see post by Kappy -
Java.io.IOException: Server returned HTTP response code: 500
Hi,
I am connecting to a servlet from an applet to send and receive data using the following code.
try
URL servletURL = new URL("http://www.progressivecoding.com/servlet/gatesqlang");
URLConnection servletConnection = null;
URLConnection servletConnection = servletURL.openConnection();
servletConnection.setDoOutput(true);
servletConnection.setUseCaches(false);
PrintStream out = new PrintStream(servletConnection.getOutputStream());
out.println("hhd8836gh828dhhskjdhn38847gosf747");
out.close();
InputStream in = servletConnection.getInputStream();
StringBuffer response = new StringBuffer();
int chr;
while ((chr=in.read())!=-1)
response.append((char) chr);
in.close();
return response.toString();
catch (IOException e)
e.printStackTrace();
tfTxtFile.setText(e.toString());
return "An error occurred: " + e.toString();
Everything was working well and fine. All of a sudden without any change of code. It began to return this error to applet
An error occurred: java.io.IOException: Server returned HTTP response code: 500 for URL: http://www.progressivecoding.com/servlet/gatesqlang
But I am able to access the same URL from a browser.
Someone please tell me what could be the problemhi, that error got solved, the SessID i was receiving in that code had some leading or trailing white spaces. so SessID = SessID.trim() did the job.
But i have a question. This program workd fine when i compile and run from my local system. But when i port this on to the oracle server (JAVA_TOP) and access this from a JSP, then the program performs very un-reliably.
The first data transfer works fine, i get the SessID, when i pass that SessID along with the DTSSessionID to the server, the server says that i doesn't recognise my SessID, and throws a client.Authentication Error.
So there goes the parsing out of the window for the data in the second iteration. -
Hi,
I am using java.net.URLConnection to invoke servlet which uses oracle.xml.sql.dml.OracleXMLSave for dml operations.
I am facing below exception.
09/05/26 17:47:50 java.io.IOException: Server returned HTTP response code: 500 for URL: http://xxx.com/servlets/com.xxx.qu.XMLDocPostOracleInsert
09/05/26 17:47:50 at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpConnection.java:)
09/05/26 17:47:50 at com.xxx.util.http.HTTPRequester.makePostRequest(HTTPRequester.java:)
09/05/26 17:47:50 at com.xxx.qu.PostReceiver.doPost(PostReceiver.java:145)
09/05/26 17:47:50 at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
09/05/26 17:47:50 at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
09/05/26 17:47:50 at com.evermind.server.http.ServletRequestDispatcher.invoke(ServletRequestDispatcher.java:810)
09/05/26 17:47:50 at com.evermind.server.http.ServletRequestDispatcher.forwardInternal(ServletRequestDispatcher.java:322)
09/05/26 17:47:50 at com.evermind.server.http.HttpRequestHandler.processRequest(HttpRequestHandler.java:790)
09/05/26 17:47:50 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:208)
09/05/26 17:47:50 at com.evermind.server.http.AJPRequestHandler.run(AJPRequestHandler.java:125)
09/05/26 17:47:50 at com.evermind.util.ReleasableResourcePooledExecutor$MyWorker.run(ReleasableResourcePooledExecutor.java:192)
09/05/26 17:47:50 at java.lang.Thread.run(Thread.java:534)
The oraclexmlsave operations are with in try-catch block as shown below, but its not getting caught there(Donnno Whyy????).Instead its giving
exception at HttpURLConnection.getInputStream
try{
System.out.println("entered try :1");
String Query="SELECT * from global_name";
Statement CntStmt=con.createStatement();
ResultSet rsEmailAlertQuery=CntStmt.executeQuery(Query);
while(rsEmailAlertQuery.next()){
System.out.println(rsEmailAlertQuery.getString(1));
OracleXMLSave oxs = new OracleXMLSave(con,insertObject);
System.out.println("MI B: ");
oxs.setRowTag("row");
oxs.setIgnoreCase(true);
int rowsInserted = oxs.insertXML(xd);
System.out.println("MI C: ");
out.println("<success>TRUE</success>");
con.commit();
System.out.println("MI D: ");
catch(OracleXMLSQLException e){
System.out.println("OracleXMLSQLException");
e.printStackTrace();
catch(SQLException e){
System.out.println("SQLException");
e.printStackTrace();
catch(Exception e){
System.out.println("Exception");
e.printStackTrace();
Normal jdbc queries(rsEmailAlertQuery) are working properly.The problem is only with OracleXMLSave.
Any help would be greatfull.
Edited by: suryaraj on 29-May-2009 06:45Hi,
May be you can get the description of the error on the server log of the server running on ip:url
-Priyanka -
Java.io.IOException: Server returned HTTP response code: 502 for URL
Hi,
I am calling below method in ADF 11g Ver 11.1.2.3.0 . for creating report in our developed Form Report Apps.
below generated URL accessible in browser and showing pdf but runtime this URL is not opening automatically and throwng some error.
http://ittest:7779/reports/rwservlet?orientation=PORTRAIT&desformat=PDF&destype=cache&desname=RF07D10.pdf&server=repittest11&report_execution_mode=RUNTIME&P_DOCCOD=24&report_comm_mode=SYNCHRONOUS&P_COMCOD=5&report=H:\ami\RF07D10.rdf&userid=refmdba/refm11gtest@refm11g&P_DOCNO=945861&disposition=inline&P_DOCFYR=2013
public static void fileUrl(String fAddress, String localFileName, String destinationDir) {
System.out.println("\n mak fAddress = "+fAddress+"\n mak localFileName="+localFileName+"\n mak mak destinationDir = "+destinationDir);
OutputStream outStream = null;
URLConnection uCon = null;
//InputStream is = null;
InputStream is = null;
try {
URL url;
byte[] buf;
int ByteRead, ByteWritten = 0;
url = new URL(fAddress);
outStream = new BufferedOutputStream(new FileOutputStream(destinationDir + "\\" + localFileName));
System.out.println("outStream = "+outStream);
uCon = url.openConnection();
System.out.println("uCon = "+uCon);
is = uCon.getInputStream(); //Error Caught in this line
System.out.println("is = "+is);
buf = new byte[size];
while ((ByteRead = is.read(buf)) != -1) {
outStream.write(buf, 0, ByteRead);
ByteWritten += ByteRead;
System.out.println("Downloaded Successfully.");
System.out.println("File name:\"" + localFileName + "\"\nNo ofbytes :" + ByteWritten);
} catch (Exception e) {
System.out.println("Exception Caught");
e.printStackTrace();
} finally {
try {
is.close();
outStream.close();
} catch (IOException e) {
e.printStackTrace();
SOP for confirmation, in console all variables and parameter have value
fileName = refm11gtest@refm11g&P_DOCNO=945861&disposition=inline&P_DOCFYR=2013
mak fAddress = http://ittest:7779/reports/rwservlet?orientation=PORTRAIT&desformat=PDF&destype=cache&desname=RF07D10.pdf&server=repittest11&report_execution_mode=RUNTIME&P_DOCCOD=24&report_comm_mode=SYNCHRONOUS&P_COMCOD=5&report=H:\ami\RF07D10.rdf&userid=refmdba/refm11gtest@refm11g&P_DOCNO=945861&disposition=inline&P_DOCFYR=2013
mak localFileName=refm11gtest@refm11g&P_DOCNO=945861&disposition=inline&P_DOCFYR=2013
mak mak destinationDir = D://Resource
outStream = java.io.BufferedOutputStream@b8c77f
uCon = sun.net.www.protocol.http.HttpURLConnection:http://ittest:7779/reports/rwservlet?orientation=PORTRAIT&desformat=PDF&destype=cache&desname=RF07D10.pdf&server=repittest11&report_execution_mode=RUNTIME&P_DOCCOD=24&report_comm_mode=SYNCHRONOUS&P_COMCOD=5&report=H:\ami\RF07D10.rdf&userid=refmdba/refm11gtest@refm11g&P_DOCNO=945861&disposition=inline&P_DOCFYR=2013
Error Console
Exception Caught
java.io.IOException: Server returned HTTP response code: 502 for URL: http://ittest:7779/reports/rwservlet?orientation=PORTRAIT&desformat=PDF&destype=cache&desname=RF07D10.pdf&server=repittest11&report_execution_mode=RUNTIME&P_DOCCOD=24&report_comm_mode=SYNCHRONOUS&P_COMCOD=5&report=H:\ami\RF07D10.rdf&userid=refmdba/refm11gtest@refm11g&P_DOCNO=945861&disposition=inline&P_DOCFYR=2013
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
at amgdom.refm.view.managebean.authentication.UrIDownload.fileUrl(UrIDownload.java:34)
at amgdom.refm.view.managebean.authentication.UrIDownload.fileDownload(UrIDownload.java:64)
at amgdom.refm.view.managebean.collection.MakePayment2.callReport(MakePayment2.java:259)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(Unknown Source)
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:112)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:106)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:973)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:354)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
<ActionListenerImpl> <processAction> java.lang.NullPointerException
javax.faces.el.EvaluationException: java.lang.NullPointerException
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:112)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:106)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:973)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:354)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: java.lang.NullPointerException
at amgdom.refm.view.managebean.authentication.UrIDownload.fileUrl(UrIDownload.java:48)
at amgdom.refm.view.managebean.authentication.UrIDownload.fileDownload(UrIDownload.java:64)
at amgdom.refm.view.managebean.collection.MakePayment2.callReport(MakePayment2.java:259)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(Unknown Source)
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
... 54 more
<RichExceptionHandler> <_logUnhandledException> ADF_FACES-60098:Faces lifecycle receives unhandled exceptions in phase INVOKE_APPLICATION 5
javax.faces.FacesException: #{makePayment2.callReport}: java.lang.NullPointerException
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:118)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:112)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent.broadcast(ContextSwitchingComponent.java:134)
at oracle.adf.view.rich.component.fragment.UIXInclude.broadcast(UIXInclude.java:106)
at javax.faces.component.UIViewRoot.broadcastEvents(UIViewRoot.java:787)
at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1252)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._invokeApplication(LifecycleImpl.java:973)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl._executePhase(LifecycleImpl.java:354)
at oracle.adfinternal.view.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:202)
at javax.faces.webapp.FacesServlet.service(FacesServlet.java:508)
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:227)
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:125)
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:300)
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:26)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.model.servlet.ADFBindingFilter.doFilter(ADFBindingFilter.java:173)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adfinternal.view.faces.webapp.rich.RegistrationFilter.doFilter(RegistrationFilter.java:125)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at oracle.adfinternal.view.faces.activedata.AdsFilter.doFilter(AdsFilter.java:60)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl$FilterListChain.doFilter(TrinidadFilterImpl.java:468)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl._doFilterImpl(TrinidadFilterImpl.java:293)
at org.apache.myfaces.trinidadinternal.webapp.TrinidadFilterImpl.doFilter(TrinidadFilterImpl.java:199)
at org.apache.myfaces.trinidad.webapp.TrinidadFilter.doFilter(TrinidadFilter.java:92)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.adf.library.webapp.LibraryFilter.doFilter(LibraryFilter.java:180)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.security.jps.ee.http.JpsAbsFilter$1.run(JpsAbsFilter.java:119)
at java.security.AccessController.doPrivileged(Native Method)
at oracle.security.jps.util.JpsSubject.doAsPrivileged(JpsSubject.java:315)
at oracle.security.jps.ee.util.JpsPlatformUtil.runJaasMode(JpsPlatformUtil.java:442)
at oracle.security.jps.ee.http.JpsAbsFilter.runJaasMode(JpsAbsFilter.java:103)
at oracle.security.jps.ee.http.JpsAbsFilter.doFilter(JpsAbsFilter.java:171)
at oracle.security.jps.ee.http.JpsFilter.doFilter(JpsFilter.java:71)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at oracle.dms.servlet.DMSServletFilter.doFilter(DMSServletFilter.java:139)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.RequestEventsFilter.doFilter(RequestEventsFilter.java:27)
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:56)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3715)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3681)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2277)
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2183)
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1454)
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:209)
at weblogic.work.ExecuteThread.run(ExecuteThread.java:178)
Caused by: javax.faces.el.EvaluationException: java.lang.NullPointerException
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
... 53 more
Caused by: java.lang.NullPointerException
at amgdom.refm.view.managebean.authentication.UrIDownload.fileUrl(UrIDownload.java:48)
at amgdom.refm.view.managebean.authentication.UrIDownload.fileDownload(UrIDownload.java:64)
at amgdom.refm.view.managebean.collection.MakePayment2.callReport(MakePayment2.java:259)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at com.sun.el.parser.AstValue.invoke(Unknown Source)
at com.sun.el.MethodExpressionImpl.invoke(Unknown Source)
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:46)
... 54 more
<JUCtrlHierNodeBinding> <release> [3154] released: ROOT node binding:noCtrl_oracle_adfinternal_view_faces_model_binding_FacesCtrlHierNodeBinding_579, value:DummyVpartyDealDetVOIterator
<JUCtrlHierNodeBinding> <release> [3155] released: ROOT node binding:noCtrl_oracle_adfinternal_view_faces_model_binding_FacesCtrlHierNodeBinding_579, value:DummyVpartyDealDetVOIterator
<DCIteratorBinding> <releaseDataInternal> [3156] Releasing iterator binding:DummyVpartyDealDetVOIterator
<DCIteratorBinding> <releaseDataInternal> [3157] Releasing iterator binding:vcRowsIterator
<DCIteratorBinding> <releaseDataInternal> [3158] Releasing iterator binding:variableIterator
<JUCtrlHierNodeBinding> <release> [3159] released: ROOT node binding:noCtrl_oracle_adfinternal_view_faces_model_binding_FacesCtrlHierNodeBinding_581, value:CompanyAMIVOIterator
<JUCtrlHierNodeBinding> <release> [3160] released: ROOT node binding:noCtrl_oracle_adfinternal_view_faces_model_binding_FacesCtrlHierNodeBinding_581, value:CompanyAMIVOIterator
<DCIteratorBinding> <releaseDataInternal> [3161] Releasing iterator binding:CompanyAMIVOIterator
<DCUtil> <findSpelObject> [3162] DCUtil, returning:oracle.jbo.uicli.binding.JUFormBinding, for ptb1
<JUCtrlHierNodeBinding> <release> [3163] released: ROOT node binding:noCtrl_oracle_adfinternal_view_faces_model_binding_FacesCtrlHierNodeBinding_581, value:CompanyAMIVOIterator
<JUCtrlHierNodeBinding> <release> [3164] released: ROOT node binding:noCtrl_oracle_adfinternal_view_faces_model_binding_FacesCtrlHierNodeBinding_581, value:CompanyAMIVOIterator
<DCIteratorBinding> <releaseDataInternal> [3165] Releasing iterator binding:CompanyAMIVOIterator
<ADFLogger> <begin> Rollback transaction
<ApplicationModuleImpl> <resetState> [3166] Resetting AM=Root
<ApplicationPoolMessageHandler> <doPoolMessage> [3167] **** PoolMessage REQ DETACH LWS
<May 21, 2013 4:22:17 PM AST> <Error> <HTTP> <BEA-101017> <[ServletContext@20213623[app:REFMApp module:amificweb path:/amificweb spec-version:2.5], request: weblogic.servlet.internal.ServletRequestImpl@182b8[
POST /amificweb/faces/makePayment/makePayment_2?_adf.ctrl-state=spmhovpgy_24 HTTP/1.1
Connection: keep-alive
Content-Length: 316
Cache-Control: max-age=0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Origin: http://192.168.102.41:7101
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.22 (KHTML, like Gecko) Chrome/25.0.1364.172 Safari/537.22
Content-Type: application/x-www-form-urlencoded
Referer: http://192.168.102.41:7101/amificweb/faces/makePayment/makePayment_2?_adf.ctrl-state=spmhovpgy_24
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
Cookie: oracle.uix=0^^GMT+3:00; JSESSIONID=JTRBRb0FQQYDWJNvyL26fhj2MNPtyDwH05GtH2kDLLwqyBVLxPzD!1337581137
]] Root cause of ServletException.
javax.faces.el.EvaluationException: java.lang.NullPointerException
at org.apache.myfaces.trinidad.component.MethodExpressionMethodBinding.invoke(MethodExpressionMethodBinding.java:51)
at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:102)
at org.apache.myfaces.trinidad.component.UIXCommand.broadcast(UIXCommand.java:190)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent$1.run(ContextSwitchingComponent.java:130)
at oracle.adf.view.rich.component.fragment.ContextSwitchingComponent._processPhase(ContextSwitchingComponent.java:461)
Truncated. see log file for complete stacktrace
Caused By: java.lang.NullPointerException
at amgdom.refm.view.managebean.authentication.UrIDownload.fileUrl(UrIDownload.java:48)
at amgdom.refm.view.managebean.authentication.UrIDownload.fileDownload(UrIDownload.java:64)
at amgdom.refm.view.managebean.collection.MakePayment2.callReport(MakePayment2.java:259)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
Truncated. see log file for complete stacktrace
>
Maroofdvohra21 wrote:
Caused By: java.lang.NullPointerException
at amgdom.refm.view.managebean.authentication.UrIDownload.fileUrl(UrIDownload.java:48)
The file url is producing NullPointerException.Dear
method fileUrl() not have problem,
problem at line number 19.
1. public static void fileUrl(String fAddress, String localFileName, String destinationDir) {
2. System.out.println("\n mak fAddress = "+fAddress+"\n mak localFileName="+localFileName+"\n mak mak destinationDir = "+destinationDir);
3. OutputStream outStream = null;
4. URLConnection uCon = null;
5. //InputStream is = null;
6. InputStream is = null;
7. try {
8. URL url;
9. byte[] buf;
10. int ByteRead, ByteWritten = 0;
11. url = new URL(fAddress);
12. outStream = new BufferedOutputStream(new FileOutputStream(destinationDir + "\\" + localFileName));
13. System.out.println("outStream = "+outStream);
14. //Error Caught
15. uCon = url.openConnection();
16. System.out.println("uCon = "+uCon);
17. //---------------------------------
18. // is = uCon.getInputStream();
*19. is = uCon.getInputStream();*
20. System.out.println("is = "+is);
21. buf = new byte[size];
22. while ((ByteRead = is.read(buf)) != -1) {
a. outStream.write(buf, 0, ByteRead);
b. ByteWritten += ByteRead;
23. }
24. System.out.println("Downloaded Successfully.");
25. System.out.println("File name:\"" + localFileName + "\"\nNo ofbytes :" + ByteWritten);
26. } catch (Exception e) {
27. System.out.println("Exception Caught");
28. e.printStackTrace();
29. } finally {
30. try {
a. is.close();
b. outStream.close();
31. } catch (IOException e) {
a. e.printStackTrace();
32. }
33. }
34. }
Maroof
Edited by: Maroof Ahmad on May 22, 2013 9:19 AM -
I have this code for a long time and it always works:
URL url = new URL("http://www.infoamistades.net/load.do");
URLConnection urlConnection = null;
urlConnection = url.openConnection();
urlConnection.setRequestProperty("Content-Type","text/html; charset=utf-8");
urlConnection.setRequestProperty("Accept-Charset","utf-8");
BufferedReader bin = new BufferedReader(new InputStreamReader(urlConnection.getInputStream(),"utf-8"));
but....suddenly I always have the java.io.IOException: Server returned HTTP response code: 500 (?!?!?)
using this URL works properly
URL url = new URL("http://www.infoamistades.net/");
but now it doesn't works with URL url = new URL("http://www.infoamistades.net/load.do");
and putting thia addrees to the browser it works, of course..
no changes at the server, not firewalls.. (?!?!)
thanks,Hi,
Actually I am also having exactly same problem that you mentioned, I am new to the world of servlets. I could not get what you mean by "put variable in the request" Please tell me exactly what to do to solve this problem.
Someone please help......... -
How can a http response be delayed?
Hi,
I have a "simple" problem to solve but I am new to J2EE so I hope to find someone who has already faced with this problem.
I know a servlet can receive an http request from a client and prepare the response. The response will be sent as soon as the servlet returns. The same servlet serves the requests of many users, so if there are 100 users requesting for a servlet I guess the requests are queued and there will be a response outcoming the web-server for each request in the same order.
Please correct me if I say wrong things.
Now I would like to write a java code that receives the request but waits for a trigger event to send the response, without blocking other users.
I mean, a user sends a request, a servlet should forward the request to a thread (what else?) and exit without sending any response. The thread (I thought about a thread for each user) will wait for a trigger event and ONLY if the event happens the response will be sent to the requesting client.
In the meantime other users can send their requests and receive their response when their trigger events has happened.
1. Can J2EE technology allow me to do that?
2. How can I let the thread send the response to the right client?
3. Http packets do not contain the info about the client, how can I trigger the sending of the response?
I had a look to pushlet and comet but the problem I have seems to me different from let the server start a communication with a client. In my case the paradigm request-response is kept but the response is delayed. Of course the time-out should be increased (I have read that time out is settable in the client).
To be more clear I'm adding two examples:
1. one client (an applet) sends its request, the server receives the http packet and it will start a timer of 5 sec. Only when the timer expires the response will be sent. In the meantime other clients perform their requests and they all will be answered after 5 secs from their request (because there is a timer for each request).
2. the trigger is the number of requests received: if the server receives 10 requests from 10 clients then all the 10 clients will receive the response. If the server receives less of 10 requests in the time out period there will be issued a time-out error.
Please could you help me?
Thanks in advance.maxqua72 wrote:
Hi,
I have a "simple" problem to solve but I am new to J2EE so I hope to find someone who has already faced with this problem.
I know a servlet can receive an http request from a client and prepare the response. The response will be sent as soon as the servlet returns. Not exactly. The request is sent with the contents of the output stream are flushed to the client. This may be right away, or it may not be. This usually does happen before the 'servlet returns' but you have control of when that happens.
The same servlet serves the requests of many users, so if there are 100 users requesting for a servlet I guess the requests are queued and there will be a response outcoming the web-server for each request in the same order.Again, not really true. requests are handled in the order in which they are received, but that does not mean that the first in is the first out. It just means the first in will begin before the second in. The second in could very well finish before the first one.
Please correct me if I say wrong things.
Now I would like to write a java code that receives the request but waits for a trigger event to send the response, without blocking other users.
I mean, a user sends a request, a servlet should forward the request to a thread (what else?) and exit without sending any response. The thread (I thought about a thread for each user) will wait for a trigger event and ONLY if the event happens the response will be sent to the requesting client.
In the meantime other users can send their requests and receive their response when their trigger events has happened.Each request will have its own thread. There is no need to make your own. You could delay the response as long as you like without making your own thread.
This assumes you do not implement the 'SingleThreadModel' deprecated interface on your servlet.
>
1. Can J2EE technology allow me to do that?
2. How can I let the thread send the response to the right client?
3. Http packets do not contain the info about the client, how can I trigger the sending of the response?Yes, JEE can do that. Because each request has its own thread, you can do your delay right in the servlet's service method (doXXX). You would then have the same access to the request/response as always. Alternatively, you could pass the request/response to whatever method/object that will do your work.
Note that using a new thread for this will actually be a detriment, since that will allow the thread the servlet is called in to return, which will end the request cycle and destroy the response object. So you should do it in the same thread that your request is made in.
>
I had a look to pushlet and comet but the problem I have seems to me different from let the server start a communication with a client. In my case the paradigm request-response is kept but the response is delayed.This is actually the same thing as what pushlets do. Pushlets require the user to make an initial request, then the Pushlets hold on to the initial request's thread by never closing the response stream or returning from the service method. It lets Pushlets then continuously send data to the client. Your system would be simpler, you would receive the request, open the response stream, maybe send initial data to client, then delay. When the delay finishes send the rest of the content and close the response stream and let the request die.
Of course the time-out should be increased (I have read that time out is settable in the client).That is true, but is a nightmare if you expect your client base to be more than a few people whom you know. A better option would be to regularly send small bits of 'keep alive' packets so the client knows the page is still active (which may also help prevent the client from navigating away from your site because it would appear frozen). What you could do is send small bits of javascript that update a specific portion of the page (like a count of current request, or a countdown until activation... whatever seems appropriate). Or just send nonsense javascript that doesn't affect the client at all (but which doesn't break your page either).
To be more clear I'm adding two examples:
1. one client (an applet) sends its request, the server receives the http packet and it will start a timer of 5 sec. Only when the timer expires the response will be sent. In the meantime other clients perform their requests and they all will be answered after 5 secs from their request (because there is a timer for each request).No problem. Adding a Thread.sleep(5000) will do this nicely.
>
2. the trigger is the number of requests received: if the server receives 10 requests from 10 clients then all the 10 clients will receive the response. If the server receives less of 10 requests in the time out period there will be issued a time-out error.Again, possible, but you would need to device a means of locking and unlocking threads based on client count. Two quickie methods would be to keep a member variable count of current request. Each request would use synchronized blocks to first increment the count, then in a loop, check the count, wait if it is < 10, or end the synchronized block if it is >= 10.
public void doGet(...) {
int localCount = 0;
//Count this request, then recall how many total requests are already made
synchronized (countLock) {
this.count++;
localCount = this.count;
//Loop until this thread knows there are 10 requests
while (localCount <10) {
//wait for a while, and let other threads work
try { Thread.sleep(100); } catch (InterruptedException ie) { /* don't care */ }
//get an updated count of requests
synchronized (countLock) {
localcount = this.count;
} //end while
//do the rest of the work
//Remove this request from the count
synchronized(countLock) {
this.count--;
}A second, better approach would use a 'request registrar' which each request adds itself to. The registrar blocks each request on the condition that 10 requests come in, then releases them all. This would use the tools available in java.util.concurrent to work (java 5+). Untested example:
public class RequestRegistrar {
private final ReentrantLock requestLock = new ReentrantLock();
private final Condition requestCountMet = requestLock.newCondition();
private int count;
private static final int TARGET_COUNT = 10;
private static final RequestRegistrar instance = new RequestRegistrar();
public static RequestRegistrar getInstance() { return instance; }
private RequestRegistrar() { }
public void registerRequest() {
this.requestLock.lock();
try {
this.count++;
if (this.count < TARGET_COUNT) {
while (this.count < TARGET_COUNT) {
try {
this.requestCountMet.await();
} catch (InterruptedException ie) {
/* don't care, will just loop back and await again */
} //end loop of waiting
} else { //the target count has been met or exceeded
this.count = 0; //reset count
this.requestCountMet.signalAll();
} finally {
this.requestLock.unlock();
//Then your requests would all do:
public void doGet(...) {
RequestRegistrar.getInstance().registerRequest(); //waits for 10 requests to be registered
//The rest of your work
}Undoubtedly there is a lot of work to fix this up, but if you understand Locks and conditions it won't be hard (and if you don't perhaps now is a good time to learn...)
>
Please could you help me?
Thanks in advance. -
Can this class run fast than Hotspot ?
My case in Sun hotspot is almost 2 times fast than jRockit. It's very strange.
package com.telegram;
public class byteutils {
public final static byte[] bytea = { 48, 49, 50, 51, 52, 53, 54, 56, 57,
58, 65, 66, 67, 68, 69, 70 };
public byteutils() {
super();
* convert length = 2L letters Hexadecimal String to length = L bytes
* Examples: [01][23][45][67][89][AB][CD][EF]
public static byte[] convertBytes(String hexStr) {
byte[] a = null;
try {
a = hexStr.getBytes("ASCII");
} catch (java.io.UnsupportedEncodingException e) {
e.printStackTrace();
final int len = a.length / 2;
byte[] b = new byte[len];
int idx = 0;
int h = 0;
int l = 0;
for (int i = 0; i < len; i++) {
h = a[idx++];
l = a[idx++];
h = (h < 65) ? (h - 48) : (h - 55);
l = (l < 65) ? (l - 48) : (l - 55);
// if ((h < 0) || (l < 0)) return null;
b[i] = (byte) ((h << 4) | l);
a = null;
return b;
public static String convertHex(byte[] arr_b) {
if (arr_b == null)
return null;
final int len = arr_b.length;
byte[] byteArray = new byte[len * 2];
int idx = 0;
int h = 0;
int l = 0;
int v = 0;
for (int i = 0; i < len; i++) {
v = arr_b[i] & 0xff;
l = v & 0xf;
h = v >> 4;
byteArray[idx++] = bytea[h];
byteArray[idx++] = bytea[l];
String r = null;
try {
r = new String(byteArray, "ASCII");
} catch (java.io.UnsupportedEncodingException e) {
e.printStackTrace();
} finally {
byteArray = null;
return r;
public static void main(String[] argv) {
byte[] a = new byte[0x10000];
for (int c = 0; c < 0x10000; c++) {
a[c] = (byte) (c % 256);
String s = "";
int LOOP = 10000;
long l = System.currentTimeMillis();
for (int i = 0; i < LOOP; i++) {
s = convertHex(a);
a = convertBytes(s);
l = System.currentTimeMillis() - l;
double d = l / (double) LOOP;
System.out.println("" + d + "ms.");
}Thanks! Your code is essentially a microbenchmark testing the performance of sun.nio.cs.US_ASCII.Decoder.decodeLoop() and encodeLoop(), with ~35% and ~30% spent in those two methods respectively. I have verified the behavior (i.e. Sun is faster than JRockit). Due to the microbenchmark nature, it may not affect a larger running program, but it may merit a closer look regardless. I have forwarded to the JRockit perf team for analysis.
-- Henrik -
Java.io.IOException: Server returned HTTP response code: 405 for URL
I'm trying write to a file using a combination of CGI and Java. I am following this website:
http://www.webdeveloper.com/java/java_jj_read_write.html
However, when I try to write out to the file, I keep getting the error in the title: HTTP response code: 405 for URL: .....
I was wondering if anyone knew what this mean? I searched the forum and found a post from 2 years ago that was exactly the same problem I was having, only thing is that there were no responses to it. Hopefully I'll have a bit more luck.http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
-
Pipelined function running fast but making the sp slow when used in it.
i have a sp which is running slow because of (pipelined) function
but function it self is fast.
is there any remedy.
select uno.a, uno.b, uno.c, uno1.c from
abc a
left join
TABLE(udf_fn(a, 'h',b,c,d)) uno
ON a.a.a= uno.a
AND a.b= uno.b
AND a.c= uno.c
AND a.d= uno.d
left join
TABLE(udf_fn(a, 'j',b,c,d)) uno1
ON a.a.a= uno1.a
AND a.b= uno1.b
AND a.c= uno1.c
AND a.d= uno1.dyours sincerely
Edited by: 944768 on Apr 30, 2013 11:56 PM
Edited by: 944768 on May 1, 2013 2:01 AMHi,
Please read SQL and PL/SQL FAQ
If you have a performance issue have a look at SQL and PL/SQL FAQ
When you put some code or output please enclose it between two lines starting with {noformat}{noformat}
i.e.:
{noformat}{noformat}
SELECT ...
{noformat}{noformat}
After 331 messages you should know how to post questions. Your code is unformatted and you did not provide the source of function udf_fn. How do you pretend us to answer?
Regards.
Al -
Hi All,
I have a query which runs with in 4 mins in Toad and also report 6i. But when ran through applications takes 3 to 4 hrs to complete normal.This report fetches huge amount of data will that be the reason for poor performance?? I am unable to figure that out. I was able to avoid full table scan on the tables used. But still have the problem.
Any suggestions please.
Thank you in advance.
PrathimaIf you want to have a look at the query. This report gives a way to monitor the receipts entered for pay from receipt POs.
SELECT
hou.name "OPERATING_UNIT_NAME"
,glc.segment1 "UEC"
,glc.segment2 "DEPT"
,pov.vendor_name "VENDOR_NAME"
,msi.SEGMENT1 "ITEM_NUM"
,rcvs.receipt_num "RECEIPT_NUM"
,poh.segment1 "PO_NUMBER"
,pol.line_num "PO_LINE_NUM"
,por.RELEASE_NUM "RELEASE_NUMBER"
,poll.shipment_num "SHIPMENT_NUM"
,hrou.name "SHIP_TO_ORGANIZATION"
,trunc(rcv.transaction_date) "TRANSACTION_DATE"
,decode (transaction_type,'RECEIVE', 'ERS', 'RETURN TO VENDOR','RTS') "RECEIPT_TYPE"
,decode (rcv.transaction_type,'RECEIVE', 1, 'RETURN TO VENDOR', -1)* rcv.quantity "RECEIPT_QTY"
,rcv.po_unit_price "PO_UNIT_PRICE"
,decode (rcv.transaction_type,'RECEIVE', 1, 'RETURN TO VENDOR', -1)*rcv.quantity*po_unit_price "RECEIPT_AMOUNT"
,rcvs.packing_slip "PACKING_SLIP"
,poll.quantity "QUANTITY_ORDERED"
,poll.quantity_received "QUANTITY_RECEIVED"
,poll.quantity_accepted "QUANTITY_ACCEPTED"
,poll.quantity_rejected "QUANTITY_REJECTED"
,poll.quantity_billed "QUANTITY_BILLED"
,poll.quantity_cancelled "QUANTITY_CANCELLED"
,(poll.quantity_received - (poll.quantity - poll.quantity_cancelled)) "QUANTITY_OVER_RECEIVED"
,(poll.quantity_received - (poll.quantity - poll.quantity_cancelled))*po_unit_price "OVER_RECEIVED_AMOUNT"
,poh.currency_code "CURRENCY_CODE"
,perr.full_name "RECEIVER"
,perb.full_name "BUYER"
FROM
po.po_vendors pov
,po.po_headers_all poh
,po.po_lines_all pol
,po.po_line_locations_all poll
,po.po_distributions_all pod
,po.po_releases_all por
,hr.hr_all_organization_units hou
,hr.hr_all_organization_units hrou
,po.rcv_transactions rcv
,po.rcv_shipment_headers rcvs
,gl.gl_code_combinations glc
,hr.per_all_people_f perr
,hr.per_all_people_f perb
,inv.mtl_system_items_b msi
where
poh.org_id = hou.organization_id
and pov.vendor_id (+) = poh.vendor_id
and pod.po_header_id = poh.po_header_id
and pod.po_line_id = pol.po_line_id
and pod.line_location_id = poll.line_location_id
and poll.po_header_id = poh.po_header_id
and poll.po_line_id = pol.po_line_id
and pol.po_header_id = poh.po_header_id
and poh.pay_on_code like 'RECEIPT'
and pod.po_header_id = rcv.po_header_id
and pod.po_line_id = rcv.po_line_id
and pod.po_release_id = rcv.po_release_id
and pod.po_release_id = por.po_release_id
and por.po_header_id = poh.po_header_id
and hrou.organization_id = poll.ship_to_organization_id
and pod.line_location_id = rcv.po_line_location_id
and pod.po_distribution_id = rcv.po_distribution_id
and rcv.transaction_type in ('RECEIVE','RETURN TO VENDOR')
and rcv.shipment_header_id = rcvs.shipment_header_id (+)
and pod.code_combination_id = glc.code_combination_id
and rcvs.employee_id = perr.person_id
and por.agent_id = perb.person_id (+)
and perr.person_type_id = 1
and perb.person_type_id = 1
and msi.organization_id = 1 --poll.ship_to_organization_id
and msi.inventory_item_id = pol.item_id
and poh.type_lookup_code = 'BLANKET'
and hou.organization_id = nvl(:p_operating_unit,hou.organization_id)
and trunc(rcv.transaction_date) between :p_transaction_date_from and :p_transaction_date_to
Message was edited by:
Prathima -
Java '.class' expected, simple but im not seeing it
I'm working on a project right now and need to list 3 parellel arrays. This is what my compiler error looks like.
'.class' expected ')' expected
It's really bugging be, so here are the two methods.
This is the code that my info is being sent to. This method is in a class named ListPets
public void listPets(String[] name, double[] price, int[] quanity)
for(int i = 0; i<name.length; i++)
output+="\n"+name[i]+" "+price[i]+" "+quanity;
this is what is being sent to it
This code is in a class called MainGui
I also have this little bit at the top.
ListPets panList = new ListPets();
public void actionPerformed(ActionEvent ae)
panList.listPets(petname[], petprice[], petquanity[]);
}I feel like im over looking somthing, but i cant find it. Any help on this would be nice, thanks,panList.listPets(petname[], petprice[] , petquanity[]);You are trying to call a method in the line of code above. So you should only include the variable names, like thispanList.listPets(petname, petprice, petquanity);Some feedback on your design: It looks like you have (at least) 3 arrays whose contents relate to each other. That is, petname[2] is a pet type's name, petprice[2] is the same pet type's price and petquantity[2] is the same pet type's quantity. In Java, you should not use "parallel arrays" to associate the contents of arrays. Instead, you should have a class - that's the whole idea of object oriented programming.
-
Can anybody out there tell me how to update a MacBook with OS 10.5.4, to at least OS 10.6.6 ? When trying to update from the
Apple menu, it stops when configuring to install. I´v let it run overnight several times, no go. Help me !Start by checking if your macBook can run Snow Leopard:
Requirements for OS X 10.6 'Snow Leopard'
http://support.apple.com/kb/SP575
(NB: PowerPC applications can still be run in Snow Leopard using Rosetta, but they will not work in later versions of OS X.)
The OS 10.6 Snow Leopard install DVD is available for $19.99 from the Apple Store:
http://store.apple.com/us/product/MC573/mac-os-x-106-snow-leopard
and in the UK:
http://store.apple.com/uk/product/MC573/mac-os-x-106-snow-leopard
When you have installed it, run Software Update to download and install the latest updates for Snow Leopard to bring it up to 10.6.8, or download the combo update from here:
http://support.apple.com/kb/DL1399
Check via Software Update whether any further updates are required, particularly to iTunes (you will need the latest version in order to synch with mobile devices). -
Binding a JavaFX variable to a Java class instance variable
Hi,
I am pretty new to JavaFX but have been developing in Java for many years. I am trying to develop a JavaFX webservice client. What I am doing is creating a basic scene that displays the data values that I am polling with a Java class that extends Thread. The Java class is reading temperature and voltage from a remote server and storing the response in an instance variable. I would like to bind a JavaFx variable to the Java class instance variable so that I can display the values whenever they change.
var conn: WebserviceConnection; // Java class that extends Thread
var response: WebserviceResponse;
try {
conn = new WebserviceConnection("some_url");
conn.start();
Thread.sleep(10000);
} catch (e:Exception) {
e.printStackTrace();
def bindTemp = bind conn.getResponse().getTemperature();
def bindVolt = bind conn.getResponse().getVoltage();
The WebserviceConnection class is opening a socket connection and reading some data in a separate thread. A regular socket connection is used because the server is not using HTTP.
When I run the application, the bindTemp and bindVolt are not updated whenever new data values are received.
Am I missing something with how bind works? Can I do what I want to do with 'bind'. I basically want to run a separate thread to retrieve data and want my UI to be updated when the data changes.
Is there a better way to do this than the way I am trying to do it?
Thanks for any help in advance.
-RichardHi,
If you don't want to constantly poll for value change, you can use the observer design pattern, but you need to modify the classes that serve the values to javafx.
Heres a simple example:
The Thread which updates a value in every second:
// TimeServer.java
public class TimeServer extends Thread {
private boolean interrupted = false;
public ValueObject valueObject = new ValueObject();
@Override
public void run() {
while (!interrupted) {
try {
valueObject.setValue(Long.toString(System.currentTimeMillis()));
sleep(1000);
} catch (InterruptedException ex) {
interrupted = true;
}The ValueObject class which contains the values we want to bind in javafx:
// ValueObject.java
import java.util.Observable;
public class ValueObject extends Observable {
private String value;
public String getValue() {
return this.value;
public void setValue(String value) {
this.value = value;
fireNotify();
private void fireNotify() {
setChanged();
notifyObservers();
}We also need an adapter class in JFX so we can use bind:
// ValueObjectAdapter.fx
import java.util.Observer;
import java.util.Observable;
public class ValueObjectAdapter extends Observer {
public-read var value : String;
public var valueObject : ValueObject
on replace { valueObject.addObserver(this)}
override function update(observable: Observable, arg: Object) {
// We need to run every code in the JFX EDT
// do not change if the update method can be called outside the Event Dispatch Thread!
FX.deferAction(
function(): Void {
value = valueObject.getValue();
}And finally the main JFX code which displays the canging value:
// Main.fx
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.text.Text;
import javafx.scene.text.Font;
import threadbindfx.TimeServer;
var timeServer : TimeServer;
var valueObjectAdapter : ValueObjectAdapter = new ValueObjectAdapter();
timeServer = new TimeServer();
valueObjectAdapter.valueObject = timeServer.valueObject;
timeServer.start();
Stage {
title: "Time Application"
width: 250
height: 80
scene: Scene {
content: Text {
font : Font {
size : 24
x : 10, y : 30
content: bind valueObjectAdapter.value;
}This approach uses less cpu time than constant polling, and changes aren't dependent on the polling interval.
However this cannot be applied to code which you cannot change obviously.
I hope this helps.
Maybe you are looking for
-
Help Me Understand: Readabilty of Text in Images
I make a webcomic (CarpeChaos.com for examples), so I produce a lot of images with a fairly extensive amount of text in them. I want to make sure the fonts in those images are as readable as possible. My experience on this topic is just someone who h
-
Can I stream photos to a PC from my Mac using Photo Stream on Mac?
Hi, I would like to transfer photos from my Mac to a PC. The photos are not yet on my Mac. I will put them on there after I activate Photo Stream on my Macbook. Is it possible to stream photos from my Mac to a PC if I have Photo Stream activated on m
-
hi everyone, it seems Photoshop's eyedropper or CMS has a problem. I have attached a sample .psd file so that everyone can reproduce the error. Just open it and switch Layer1's blending mode from Screen to Linear Dodge. You will notice that as a resu
-
Segmentation fault when calling gpctr function from matlab mex file
I am trying to write a simple mex file for square wave generation using counter1 of PCI-6035E. I am using matlab's native compiler to compile and link with the nidaq32 library, ver.6.9.3, with no errors. When the mex function is called from a matlab
-
Droid x2 phone dial pad does not respond to touch on call
When on a call and asked to input numbers even to get to voicemail phone freezes and will not accept certain numbers like 1 (but it may take an 8) or screen goes black or both. Cannot get my voicemail from this phone. Can call in to my cellphone numb