J2EE Troubleshooting Example

zhaozj2021-02-16  123

Best Story I

System.out.println ("Total Memory IS:" Java.lang.Runtime.Getruntime (). TotalMemory () / 1024); System.out.Println ("Free Memory IS:" java.lang.Runtime.Getruntime () .freememory () / 1024); One day, a customer wants to find East Soft Trouble, saying that our software is not easy to use, the total crash. WebLogic error prompts seem to be a memory allocation request failed. - Dongping's application system moves from the R & D environment to the use environment, with a point in mind, and the Tomcat on the PC cannot be able to compare with the WebLogic on the server. The supervisory company hits the door, I will accept this case with a Java Tianshi. (Java Tianshi is insight into the technical master of Java myelology, not mastering Java command syntax, skilled programmer usage programmer, not coding, the following is the same.) Development main force came over to build a demo environment, we tested it, There is no equivalent error. The operating system is a different UNIX type, so the database is also different versions. Other places are the same. Tianshi uses java.lang.Runtime.Getruntime (). TotalMemory () and FreeMemory () function gets the actual allocation amount and usage of JVM, sent to the front to measure, discovery although WebLogic Server specifies large memory parameters, When actually run, JVM does not get so much memory. I have found the problem now, it is WebLogic without a patch! At the end of the case, we inform the front line to ask for the latest patch of WebLogic and UNIX OS, now the east is soft. Best Story II

System.out.println ("THE CALLER IS" Sun.Reflect.Reflection.getCallerClass (0)); System.out.Println ("The Caller IS" Sun.Reflect.Reflection.getCallerClass (1)); System. Out.println ("THE CALLER IS" Sun.Reflect.Reflection.getCallerclass (2)); // Foot. This is our own story, after the release, everything is as usual, once, suddenly discovered that the database connection pool behavior is abnormal, and no new connections cannot be properly allocated. I used to do pressure testing, and I didn't miss it once? ! In order to find out, we want to know that those programs have visited the public database access bean. There are too many places where the call is called, can only be added in the bean to implement the caller's report, what code is used? We have issued a question in the water mother smth.org, with a valuable answer in half an hour, remind us to use Sun.Reflect.Reflection.getCallerClass (int 1), parameter casual, 0, 1, 2, 3 can. We tried, and it can be reported, 0 is getcallerclass itself, 1 is bean itself, 2 should be a bean call party, 3 unstable. This function seems to report all the call layers accurately. For us, you can have 2 easy to use. We still did not find mistakes on the program, and Vaja used a possibility that there was a problem with the code in the evening. Finally, we turn on the robust detection switch of WebLogic connection pool, and the error is excluded. Best Story III then lasts a story, we call a system, this time the program of Kevin's Struts framework failed, and cannot be used on WebLogic. Read the ApplicationResources.properties file failed, we have changed various possibilities in the ApplicationResources.properties file, can't. We use the struts example and deployment is not successful. We have changed a server, and the example deployment was successful, while the business program deployed still errors. Change the program, Kevin has changed several times, no effect. We can determine that the WebLogic version has an impact on the application system. Kevin and the Islands madman compared WebLogic versions and found that the system that cannot deploy the Struts example is at all, there is no patch. The patch is also SP2. Install SP4? In Dalian's Net tube did not give us FTP privileges, after three days, in Shenyang, I got SP4 from Java Tianshi, and I went back to fix the problem. A little experience: debugging issues, solving problems, the key lies in analysis, not yet coding fast. There is a knowledge of J2SDK, JSP, servlet, or is not enough. To understand the mechanism of system operation, try to decompose errors, positioning errors, narrowing error range, and can also exclude some possibilities, form some A preliminary conclusion that helps debugging. This is the basic idea of ​​Trouble Shooting.

转载请注明原文地址:https://www.9cbs.com/read-13568.html

New Post(0)