Spring-Boot template resolution fails when WAR is deployed - spring

My Spring-Boot app works fine when running it via the Eclipse IDE (with S.T.S. 3.8.4 installed), with the embedded tomcat server.
I packaged it as a WAR and deployed it to a local Tomcat server.
When accessing the app, a blank page is returned. I discovered the exception in the Tomcat logs (on Windows, C:\<path-to-tomcat>\logs) An exception is thrown when trying to resolve the Thymeleaf templates:
2017-04-04 12:33:36.602 ERROR 5724 --- [io-12080-exec-7] org.thymeleaf.TemplateEngine : [THYMELEAF][http-nio-12080-exec-7] Exception processing template "home": Error resolving template "common/layout", template might not exist or might not be accessible by any of the configured Template Resolvers (template: "home" - line 5, col 7)
org.thymeleaf.exceptions.TemplateInputException: Error resolving template "common/layout", template might not exist or might not be accessible by any of the configured Template Resolvers (template: "home" - line 5, col 7)
at org.thymeleaf.engine.TemplateManager.resolveTemplate(TemplateManager.java:865) ~[thymeleaf-3.0.2.RELEASE.jar:3.0.2.RELEASE]

The problem was the casing of the folder names.
I had my layout fragment in templates/Common/layout.html (notice the capital C in Common) and in my views was referencing common/layout, which worked within the IDE, but did not work when deploying a WAR on a Tomcat server. Maybe because the IDE ignores casing, and Tomcat is case sensitive?
It worked after changing the reference in my view to the correct casing of the folder, Common/layout

Related

Spring Boot - Liquibase - WebSphere - Cannot create filesystem for url file xxx/jsf-nls.jar

Configuration
My Spring Boot/Liquibase specifications & configuration is as per this question.
Issue
Everything goes well in my local environment with embedded Tomcat. When i migrate the war file to IBM WebSphere 8.5.5.15, i see this warning:
[7/29/20 11:04:17:302] 000002ff database I liquibase.database Could not set remarks reporting on OracleDatabase: com.zaxxer.hikari.pool.HikariProxyConnection.setRemarksReporting(boolean)
[7/29/20 11:04:18:066] 000002ff lockservice I liquibase.lockservice Successfully acquired change log lock
[7/29/20 11:04:18:090] 000002ff integration W liquibase.integration Cannot create filesystem for url file:/opt/IBM/WebSphere/AppServer/lib/jsf-nls.jar: /opt/IBM/WebSphere/AppServer/lib/jsf-nls.jar
java.nio.file.FileSystemNotFoundException: /opt/IBM/WebSphere/AppServer/lib/jsf-nls.jar
at com.sun.nio.zipfs.ZipFileSystem.<init>(ZipFileSystem.java:120)
at com.sun.nio.zipfs.ZipFileSystemProvider.newFileSystem(ZipFileSystemProvider.java:139)
at java.nio.file.FileSystems.newFileSystem(FileSystems.java:390)
at liquibase.resource.ClassLoaderResourceAccessor.loadRootPaths(ClassLoaderResourceAccessor.java:63)
:
I have checked and the jar file is not there at the location that it is looking for it.
Question
It's only a warning, everything else is working as expected, should i be concerned about this warning?

Deploy error message on WebLogic 10.3.6.0

After fresh install of web logic, deployment shows the error:
Message icon - Error Failed to load webapp: MyWebApp because of DeploymentException:
weblogic.management.DeploymentException: Error: Unresolved Webapp Library references for "ServletContext#992422938[app:MyWebApp module:MyWebApp path:/MyWebApp spec-version:2.5]", defined in weblogic.xml [Extension-Name: jsf, Specification-Version: 2, exact-match: false]
Error Error: Unresolved Webapp Library references for "ServletContext#992422938[app:MyWebApp module:MyWebApp path:/MyWebApp
spec-version:2.5]", defined in weblogic.xml [Extension-Name: jsf, Specification-Version: 2, exact-match: false]
I have Cloud service weblogic, initially is installed
jsf(1.2,1.2.9.0) - [Name:jsf] [Specification Version:1.2] [Impl. Version: 1.2.9.0]
jstl(1.2,1.2.0.1) [jstl, 1.2, 1.2.0.1]
When I try to install jsf-2.0.war - Error is
An application with this name already exists. Please specify a different name.
After I changed the name to something - Error is
The deployment has not been installed.
Message icon - Error weblogic.management.ManagementException: [Deployer:149105]An attempt was made to deploy a library located at '/u01/data/domains/wls_domain/servers/wls_adminserver/upload/jsf-2.0.war' with name 'jsf(2.0,1.0.0.0_2-0-2)' that is different from the one specified in the manifest of the library: 'jsf'.
Your web application requires the JSF 2 shared library which is not deployed in your server. Deploy this library first and then your application.

Spring Boot with Tomcat embedded under windows server 2008 R2 doesn't work

