Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0006227 [Resin] minor always 04-13-19 19:21 04-23-19 14:29
Reporter nam View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 4.0.61
Summary 0006227: resin.rnc FileNotFoundException when running embedded with spring-boot
Description Resin is unable to find resin.rnc when running embedded within Spring Boot. The issue is that the resin.jar is nested within the executable jar.

1. EXECUTABLE JAR
2. EXCEPTION

===============
1. EXECUTABLE JAR
===============
$ jar tf spring-boot-resin-test-1.0-SNAPSHOT.jar
META-INF/
META-INF/MANIFEST.MF
org/
org/springframework/
org/springframework/boot/
org/springframework/boot/loader/
org/springframework/boot/loader/archive/
org/springframework/boot/loader/archive/ExplodedArchive$1.class
org/springframework/boot/loader/archive/ExplodedArchive.class
org/springframework/boot/loader/jar/
org/springframework/boot/loader/jar/CentralDirectoryFileHeader.class
org/springframework/boot/loader/jar/CentralDirectoryEndRecord.class
org/springframework/boot/loader/PropertiesLauncher$1.class
org/springframework/boot/loader/archive/Archive.class
org/springframework/boot/loader/archive/ExplodedArchive$FileEntryIterator$EntryComparator.class
org/springframework/boot/loader/jar/ZipInflaterInputStream.class
org/springframework/boot/loader/jar/Handler.class
org/springframework/boot/loader/LaunchedURLClassLoader.class
org/springframework/boot/loader/Launcher.class
org/springframework/boot/loader/archive/ExplodedArchive$FileEntry.class
org/springframework/boot/loader/archive/JarFileArchive$EntryIterator.class
org/springframework/boot/loader/jar/CentralDirectoryParser.class
org/springframework/boot/loader/jar/JarFile.class
org/springframework/boot/loader/jar/JarEntry.class
org/springframework/boot/loader/jar/Bytes.class
org/springframework/boot/loader/ExecutableArchiveLauncher.class
org/springframework/boot/loader/data/
org/springframework/boot/loader/data/RandomAccessDataFile$FileAccess.class
org/springframework/boot/loader/archive/Archive$Entry.class
org/springframework/boot/loader/util/
org/springframework/boot/loader/util/SystemPropertyUtils.class
org/springframework/boot/loader/jar/CentralDirectoryVisitor.class
org/springframework/boot/loader/jar/StringSequence.class
org/springframework/boot/loader/jar/JarFileEntries$EntryIterator.class
org/springframework/boot/loader/MainMethodRunner.class
org/springframework/boot/loader/LaunchedURLClassLoader$UseFastConnectionExceptionsEnumeration.class
org/springframework/boot/loader/data/RandomAccessData.class
org/springframework/boot/loader/archive/Archive$EntryFilter.class
org/springframework/boot/loader/jar/JarFileEntries.class
org/springframework/boot/loader/jar/JarFile$JarFileType.class
org/springframework/boot/loader/jar/JarFile$2.class
org/springframework/boot/loader/JarLauncher.class
org/springframework/boot/loader/data/RandomAccessDataFile.class
org/springframework/boot/loader/archive/ExplodedArchive$FileEntryIterator.class
org/springframework/boot/loader/jar/JarFileEntries$1.class
org/springframework/boot/loader/jar/FileHeader.class
org/springframework/boot/loader/jar/JarEntryFilter.class
org/springframework/boot/loader/jar/JarURLConnection.class
org/springframework/boot/loader/WarLauncher.class
org/springframework/boot/loader/data/RandomAccessDataFile$1.class
org/springframework/boot/loader/archive/JarFileArchive$JarFileEntry.class
org/springframework/boot/loader/jar/JarURLConnection$1.class
org/springframework/boot/loader/jar/JarURLConnection$JarEntryName.class
org/springframework/boot/loader/data/RandomAccessDataFile$DataInputStream.class
org/springframework/boot/loader/PropertiesLauncher.class
org/springframework/boot/loader/archive/JarFileArchive.class
org/springframework/boot/loader/jar/AsciiBytes.class
org/springframework/boot/loader/jar/JarFile$1.class
org/springframework/boot/loader/PropertiesLauncher$PrefixMatchingArchiveFilter.class
org/springframework/boot/loader/PropertiesLauncher$ArchiveEntryFilter.class
BOOT-INF/
BOOT-INF/classes/
BOOT-INF/classes/com/
BOOT-INF/classes/com/caucho/
BOOT-INF/classes/com/caucho/spring/
META-INF/maven/
META-INF/maven/com.caucho/
META-INF/maven/com.caucho/spring-boot-resin-test/
BOOT-INF/classes/com/caucho/spring/MyApplication.class
BOOT-INF/classes/com/caucho/spring/MyController.class
META-INF/maven/com.caucho/spring-boot-resin-test/pom.xml
META-INF/maven/com.caucho/spring-boot-resin-test/pom.properties
BOOT-INF/lib/
BOOT-INF/lib/spring-boot-starter-web-2.1.4.RELEASE.jar
BOOT-INF/lib/spring-boot-starter-2.1.4.RELEASE.jar
BOOT-INF/lib/spring-boot-2.1.4.RELEASE.jar
BOOT-INF/lib/spring-boot-autoconfigure-2.1.4.RELEASE.jar
BOOT-INF/lib/spring-boot-starter-logging-2.1.4.RELEASE.jar
BOOT-INF/lib/logback-classic-1.2.3.jar
BOOT-INF/lib/logback-core-1.2.3.jar
BOOT-INF/lib/slf4j-api-1.7.26.jar
BOOT-INF/lib/log4j-to-slf4j-2.11.2.jar
BOOT-INF/lib/log4j-api-2.11.2.jar
BOOT-INF/lib/jul-to-slf4j-1.7.26.jar
BOOT-INF/lib/javax.annotation-api-1.3.2.jar
BOOT-INF/lib/spring-core-5.1.6.RELEASE.jar
BOOT-INF/lib/spring-jcl-5.1.6.RELEASE.jar
BOOT-INF/lib/snakeyaml-1.23.jar
BOOT-INF/lib/spring-boot-starter-json-2.1.4.RELEASE.jar
BOOT-INF/lib/jackson-databind-2.9.8.jar
BOOT-INF/lib/jackson-annotations-2.9.0.jar
BOOT-INF/lib/jackson-core-2.9.8.jar
BOOT-INF/lib/jackson-datatype-jdk8-2.9.8.jar
BOOT-INF/lib/jackson-datatype-jsr310-2.9.8.jar
BOOT-INF/lib/jackson-module-parameter-names-2.9.8.jar
BOOT-INF/lib/hibernate-validator-6.0.16.Final.jar
BOOT-INF/lib/validation-api-2.0.1.Final.jar
BOOT-INF/lib/jboss-logging-3.3.2.Final.jar
BOOT-INF/lib/classmate-1.4.0.jar
BOOT-INF/lib/spring-web-5.1.6.RELEASE.jar
BOOT-INF/lib/spring-beans-5.1.6.RELEASE.jar
BOOT-INF/lib/spring-webmvc-5.1.6.RELEASE.jar
BOOT-INF/lib/spring-aop-5.1.6.RELEASE.jar
BOOT-INF/lib/spring-context-5.1.6.RELEASE.jar
BOOT-INF/lib/spring-expression-5.1.6.RELEASE.jar
BOOT-INF/lib/spring-boot-starter-resin-2.1.4.RELEASE.jar
BOOT-INF/lib/resin-4.0.60.jar
BOOT-INF/lib/javaee-16-4.0.60.jar
BOOT-INF/lib/hessian-4.0.60.jar
BOOT-INF/lib/javax.el-api-3.0.0.jar



