Re: NullPointerException in Tomcat startup while parsing XML configuration file

2022-03-15 Thread Mark Thomas

On 15/03/2022 14:42, Christopher Schultz wrote:

Harri,

On 3/15/22 06:45, Harri Pesonen wrote:
Hello, that xml file is embedded in catalina.jar, so obviously I have 
not modified it:


jar:file:/C:/Tomcat/tomcat_home/lib/catalina.jar!/org/apache/catalina/mbeans/mbeans-descriptors.xml 



It's not obvious at all. If you are capable of attaching a debugger to 
Tomcat, you are most certainly capable of modifying an XML file within a 
JAR file.



It does not prevent Tomcat startup.


Good.


It only prevents me from finding the NullPointerException in my
application startup.
Does it? How so? Because the NPE happens before your NPE happens and you 
can't get past it?



But because NullPointerException is always a bug, I was thinking that
someone might be interested.

I'm sure someone *is* interested.


You already have the important stack trace lines in this message, and
you can easily reproduce the problem by starting Tomcat in debugger
and having breakpoint in NullPointerException.

So are you asking for help, or reporting a bug?

If you are asking for help, and I'm asking for more information and you 
tell me "go get it yourself" then I'm a lot less likely to be helpful, 
don't you think?


If you are reporting a bug, then consider it reported.


And fixed.

Mark

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



Re: NullPointerException in Tomcat startup while parsing XML configuration file

2022-03-15 Thread Christopher Schultz

Harri,

On 3/15/22 06:45, Harri Pesonen wrote:

Hello, that xml file is embedded in catalina.jar, so obviously I have not 
modified it:

jar:file:/C:/Tomcat/tomcat_home/lib/catalina.jar!/org/apache/catalina/mbeans/mbeans-descriptors.xml


It's not obvious at all. If you are capable of attaching a debugger to 
Tomcat, you are most certainly capable of modifying an XML file within a 
JAR file.



It does not prevent Tomcat startup.


Good.


It only prevents me from finding the NullPointerException in my
application startup.
Does it? How so? Because the NPE happens before your NPE happens and you 
can't get past it?



But because NullPointerException is always a bug, I was thinking that
someone might be interested.

I'm sure someone *is* interested.


You already have the important stack trace lines in this message, and
you can easily reproduce the problem by starting Tomcat in debugger
and having breakpoint in NullPointerException.

So are you asking for help, or reporting a bug?

If you are asking for help, and I'm asking for more information and you 
tell me "go get it yourself" then I'm a lot less likely to be helpful, 
don't you think?


If you are reporting a bug, then consider it reported.

-chris


-Original Message-
From: Christopher Schultz 
Sent: maanantai 14. maaliskuuta 2022 16.36
To: users@tomcat.apache.org
Subject: Re: NullPointerException in Tomcat startup while parsing XML 
configuration file

Harri,

On 3/14/22 10:23, Harri Pesonen wrote:

Hello, I don't know if this is interesting, but while I started Tomcat
in IDEA debugger, when I had breakpoint set to NullPointerException (so that it 
breaks on all of them), then it break here:

org\apache\tomcat\tomcat-util\8.5.75\tomcat-util-8.5.75.jar!\org\apach
e\tomcat\util\IntrospectionUtils.class

public static String replaceProperties(String value, Hashtable 
staticProp, IntrospectionUtils.PropertySource[] dynamicProp, ClassLoader classLoader) 
{
  if (value.indexOf(36) < 0) {

"value" is null.

A bit more up in stack trace, it is here:

org\apache\tomcat\tomcat-util-scan\8.5.75\tomcat-util-scan-8.5.75.jar!
\org\apache\tomcat\util\digester\Digester.class

public InputSource resolveEntity(String name, String publicId, String baseURI, 
String systemId) throws SAXException, IOException {
  name = this.replace(name);

"name" is null.

One more up:

java.xml\com\sun\org\apache\xerces\internal\util\EntityResolver2Wrappe
r.java

String name = null;
if (resourceIdentifier instanceof XMLDTDDescription) {
  name = "[dtd]";
}
else if (resourceIdentifier instanceof XMLEntityDescription) {
  name = ((XMLEntityDescription)
resourceIdentifier).getEntityName();
}

// When both pubId and sysId are null, the user's entity resolver //
can do nothing about it. We'd better not bother calling it.
// This happens when the resourceIdentifier is a GrammarDescription,
// which describes a schema grammar of some namespace, but without //
any schema location hint. -Sg if (pubId == null && sysId == null) {
  return null;
}

// Resolve using EntityResolver2
try {
  InputSource inputSource =
  fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);

"name" is null.

It was parsing this:

jar:file:/C:/Tomcat/tomcat_home/lib/catalina.jar!/org/apache/catalina/
mbeans/mbeans-descriptors.xml

So the problem seems to happen in org.apache.xerces XML parser, or in Tomcat.


Have you modified the stock mbeans-descriptors.xml file? Does this prevent 
startup in your environment? If so, please post the full stack trace. If this 
error is caught and ignored, than there is nothing to do.

-chris

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


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



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



RE: NullPointerException in Tomcat startup while parsing XML configuration file

2022-03-15 Thread Harri Pesonen
Hello, that xml file is embedded in catalina.jar, so obviously I have not 
modified it:

jar:file:/C:/Tomcat/tomcat_home/lib/catalina.jar!/org/apache/catalina/mbeans/mbeans-descriptors.xml

It does not prevent Tomcat startup.
It only prevents me from finding the NullPointerException in my application 
startup.
But because NullPointerException is always a bug, I was thinking that someone 
might be interested.
You already have the important stack trace lines in this message, and you can 
easily reproduce the problem by starting Tomcat in debugger and having 
breakpoint in NullPointerException.

-Harri

-Original Message-
From: Christopher Schultz  
Sent: maanantai 14. maaliskuuta 2022 16.36
To: users@tomcat.apache.org
Subject: Re: NullPointerException in Tomcat startup while parsing XML 
configuration file

Harri,

On 3/14/22 10:23, Harri Pesonen wrote:
> Hello, I don't know if this is interesting, but while I started Tomcat 
> in IDEA debugger, when I had breakpoint set to NullPointerException (so that 
> it breaks on all of them), then it break here:
> 
> org\apache\tomcat\tomcat-util\8.5.75\tomcat-util-8.5.75.jar!\org\apach
> e\tomcat\util\IntrospectionUtils.class
> 
> public static String replaceProperties(String value, Hashtable Object> staticProp, IntrospectionUtils.PropertySource[] dynamicProp, 
> ClassLoader classLoader) {
>  if (value.indexOf(36) < 0) {
> 
> "value" is null.
> 
> A bit more up in stack trace, it is here:
> 
> org\apache\tomcat\tomcat-util-scan\8.5.75\tomcat-util-scan-8.5.75.jar!
> \org\apache\tomcat\util\digester\Digester.class
> 
> public InputSource resolveEntity(String name, String publicId, String 
> baseURI, String systemId) throws SAXException, IOException {
>  name = this.replace(name);
> 
> "name" is null.
> 
> One more up:
> 
> java.xml\com\sun\org\apache\xerces\internal\util\EntityResolver2Wrappe
> r.java
> 
> String name = null;
> if (resourceIdentifier instanceof XMLDTDDescription) {
>  name = "[dtd]";
> }
> else if (resourceIdentifier instanceof XMLEntityDescription) {
>  name = ((XMLEntityDescription) 
> resourceIdentifier).getEntityName();
> }
> 
> // When both pubId and sysId are null, the user's entity resolver // 
> can do nothing about it. We'd better not bother calling it.
> // This happens when the resourceIdentifier is a GrammarDescription, 
> // which describes a schema grammar of some namespace, but without // 
> any schema location hint. -Sg if (pubId == null && sysId == null) {
>  return null;
> }
> 
> // Resolve using EntityResolver2
> try {
>  InputSource inputSource =
>  fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);
> 
> "name" is null.
> 
> It was parsing this:
> 
> jar:file:/C:/Tomcat/tomcat_home/lib/catalina.jar!/org/apache/catalina/
> mbeans/mbeans-descriptors.xml
> 
> So the problem seems to happen in org.apache.xerces XML parser, or in Tomcat.

Have you modified the stock mbeans-descriptors.xml file? Does this prevent 
startup in your environment? If so, please post the full stack trace. If this 
error is caught and ignored, than there is nothing to do.

-chris

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


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



Re: NullPointerException in Tomcat startup while parsing XML configuration file

2022-03-14 Thread Christopher Schultz

Harri,

On 3/14/22 10:23, Harri Pesonen wrote:

Hello, I don't know if this is interesting, but while I started Tomcat in IDEA 
debugger, when I had breakpoint set to NullPointerException (so that it breaks 
on all of them),
then it break here:

org\apache\tomcat\tomcat-util\8.5.75\tomcat-util-8.5.75.jar!\org\apache\tomcat\util\IntrospectionUtils.class

public static String replaceProperties(String value, Hashtable 
staticProp, IntrospectionUtils.PropertySource[] dynamicProp, ClassLoader classLoader) 
{
 if (value.indexOf(36) < 0) {

"value" is null.

A bit more up in stack trace, it is here:

org\apache\tomcat\tomcat-util-scan\8.5.75\tomcat-util-scan-8.5.75.jar!\org\apache\tomcat\util\digester\Digester.class

public InputSource resolveEntity(String name, String publicId, String baseURI, 
String systemId) throws SAXException, IOException {
 name = this.replace(name);

"name" is null.

One more up:

java.xml\com\sun\org\apache\xerces\internal\util\EntityResolver2Wrapper.java

String name = null;
if (resourceIdentifier instanceof XMLDTDDescription) {
 name = "[dtd]";
}
else if (resourceIdentifier instanceof XMLEntityDescription) {
 name = ((XMLEntityDescription) resourceIdentifier).getEntityName();
}

// When both pubId and sysId are null, the user's entity resolver
// can do nothing about it. We'd better not bother calling it.
// This happens when the resourceIdentifier is a GrammarDescription,
// which describes a schema grammar of some namespace, but without
// any schema location hint. -Sg
if (pubId == null && sysId == null) {
 return null;
}

// Resolve using EntityResolver2
try {
 InputSource inputSource =
 fEntityResolver.resolveEntity(name, pubId, baseURI, sysId);

"name" is null.

It was parsing this:

jar:file:/C:/Tomcat/tomcat_home/lib/catalina.jar!/org/apache/catalina/mbeans/mbeans-descriptors.xml

So the problem seems to happen in org.apache.xerces XML parser, or in Tomcat.


Have you modified the stock mbeans-descriptors.xml file? Does this 
prevent startup in your environment? If so, please post the full stack 
trace. If this error is caught and ignored, than there is nothing to do.


-chris

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