You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Christopher Schultz <ch...@christopherschultz.net> on 2017/03/10 20:10:24 UTC

Re:[OT] get NPE from NamingContextListener in app moved from TomEE to Tomcat

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Mark,

On 3/10/17 12:42 PM, Mark Thomas wrote:
> On 10/03/2017 17:39, KARR, DAVID wrote:
>> I have a CXF/REST/Spring/JDBC app running in TomEE (7.0.1).  I've
>> decided to try to move it to Tomcat (8.5.11) because of some
>> classloader conflicts (CXF classes) I'm now seeing in trying to
>> add some new code to the app.
>> 
>> Initially, I'm just running the server in Eclipse.
>> 
>> When I add the apps to Tomcat and start it up, without changing
>> the server conf, it starts up, but it fails to find my JNDI
>> resources (obviously).
>> 
>> I have the following DataSource definition in the "tomee.xml"
>> file in TomEE, which is working fine: ------------------ 
>> <Resource id="tst36" type="DataSource"> testOnBorrow = true 
>> testOnReturn = true testWhileIdle = true logValidationErrors =
>> true validationQuery = select 1 from dual JdbcDriver =
>> oracle.jdbc.OracleDriver InitialSize = 2 MaxActive = 2 MinIdle =
>> 2 MaxIdle = 2 JdbcUrl = ... UserName = ... Password = ... 
>> </Resource> -------------
>> 
>> When I attempt to add this Resource definition to the
>> "context.xml" file in Tomcat 8.5.11, I see errors like the
>> following, and Tomcat fails to start up: ---------------- Caused
>> by: java.lang.NullPointerException at
>> java.util.StringTokenizer.<init>(StringTokenizer.java:199) at
>> java.util.StringTokenizer.<init>(StringTokenizer.java:221) at
>> org.apache.catalina.core.NamingContextListener.createSubcontexts(Nami
ngContextListener.java:1300)
>>
>> 
at
org.apache.catalina.core.NamingContextListener.addResource(NamingContext
Listener.java:1081)
>> at
>> org.apache.catalina.core.NamingContextListener.createNamingContext(Na
mingContextListener.java:661)
>>
>> 
at
org.apache.catalina.core.NamingContextListener.lifecycleEvent(NamingCont
extListener.java:249)
>> -----------------
>> 
>> I've tried converting the Resource definition to look more
>> "normal", but nothing I've tried makes any difference.  This is
>> the current state of it: ------------------ <Resource
>> id="jdbc/tst36" type="javax.sql.DataSource" auth="Container"
> 
> name="jdbc/tst36" not id=...

Hmm. When 'name' is null we should have a better behavior than NPE. :(

- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQIcBAEBCAAGBQJYwwgwAAoJEBzwKT+lPKRYLlsQAImSopWlV03jve4cZaGtli9F
qJGKdhl6IvMbzvWn1LGyUQ1ckPddR9LETy1pUcfoffKDdfpHx6LbOUCA8pcKsBD6
67SzS5ynruQlZZb3ikJA+R4GpNZ1LNu7zu0VPogV7BW7U09kTuoDlhO6pfYJ5DuW
br9NtxR/6en5uWi77w8+0P3fLyCnUcxtatmw/o3P8DCUGrX5LIhj7NvRdyEEmSY6
HbOsIB83bP3deC1yRdx3/7O5jVn7Go8aL8B5rjHuu3am3HRHD1RZArSSg5FCS3zd
Bt08yC4FumFBExRf6XRyjU544tygSe0Y1AEliiQb/i+e8s0CnpsDuz2QKm8t2CaG
yCNElAYubjyzeG1dvBM7rarP3vJv/QRRhJ3eZ7KuxnxRZX9LOYIQoZfYxuYEeTUg
Qs3neW1c1ESIezD4isFnfQALk0QSzPX+A2Btr8wzCUQWNOiN/MD3udVfafpuPVkY
FqZdhb1aPu03SScv/y2luUTJpKtxdGz9cXjMz9dp6lcbDtOAFBzP93CrMy4vWYXs
vryD9gbMVvuA7hWeKiTkIAIdoTCAw9Z3DxLpohC5v+3CCAy3Au37ke3kXE4ZAwh5
dERhqY78F00bbf3OI2VlNQdV75anDiyD3nuVS4D82w3OL1od4MIYCueU0sDzSwfI
fueFuqYlmqZSLvRXTo3Y
=GKYG
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Re:[OT] get NPE from NamingContextListener in app moved from TomEE to Tomcat

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Christopher Schultz [mailto:chris@christopherschultz.net] 
> Subject: Re:[OT] get NPE from NamingContextListener in app moved from TomEE to Tomcat

> > name="jdbc/tst36" not id=...

> Hmm. When 'name' is null we should have a better behavior than NPE. :(

It gets your attention...

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org