You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ronald Klop <ro...@klop.yi.org> on 2002/09/04 02:25:41 UTC

NullPointerException in JDBCStore

Hello,

I get a NullPointerException in org.apache.catalina.session.JDBCStore. 
(Tomcat 4.0.4 and 4.1.9)
I think it can be solved with the following patch.
Is there a possibility for this to be committed?


--- JDBCStore-old.java  Wed Sep  4 02:13:53 2002
+++ JDBCStore.java      Wed Sep  4 02:18:12 2002
@@ -759,37 +759,43 @@
              }

              try {
-                preparedSizeSql.close();
+                if (preparedSizeSql != null)
+                    preparedSizeSql.close();
              } catch (SQLException e) {
                  ;
              }

              try {
-                preparedKeysSql.close();
+                if (preparedKeysSql != null)
+                    preparedKeysSql.close();
              } catch (SQLException e) {
                  ;
              }

              try {
-                preparedSaveSql.close();
+                if (preparedSaveSql != null)
+                    preparedSaveSql.close();
              } catch (SQLException e) {
                  ;
              }

              try {
-                preparedClearSql.close();
+                if (preparedClearSql != null)
+                    preparedClearSql.close();
              } catch (SQLException e) {
                  ;
              }

              try {
-                preparedRemoveSql.close();
+                if (preparedRemoveSql != null)
+                    preparedRemoveSql.close();
              } catch (SQLException e) {
                  ;
              }

              try {
-                preparedLoadSql.close();
+                if (preparedLoadSql != null)
+                    preparedLoadSql.close();
              } catch (SQLException e) {
                  ;
              }


-- 
  Ronald Klop
  Amsterdam, The Netherlands


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Get an InitialContext w/o using a in server.xml

Posted by garrett smith <ja...@yahoo.com>.
I want to set up connection pooling as described in the Tomcat how-to. Is it
possible to get an InitialContext without using server.xml? I can use web.xml
or .properties files and I can put jar files in my WEB-INF/lib directory. I am
using a shared instance of Tomcat with Manager. AFIK, there's no way for me to
add a Context through manager. 

Regardless of that, it should be possible, and I think that it is possible to
get an initial context w/o using a Context in server.xml.

I am willing to study whatever material you may give me. Please, don't mislead
me with unrelated info and advice. Which class should I use for an
InitialContextFactory?

Here's what I have:

env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");

But that does not work properly. Instead of
"com.sun.jndi.fscontext.RefFSContextFactory", I should use
_______________________,
which can be found at ___________________________. Additional info, incl
resources, jarfiles, and/or javadoc can be found ___________________.

It sounds silly the way I asked, but you should know exactly what I am looking
for.


Garrett

=====
http://dhtmlkitchen.com/

__________________________________________________
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
http://finance.yahoo.com

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: NullPointerException in JDBCStore

Posted by Andrew Conrad <an...@attbi.com>.
Your best bet is to create a bug report, and post the patch.

- Andrew

> -----Original Message-----
> From: Ronald Klop [mailto:ronald@klop.yi.org] 
> Sent: Tuesday, September 03, 2002 8:26 PM
> To: tomcat-user@jakarta.apache.org
> Subject: NullPointerException in JDBCStore
> 
> 
> Hello,
> 
> I get a NullPointerException in 
> org.apache.catalina.session.JDBCStore. 
> (Tomcat 4.0.4 and 4.1.9)
> I think it can be solved with the following patch.
> Is there a possibility for this to be committed?
> 
> 
> --- JDBCStore-old.java  Wed Sep  4 02:13:53 2002
> +++ JDBCStore.java      Wed Sep  4 02:18:12 2002
> @@ -759,37 +759,43 @@
>               }
> 
>               try {
> -                preparedSizeSql.close();
> +                if (preparedSizeSql != null)
> +                    preparedSizeSql.close();
>               } catch (SQLException e) {
>                   ;
>               }
> 
>               try {
> -                preparedKeysSql.close();
> +                if (preparedKeysSql != null)
> +                    preparedKeysSql.close();
>               } catch (SQLException e) {
>                   ;
>               }
> 
>               try {
> -                preparedSaveSql.close();
> +                if (preparedSaveSql != null)
> +                    preparedSaveSql.close();
>               } catch (SQLException e) {
>                   ;
>               }
> 
>               try {
> -                preparedClearSql.close();
> +                if (preparedClearSql != null)
> +                    preparedClearSql.close();
>               } catch (SQLException e) {
>                   ;
>               }
> 
>               try {
> -                preparedRemoveSql.close();
> +                if (preparedRemoveSql != null)
> +                    preparedRemoveSql.close();
>               } catch (SQLException e) {
>                   ;
>               }
> 
>               try {
> -                preparedLoadSql.close();
> +                if (preparedLoadSql != null)
> +                    preparedLoadSql.close();
>               } catch (SQLException e) {
>                   ;
>               }
> 
> 
> -- 
>   Ronald Klop
>   Amsterdam, The Netherlands
> 
> 
> --
> To unsubscribe, e-mail:   
> <mailto:tomcat-user-> unsubscribe@jakarta.apache.org>
> For 
> additional commands, 
> e-mail: <ma...@jakarta.apache.org>
> 
> 


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>