struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Søren Blidorf <so...@nolas.dk>
Subject SV: PersistenceFacade
Date Wed, 26 May 2010 13:44:40 GMT
Of course. Here it comes

75203 [http-80-Processor24] ERROR
org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/hb].[jsp]  -
Servlet.service() for servlet jsp threw exception
java.lang.NullPointerException
	at
nc.persistence.PersistenceFacade.closeConnection(PersistenceFacade.java:69)
	at
nc.actions.secure.GetUserNameAction.execute(GetUserNameAction.java:66)
	at
org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAction
.java:58)
	at
org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractExecu
teAction.java:67)
	at
org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommandBase
.java:51)
	at
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
	at
org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.java:30
5)
	at
org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
	at
org.apache.struts.chain.ComposableRequestProcessor.process(ComposableRequest
Processor.java:283)
	at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
	at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:449)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:672)
	at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch
er.java:574)
	at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher
.java:499)
	at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:9
65)
	at
org.apache.jsp.includes.welcome_jsp._jspService(welcome_jsp.java:42)
	at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
31)
	at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:672)
	at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch
er.java:574)
	at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher
.java:499)
	at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:9
65)
	at
org.apache.jsp.includes.header_jsp._jspService(header_jsp.java:62)
	at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
31)
	at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:672)
	at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch
er.java:574)
	at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher
.java:499)
	at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:9
65)
	at
org.apache.jsp.secure.errorpage_jsp._jspService(errorpage_jsp.java:86)
	at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
31)
	at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.
java:672)
	at
org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatch
er.java:574)
	at
org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher
.java:499)
	at
org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:9
65)
	at
org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.java:600)
	at
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextI
mpl.java:803)
	at
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:774)
	at org.apache.jsp.secure.index_jsp._jspService(index_jsp.java:107)
	at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
31)
	at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:321)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:257)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:252)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:173)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:204)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:178)
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:524)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126
)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105
)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:107)
	at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
	at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
	at
org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processC
onnection(Http11BaseProtocol.java:664)
	at
org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.jav
a:527)
	at
org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWo
rkerThread.java:80)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.jav
a:684)
	at java.lang.Thread.run(Unknown Source)

-----Oprindelig meddelelse-----
Fra: chris@chrismiles.org [mailto:chris@chrismiles.org] 
Sendt: 26. maj 2010 15:40
Til: Struts Users Mailing List
Emne: Re: PersistenceFacade

Hi,

You would need to post your strack trace and where the problem happens.

Chris

> Hi.
>
>
>
> I have used the following code with struts 1.2x and it works just fine.
> Now
> I have upgraded to Struts 1.3.10.
>
>
>
> Now I get the following error when I try to login to my Struts app.
>
>
>
> Can anybody point me in the right direction.
>
>
>
> Soren, DK
>
>
>
> The Code:
>
>
>
> package nc.persistence;
>
>
>
> import java.sql.Connection;
>
> import java.sql.SQLException;
>
> import javax.servlet.http.HttpServlet;
>
> import java.sql.DriverManager;
>
>
>
> public class PersistenceFacade {
>
>
>
>   //----------- fields ---------//
>
>
>
>                       public static final String CONNECTION_DRIVER =
> "org.gjt.mm.mysql.Driver";
>
>                       public static final String CONNECTION_USER   =
> "username";
>
>                       public static final String CONNECTION_PASS   =
> "password";
>
>                       public static final String CONNECTION_URL    =
> "url";
>
>
>
>                       static {
>
>     try {
>
>       Class.forName(CONNECTION_DRIVER);
>
>     } catch (ClassNotFoundException ex) {
>
>
> ex.printStackTrace();
>
>     }
>
>                       }
>
>
>
>                       private String connectionUrl  = null;
>
>                       private String connectionUser = null;
>
>                       private String connectionPass = null;
>
>
>
>
>
>
>
>                       //------------ constructors -----------//
>
>
>
>                       //public PersistenceFacade() {}
>
>
>
>                       public PersistenceFacade(HttpServlet servlet) {
>
>                                             connectionUser =
> servlet.getInitParameter(CONNECTION_USER);
>
>                                             connectionPass =
> servlet.getInitParameter(CONNECTION_PASS);
>
>                                             connectionUrl  =
> servlet.getInitParameter(CONNECTION_URL);
>
>                       }
>
>
>
>                       //------------- public methods -----------//
>
>
>
>                       public Connection getConnection() throws
> SQLException
> {
>
>                                             if(connectionUser == null) {
>
>                                                                  throw new
> SQLException("Missing parameter "+CONNECTION_USER);
>
>                                             } else if(connectionPass ==
> null) {
>
>                                                                  throw new
> SQLException("Missing parameter "+CONNECTION_PASS);
>
>                                             } else if(connectionUrl ==
> null)
> {
>
>                                                                  throw new
> SQLException("Missing parameter "+CONNECTION_URL);
>
>                                             }
>
>                                             return
> DriverManager.getConnection(
>
>
> connectionUrl,
>
>
> connectionUser,
>
>
> connectionPass
>
>                                             );
>
>                       }
>
>
>
>                       public void closeConnection(Connection conn) {
>
>     try {
>
>       if(!conn.isClosed()) {
>
>         conn.close();
>
>       }
>
>     } catch (SQLException ex) {
>
>
> ex.printStackTrace();
>
>     }
>
>                       }
>
>
>
>                       //------------ private methods ----------//
>
> }
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message