Folks, I have a spring-boot app running locally with gradle build tool, with custom: server:
servlet-path: /own/api
port: 8989 without any problem. However it doesn't work in WindowServer 2008-R2, I just get in log:
DispatcherServlet with name dispatcherServlet processing GET request for [/own/api]
Looking up handler method for path [/own/api]
Maybe WindowsServer would require something extra configuration, but not sure, i guess to deploy a spring boot application with tomcat embedded wouldn't have any trouble:
java -jar myfile.jar
Under AdvancedREST client tool I just get:
http://SERVER-API:8989/own/api
{
"timestamp": "2016-07-05T21:13:25.884+0000"
"status": 404
"error": "Not Found"
"message": "/own/api"
"path": "/own/api"
}
As aforementioned, locally it works fine but not in windows server 2008R2. I was wondering if there was a manager in tomcat embedded, just to figure out what basePath would be, because I tried with:
http://SERVER-IP:8989/myfile/own/api //but didn't work either.
Any help I'd really appreciate.
Folks, I found the solution which is adding a slash character to the end of the URL.
http://server:port/own/api/ instead of http://server:port/own/api
I've faced with this issue in the past in other scenarios with Tomcat.

Weblogic deployment error

I have deployed ear files in oracle weblogic server and i also configured datasource for that project. When i try to test it it is giving me this error.
"Message icon - Error weblogic.application.ModuleException: :org.springframework.beans.factory.BeanDefinitionStoreException:Invalid bean definition with name 'userContext' defined in class path resource [voyager-seats-usercontext.xml]: Could not resolve placeholder 'IDM.USERNAME'
Message icon - Warning Errors were encountered while performing this operation."
I restarted and reconfigured this app still it is giving error.

How to configure xuggle for Apache Tomcat in Windows

I have been developing a video sharing web application (like youtube) using Netbeans with Tomcat on Windows platform. There I want to generate thumbnail images of video files as soon as the videos get uploaded. So searching the net I found something called Xuggle. I installed Xuggler in my Tomcat's lib folder. I have set the necessary environment variables. When I run just a java application I get the results, but when I do the same with a Java web application I get the following errors:
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from
fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
root cause
java.lang.UnsatisfiedLinkError: com.xuggle.xuggler.XugglerJNI.Global_NO_PTS_get()J
com.xuggle.xuggler.XugglerJNI.Global_NO_PTS_get(Native Method)
com.xuggle.xuggler.Global.<clinit>(Global.java:240)
xugglerPack.Main.<clinit>(Main.java:43)
xugglerPack.VT.processRequest(VT.java:86)
xugglerPack.VT.doPost(VT.java:137)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:3
93)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26
logs.
===========================================================================================
#pd40 >>> I reinstalled Xuggler ( this time in C:\Program Files , I restarted my PC after installation . I set the following in my environment variables :
XUGGLE_HOME = C:\Program Files (x86)\Xuggle
CLASSPATH = .;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib\commons-cli.jar;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib\logback-classic.jar;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib\logback-core.jar;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib\slf4j-api.jar;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib\xuggle-xuggler.jar;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib\xuggle-xuggler-test.jar;
PATH = C:\Program Files (x86)\Xuggle\bin;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\bin;C:\Apache Tomcat 6.0.26\Apache Tomcat 6.0.26\lib;C:\Program Files (x86)\Xuggle\lib
I have copied the jars of Xuggle/java/jars (6 jar files) in The Tomcat's\lib folder and set the CLASSPATH of them.
Now I still get the problem when i do this in a web application , but standalone java application generates the images nicely. What is going wrong ??? When i upload a video it gets uploaded but the thumbnail images are not generated , I get the following error...
HTTP Status 500 -
type Exception report
message
description The server encountered an internal error () that prevented it from
fulfilling this request.
exception
javax.servlet.ServletException: Servlet execution threw an exception
root cause
java.lang.NoClassDefFoundError: Could not initialize class com.xuggle.ferry.FerryJNI
com.xuggle.ferry.RefCounted.acquire(RefCounted.java:179)
com.xuggle.xuggler.IContainer.copyReference(IContainer.java:80)
com.xuggle.mediatool.AMediaCoderMixin.<init>(AMediaCoderMixin.java:68)
com.xuggle.mediatool.MediaReader.<init>(MediaReader.java:137)
com.xuggle.mediatool.ToolFactory.makeReader(ToolFactory.java:77)
xugglerPack.Main.main(Main.java:51)
xugglerPack.VT.processRequest(VT.java:87)
xugglerPack.VT.doPost(VT.java:135)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
note The full stack trace of the root cause is available in the Apache Tomcat/6.0.26
logs.
Make sure you put Xuggler lib in your windows PATH or LD_LIBRARY_PATH.
Similar to Tomcat native. I assume you have tried this.
You might also want to check out this thread

Resources