Re: WebMacro.properties & NullPointerException

Keats Kirsch <[email protected]> Sat, 25 Feb 2006 16:38:51 -0500
Newsgroups gmane.comp.java.webmacro.user
Message-ID <[email protected]>
The ConcurrentHashMap is part of the concurrent.jar which is in the /lib 
directory of the WM distro.  It is a set of classes for improving 
multithreaded programming in Java, which has been incorporated into JDK 
1.5. 

Keats

paul wrote:

> hi viju -
>
> i've attached a class file that loads the webmacro.properties from a 
> specific location. this however in not extending the WMServlet but 
> initializing webmacro independently. also for some reason this only 
> works with 1.1 and not 2.0...
>
> actually this is my question... when i initialize wm now with 2.0 i 
> get a NoClassDefFoundError... what's up with this class in 2.0 and why 
> do i need it in addition to the webmacro.jar?
>
> EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap
>
> cheers
> paul
>
>
> Lane Sharman wrote:
>
>> place the wm property file in the root of the classes/ folder in your 
>> web app.
>>
>> -Lane
>>
>>
>>  
>> --- viju <[email protected]> wrote:
>>  
>> *From:* viju <[email protected]>
>> *Date:* Thu, 23 Feb 2006 06:39:44 -0800 (PST)
>> *To:* [email protected]
>> *Subject:* [WebMacro-user] WebMacro.properties & NullPointerException
>>
>> Hi,
>>  
>> I'm facing some issue with webmacro based webapp deployed in tomcat 
>> 5.0.0.28. When ever try loading my welcome page from servlet I get 
>> the following excpetion
>>
>> java.lang.NullPointerException   
>> org.webmacro.servlet.WMServlet.doPost(WMServlet.java:230)   
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:709)   
>> javax.servlet.http.HttpServlet.service(HttpServlet.java:802)   
>> sun.reflect.GeneratedMethodAccessor99.invoke(Unknown Source)   
>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)   
>> java.lang.reflect.Method.invoke(Method.java:324)   
>> org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:239)   
>> java.security.AccessController.doPrivileged(Native Method)   
>> javax.security.auth.Subject.doAsPrivileged(Subject.java:500)   
>> org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:268)   
>> org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:157)  
>>
>> < PRE>The tomcat log says the WebMacro.properties file must be 
>> classpath. But I have copied this file into
>>
>> tomcat/shared/lib folder. I think the Classloader for the web 
>> application should find this property file
>> under this folder.
>> So can somebody help understand what could be the issue here?
>>
>>  
>>
>> thanks in advance
>>
>> Vijayendra
>> -------------------------------------------------------------------------------- 
>>
>> Relax. Yahoo! Mail virus scanning 
>> <http://us.rd.yahoo.com/mail_us/taglines/virusall/*http://communications.yahoo.com/features.php?page=221> 
>> helps detect nasty 
>> viruses!------------------------------------------------------- This 
>> SF.Net email is sponsored by xPML, a groundbreaking scripting 
>> language that extends applications into web and mobile media. Attend 
>> the live webcast and join the prime developer group breaking into 
>> this new coding territory! 
>> http://sel.as-us.falkag.net/sel?cmd=k&kid0944&bid$1720&dat1642 
>> _______________________________________________ Webmacro-user mailing 
>> list [email protected] 
>> https://lists.sourceforge.net/lists/listinfo/webmacro-user
>
>
> ------------------------------------------------------------------------
>
>
>   HTTP Status 500 -
>
> ------------------------------------------------------------------------
>
> *type* Exception report
>
> *message*
>
> *description* _The server encountered an internal error () that 
> prevented it from fulfilling this request._
>
> *exception*
>
>javax.servlet.ServletException: Servlet execution threw an exception
>  
>
> *root cause*
>
>java.lang.NoClassDefFoundError: EDU/oswego/cs/dl/util/concurrent/ConcurrentHashMap
>	org.webmacro.Broker.<init>(Broker.java:86)
>	org.webmacro.Broker.<init>(Broker.java:156)
>	org.webmacro.Broker.getBroker(Broker.java:502)
>	org.webmacro.WM.<init>(WM.java:89)
>	com.wmx.main.Controller.doGet(Controller.java:24)
>	javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
>	javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
>  
>
> *note* _The full stack trace of the root cause is available in the 
> Apache Tomcat/5.0.28 logs._
>
> ------------------------------------------------------------------------
>
>
>       Apache Tomcat/5.0.28
>
>------------------------------------------------------------------------
>
>
>package com.wmx.main;
>
>/**
> * @author psenescu
> * 
> */
>
>import java.io.IOException;
>
>import javax.servlet.ServletException;
>import javax.servlet.http.HttpServlet;
>import javax.servlet.http.HttpServletRequest;
>import javax.servlet.http.HttpServletResponse;
>
>import org.webmacro.Context;
>import org.webmacro.WM;
>import org.webmacro.WebMacro;
>
>public class Controller extends HttpServlet {
>
>	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
>		try {
>			WebMacro wm = new WM(getServletContext().getRealPath("/") + "/WEB-INF/webmacro.properties");
>			Context ctx = wm.getWebContext(request, response);
>			wm.writeTemplate("index.tem", response.getOutputStream(), ctx);
>		} catch (Exception e) {
>			response.sendError(500, e.getMessage());
>		}
>	}
>
>	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
>		doGet(request, response);
>	}
>}
>  
>




-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642