===========
2. EXCEPTION
===========
org.springframework.context.ApplicationContextException: Unable to start web server; nested exception is com.caucho.config.ConfigException: java.io.FileNotFoundException: /BOOT-INF/lib/resin-4.0.60.jar!/com/caucho/server/resin/resin.rnc
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:157) ~[spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543) ~[spring-context-5.1.6.RELEASE.jar!/:5.1.6.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142) ~[spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775) [spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397) [spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:316) [spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260) [spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248) [spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    at com.caucho.spring.MyApplication.main(MyApplication.java:10) [classes!/:1.0-SNAPSHOT]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:na]
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:na]
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:na]
    at java.base/java.lang.reflect.Method.invoke(Method.java:564) ~[na:na]
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48) [spring-boot-resin-test-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87) [spring-boot-resin-test-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50) [spring-boot-resin-test-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
    at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51) [spring-boot-resin-test-1.0-SNAPSHOT.jar:1.0-SNAPSHOT]
Caused by: com.caucho.config.ConfigException: java.io.FileNotFoundException: /BOOT-INF/lib/resin-4.0.60.jar!/com/caucho/server/resin/resin.rnc
    at com.caucho.config.LineConfigException.create(LineConfigException.java:163) ~[resin-4.0.60.jar!/:4.0.60]
    at com.caucho.config.Config.configure(Config.java:258) ~[resin-4.0.60.jar!/:4.0.60]
    at com.caucho.server.resin.BootConfig.configureFile(BootConfig.java:132) ~[resin-4.0.60.jar!/:4.0.60]
    at com.caucho.server.resin.Resin.configureFile(Resin.java:1038) ~[resin-4.0.60.jar!/:4.0.60]
    at org.springframework.boot.web.embedded.resin.ResinPreCustomizer$ConfigFileResinPreCustomizer.customize(ResinPreCustomizer.java:47) ~[spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    at org.springframework.boot.web.embedded.resin.SpringResin.createResin(SpringResin.java:93) ~[spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    at org.springframework.boot.web.embedded.resin.SpringResin.<init>(SpringResin.java:64) ~[spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    at org.springframework.boot.web.embedded.resin.ResinServletWebServerFactory.createSpringResin(ResinServletWebServerFactory.java:103) ~[spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    at org.springframework.boot.web.embedded.resin.ResinServletWebServerFactory.getWebServer(ResinServletWebServerFactory.java:84) ~[spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.createWebServer(ServletWebServerApplicationContext.java:181) ~[spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.onRefresh(ServletWebServerApplicationContext.java:154) ~[spring-boot-2.1.4.RELEASE.jar!/:2.1.4.RELEASE]
    ... 16 common frames omitted
Caused by: java.io.FileNotFoundException: /BOOT-INF/lib/resin-4.0.60.jar!/com/caucho/server/resin/resin.rnc
    at com.caucho.vfs.Jar.openReadImpl(Jar.java:509) ~[resin-4.0.60.jar!/:4.0.60]
    at com.caucho.vfs.Jar.openReadImpl(Jar.java:479) ~[resin-4.0.60.jar!/:4.0.60]
    at com.caucho.vfs.JarPath.openReadImpl(JarPath.java:214) ~[resin-4.0.60.jar!/:4.0.60]
    at com.caucho.vfs.Path.openRead(Path.java:1156) ~[resin-4.0.60.jar!/:4.0.60]
    at com.caucho.relaxng.CompactVerifierFactoryImpl.compileSchema(CompactVerifierFactoryImpl.java:89) ~[resin-4.0.60.jar!/:4.0.60]
    at com.caucho.config.Config.findCompactSchema(Config.java:513) ~[resin-4.0.60.jar!/:4.0.60]
    at com.caucho.config.Config.configure(Config.java:250) ~[resin-4.0.60.jar!/:4.0.60]
Additional Information
Attached Files

- Relationships

- Notes
(0006881)
nam
04-13-19 19:25

Spring provides a classloader that we may use to load files:
https://docs.spring.io/spring-framework/docs/current/javadoc-api/org/springframework/core/io/ResourceLoader.html [^]
 
(0006882)
nam
04-13-19 21:10

Workaround:

        try {
            Field bootConfigField = Resin.class.getDeclaredField("_bootConfig");
            bootConfigField.setAccessible(true);

            this.bootConfig = (BootConfig) bootConfigField.get(resin);
        }
        catch (Exception ex) {
            throw ConfigException.create(ex);
        }

        InputStream is = null;

        try {
            Resource resource = this.resourceLoader.getResource(file);
            is = resource.getInputStream();
        }
        catch (IOException ex) {
            throw ConfigException.create(ex);
        }

        Config config = new Config();
        Schema schema = null;

        try {
            config.configure(this.bootConfig.getBootResin(), is, schema);
        }
        catch (Exception ex) {
            throw ConfigException.create(ex);
        }
 

- Issue History
Date Modified Username Field Change
04-13-19 19:21 nam New Issue
04-13-19 19:25 nam Note Added: 0006881
04-13-19 21:10 nam Note Added: 0006882
04-23-19 14:29 ferg Assigned To  => ferg
04-23-19 14:29 ferg Status new => closed
04-23-19 14:29 ferg Resolution open => fixed
04-23-19 14:29 ferg Fixed in Version  => 4.0.62


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker