473,698 Members | 2,213 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

JSP + Velocity + Resin........ java.lang.NullP ointerException

4 New Member
Hi.....

We are using velocity1.4 to implement templating in our system. The system is running fine since deploy. Recently, there is a serious problem that causing the web panel down. We did setup multiple host in resin to point to different panel. When the error happen, only the host having the problem down but others are ok.

Host Setting in resin.conf
Expand|Select|Wrap|Line Numbers
  1.  
  2. <host id="api.abc.com" root-directory="/www/sw/api">
  3.       <web-app id="/" document-directory="/www/sw/api">
  4.         <servlet-mapping url-pattern="/servlet/*" servlet-name="invoker"/>
  5.       </web-app>
  6.  </host>
  7.  
From the error message in stdout.log, we found the java null pointer throw from velocity. The coding area is somewhere like below:

Expand|Select|Wrap|Line Numbers
  1. public int doEndTag() throws JspException {
  2.         try {
  3.             logger.info("Velocity File Resource Loaded:"+Velocity.FILE_RESOURCE_LOADER_PATH);
  4.  
  5.             VelocityContext myVelocityContext = null;
  6.             Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH, velpath);
  7.             Velocity.init();
  8.             if (ctx == null) {
  9.                 myVelocityContext = new VelocityContext();
  10.             }
  11.             else {
  12.                 myVelocityContext = ctx;
  13.             }
  14.  
  15.             Template template = null;
  16.             template = Velocity.getTemplate(veltemplate, "UTF-8");
  17.             StringWriter myStringWriter = new StringWriter();
  18.  
  19.             template.merge(myVelocityContext, myStringWriter);
  20.             pageContext.getOut().print(myStringWriter);
  21.  
  22.             return EVAL_PAGE;
  23.         }
  24.         catch (Exception e) {
  25.             e.printStackTrace();
  26.  
  27.             throw new JspException("Exception; TEMPLATE_CLASSPATH; exception="
  28.                     + e.getMessage());
  29.         }
  30.     }
  31.  
We are sure that the Velocity.FILE_R ESOURCE_LOADER_ PATH, velpath, and veltemplate are always holding correct value. But, just don't know why it throwing null pointer. Until now, we still can't find out the PATTERN to simulate the problem. The error might happen any time, after server running 3 days, 4 days.... anytime(even not peak hour) then suddenly throw error. Now, we still dont know what is the root cause.... totally not idea.....

Please help...
Aug 2 '07 #1
0 1436

Sign in to post your reply or Sign up for a free account.

Similar topics

1
3107
by: Jens Mueller | last post by:
Hi there, this is a Java-XML Question, so I am not sure whether this is the right place, haven't found anything better .... I try to convert a Java object to XML via SAX and let the FOP Transformer convert that via XSLT to valid XSL-FO. So I define a SAXReader which fires the SAX Events for the Java Object. This works fine and the Transformation to PDF is ok. However, I have one object which contains an XHTML String and the tags
2
13517
by: Tim Murray | last post by:
First of all, I don't know much about Java, even its naming and version numbering nomenclature, and second, if there is a better group to ask this in, please let me know. System is Mac with 10.4.4. I have Java 1.3.1 and 1.4.2 plug-ins, and J2SE 5.0 (1.5.0) installed. The Java preferences application lets me choose J2SE 5 or 1.4.2 to run applets via a browser. The problem happens in both settings. The problem is that we have a...
0
1573
by: gezkk | last post by:
hi, i m using http proxy service to get proxy and host to applet, its working fine with jdk1.5 but getting java.lang.NullPointerException in jdk1.6 And the following is mseeage contains java console java.lang.NullPointerException at com.atonesoftware.web.applet.transfer.client.http.HTTPTransfer.autoDetectProxy(HTTPTransfer.java:326)
0
1645
by: ycinar | last post by:
hey all, i am working on a Java project using JBuilder.. when i build my code its fine, but when comes to run, it doesnt run and displays the following logs.. i think there is JDK conflict.. actually when i build it, it creates a jar file which is totally fine (i can confirm that because i use that jar file in another project) any idea on how to get around this? maybe i could try to run it from the command line, but dont know how to run...
1
2472
by: ketand1 | last post by:
import java.awt.*; import java.awt.event.*; import java.io.*; import java.util.*; import java.sql.*; import java.lang.*; class DbAwt extends Frame implements ActionListener { private TextField t1, t2, t3;
2
2275
by: sokeefe | last post by:
I am trying to edit the GUI of a project in Netbeans. In particular, I am trying to add new JButtons. I get a NullPointerException when I try to add an Event to any given JButton (even ones that already exist) in my application using the Design Editor. I go about this by right-clicking on the JButton in the design editor, navigating to Events -> Action -> actionPerformed. The auto-generated code appears for a brief moment before it...
1
3189
by: sokeefe | last post by:
I am trying to edit the GUI of a project in Netbeans. In particular, I am trying to add new JButtons. I get a NullPointerException when I try to add an Event to any given JButton (even ones that already exist) in my application using the Design Editor. I go about this by right-clicking on the JButton in the design editor, navigating to Events -> Action -> actionPerformed. The auto-generated code appears for a brief moment before it...
3
7651
by: ohadr | last post by:
hi, i get Exception in thread "main" java.lang.NullPointerException when i run my application. the exact error is: "Exception in thread "main" java.lang.NullPointerException at sortmergejoin.MergeJoin.Field(MergeJoin.java:204) at sortmergejoin.MergeJoin.SMJoin(MergeJoin.java:84) at sortmergejoin.MergeJoin.<init>(MergeJoin.java:34) at sortmergejoin.Main.main(Main.java:24) Java Result: 1"
1
17543
by: r035198x | last post by:
This exception occurs often enough in practice to warrant its own article. It is a very silly exception to get because it's one of the easiest exceptions to avoid in programming. Yet we've all got it before, lending proof to Einstein's statement: “Only two things are infinite, the universe and human stupidity ...”. Main Cause Dereferencing null. This is by far the more common cause of getting the exception. Reference types in both...
0
8673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9156
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8892
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8860
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7716
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5860
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4614
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2327
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.