Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NPE from unwrapping DataSource in WebLogic 12.2.1.4 #996

Closed
tlehton opened this issue Mar 17, 2021 · 2 comments
Closed

NPE from unwrapping DataSource in WebLogic 12.2.1.4 #996

tlehton opened this issue Mar 17, 2021 · 2 comments
Labels

Comments

@tlehton
Copy link

tlehton commented Mar 17, 2021

A NullPointerException is thrown from SessionListener.contextDestroyed() when undeploying application on WLS 12.2.1.4. More precisely from unwrapping weblogic.jdbc.common.internal.RmiDataSource at:

unwrap(dataSource, "jdbcCtx", dataSourceUnwrappedMessage);

n.b.javamelody.debug(:36) Datasource needs unwrap: Database of class weblogic.jdbc.common.internal.RmiDataSource
n.b.javamelody.debug(:42) rebinding initial datasources failed, skipping
java.lang.NullPointerException: null
        at net.bull.javamelody.JdbcWrapperHelper$1.run(JdbcWrapperHelper.java:547) ~[net.bull.javamelody-javamelody-core-1.86.0.jar:1.86.0]
        at java.security.AccessController.doPrivileged(Native Method) ~[na:1.8.0_251]
        at net.bull.javamelody.JdbcWrapperHelper.setFieldAccessible(JdbcWrapperHelper.java:543) ~[net.bull.javamelody-javamelody-core-1.86.0.jar:1.86.0]
        at net.bull.javamelody.JdbcWrapperHelper.getAccessibleField(JdbcWrapperHelper.java:522) ~[net.bull.javamelody-javamelody-core-1.86.0.jar:1.86.0]
        at net.bull.javamelody.JdbcWrapperHelper.getFieldValue(JdbcWrapperHelper.java:507) ~[net.bull.javamelody-javamelody-core-1.86.0.jar:1.86.0]
        at net.bull.javamelody.JdbcWrapper.unwrap(JdbcWrapper.java:677) ~[net.bull.javamelody-javamelody-core-1.86.0.jar:1.86.0]
        at net.bull.javamelody.JdbcWrapper.unwrapDataSource(JdbcWrapper.java:668) ~[net.bull.javamelody-javamelody-core-1.86.0.jar:1.86.0]
        at net.bull.javamelody.JdbcWrapper.stop(JdbcWrapper.java:642) ~[net.bull.javamelody-javamelody-core-1.86.0.jar:1.86.0]
        at net.bull.javamelody.SessionListener.contextDestroyed(SessionListener.java:337) [net.bull.javamelody-javamelody-core-1.86.0.jar:1.86.0]
        at weblogic.servlet.internal.EventsManager$FireContextListenerAction.run(EventsManager.java:720) [com.oracle.weblogic.servlet.jar:12.2.1.4]
        at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:344) [com.oracle.weblogic.security.subject.jar:12.2.1.4]
        at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197) [com.oracle.weblogic.security.subject.jar:12.2.1.4]
        at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203) [com.oracle.weblogic.servlet.jar:12.2.1.4]
        at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71) [com.oracle.weblogic.servlet.jar:12.2.1.4]
        at weblogic.servlet.internal.EventsManager.executeContextListener(EventsManager.java:251) [com.oracle.weblogic.servlet.jar:12.2.1.4]

This was reproduced with latest 1.86.0 version. Same kind of problem was already fixed for SessionListener.contextInitialized() in #916

@evernat
Copy link
Member

evernat commented May 8, 2021

You said that NPE is thrown from SessionListener.contextDestroyed(), but no, it is sure that it is not thrown by the method.

As you can see in the stack trace that you have given, the log is at debug level and it says "skipping":
n.b.javamelody.debug(:42) rebinding initial datasources failed, skipping java.lang.NullPointerException: null at ...
What happens is that, after this log at debug level, the listener continues to be destroyed and no exception is thrown by the contextDestroyed method.
So there is no issue here I think.
That's why I am closing this issue as invalid.

Given the failure to unwrap the datasource, perhaps there is also the same debug log with NPE when wrapping the datasource which is when the SessionListener is initialized. And so perhaps you do not have any monitoring of SQL requests.

@evernat
Copy link
Member

evernat commented May 8, 2021

The exception is not throw by the method, but still it would be better to do the right thing in unwrap instead of logging that.
Debug log fixed by 6541966

goldyliang pushed a commit to goldyliang/javamelody that referenced this issue Mar 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants