473,721 Members | 2,254 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 1438

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

Similar topics

1
3108
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
13519
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
1578
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
1646
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
2490
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
2277
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
3191
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
7654
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
17544
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
8840
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
8730
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9064
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...
1
6669
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4484
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2130
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.