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

spring bootified WAR fails to load sealed JAR (java.lang.SecurityException: Sealing violation loading) #3656

Closed
hohwille opened this issue Aug 4, 2015 · 7 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@hohwille
Copy link

hohwille commented Aug 4, 2015

I wrote an application with spring boot and everything worked fine so far. I can run it in development from IDE and also it runs from JAR oder from bootified WAR if I ran with java -jar app.war.
However, I need to do a traditional deployment of the app in a preconfigured tomcat. Then I get this exception:

Caused by: java.lang.SecurityException: Sealing violation loading oracle.jdbc.driver.OracleDriverExtension : Package oracle.jdbc.driver is sealed.
at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2468) ~[catalina.jar:8.0.24]
at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:857) ~[catalina.jar:8.0.24]

This actually does not come from Java classloading or other JDK code itself but from org.apache.catalina.loader.WebappClassLoaderBase that is bundled with tomcat-embed-core JAR filed that is provided and therefore loaded from tomcat itself (catalina.home/lib/catalina.jar).
I double checked my classpath and also extracted the bootified WAR to ensure there is no other JAR containing code in package oracle.jdbc but found nothing.
In the extracted WAR in WEB-INF/lib I ran this script:

for file in *.jar; do echo $file; jar vtf $file | grep oracle; done

The only relevant JARs are:

flyway-core-3.1.jar
0 Thu Nov 27 15:30:02 CET 2014 org/flywaydb/core/internal/dbsupport/oracle/
1409 Thu Nov 27 15:30:00 CET 2014 org/flywaydb/core/internal/dbsupport/oracle/createMetaDataTable.sql
2877 Thu Nov 27 15:30:02 CET 2014 org/flywaydb/core/internal/dbsupport/oracle/OracleDbSupport.class
11557 Thu Nov 27 15:30:02 CET 2014 org/flywaydb/core/internal/dbsupport/oracle/OracleSchema.class
3069 Thu Nov 27 15:30:00 CET 2014 org/flywaydb/core/internal/dbsupport/oracle/OracleSqlStatementBuilder.class
2037 Thu Nov 27 15:30:00 CET 2014 org/flywaydb/core/internal/dbsupport/oracle/OracleTable.class
logback-classic-1.1.3.jar
2470 Tue Mar 24 11:58:00 CET 2015 ch/qos/logback/classic/db/script/oracle.sql

and of course

ojdbc7-12.1.0.2.jar
0 Mon Jun 30 11:32:26 CEST 2014 oracle/
0 Mon Jun 30 11:32:44 CEST 2014 oracle/net/
0 Mon Jun 30 11:55:06 CEST 2014 oracle/net/ano/
3750 Mon Jun 30 11:55:04 CEST 2014 oracle/net/ano/Ano.class
...

I am unfortunately lost in space with this. As I am forced to run the app in the predefined tomcat I need to find a way to solve this problem. However I assume that the implementation of the seal-check is not working properly with spring boot shading the bootstrap... Any ideas or hints what I can try?
I also reproduced in a vanilla tomcat and get the same error. Probably a bug in the latest tomcat 8.0.24 release?

@wilkinsona
Copy link
Member

Does running with -verbose:class shed any light on which other jar an Oracle class has been loaded from?

@wilkinsona wilkinsona added the status: waiting-for-feedback We need additional information before we can continue label Aug 4, 2015
@hohwille
Copy link
Author

hohwille commented Aug 4, 2015

Looks sane to me:

[Loaded org.springframework.boot.autoconfigure.jdbc.DatabaseDriver from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/spring-boot-autoconfigure-1.2.3.RELEASE.jar]
[Loaded oracle.jdbc.driver.OracleDriver from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded java.sql.SQLNonTransientException from /usr/local/jdk1.8.0_45/jre/lib/rt.jar]

@hohwille
Copy link
Author

hohwille commented Aug 4, 2015

[Loaded oracle.jdbc.OracleDriver from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.OracleDriverExtension from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded java.sql.DriverInfo from /usr/local/jdk1.8.0_45/jre/lib/rt.jar]
[Loaded oracle.jdbc.driver.OracleDriver$1 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.DiagnosabilityMXBean from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.OracleDiagnosabilityMBean from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded javax.management.StandardMBean$MBeanInfoSafeAction from /usr/local/jdk1.8.0_45/jre/lib/rt.jar]
[Loaded oracle.jdbc.driver.DatabaseError from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.OracleSQLException from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$1 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$2 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$3 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$4 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$5 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$6 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$7 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$8 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$9 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$10 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$11 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$12 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$13 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]
[Loaded oracle.jdbc.driver.SQLStateMapping$SqlExceptionType$14 from jar:file:/data/home/keys/webapps/keys.war!/WEB-INF/lib/ojdbc7-12.1.0.2.jar]

@hohwille
Copy link
Author

hohwille commented Aug 4, 2015

No results from this command:

cat logs/catalina.out | grep oracle | grep -v ojdbc7

@hohwille
Copy link
Author

hohwille commented Aug 4, 2015

As it seems this error occurs with apache-tomcat-8.0.24 and does not occur with apache-tomcat-8.0.23. Then it is a pure tomcat bug and you can close this issue. I will do some further verification (as I was testing with and without java security manager and need to get 100% sure) but it really seems to be that problem.

@hohwille
Copy link
Author

hohwille commented Aug 4, 2015

I have verified everything and can confirm it. I created this issue for tomcat:
https://bz.apache.org/bugzilla/show_bug.cgi?id=58208

You can close this issue here. Thanks.

@snicoll
Copy link
Member

snicoll commented Aug 4, 2015

Thanks for the feedback. See also #3526

@snicoll snicoll closed this as completed Aug 4, 2015
@dsyer dsyer removed the status: waiting-for-feedback We need additional information before we can continue label Aug 4, 2015
@snicoll snicoll added the status: invalid An issue that we don't feel is valid label Aug 4, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants