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

Resources not found when running the .war embedded tomcat #3689

Closed
manolo opened this issue Mar 12, 2018 · 4 comments
Closed

Resources not found when running the .war embedded tomcat #3689

manolo opened this issue Mar 12, 2018 · 4 comments

Comments

@manolo
Copy link
Member

manolo commented Mar 12, 2018

Out of the box, Spring Boot uses a public static void main entry-point that launches an embedded web tomcat server packaged into the .war file, thus running java -jar target/my-app.war launches the app. Tough, flow seems unable to find resources packaged into the .war file. The same war deployed in a tomcat works as expected.

You can reproduce e.g. by checking out bakery and packaging it:

mvn package -Pproduction
java -jar target/bakery-*.war

The error in console is:
Can't find resource 'frontend://src/views/login/login-view.html' via the servlet context'

@deyaeddin
Copy link

deyaeddin commented Mar 23, 2018

I'm facing the same error when I changed the packaging to jar with Spring Boot 2.0,
it's running fine with error in console when I use

mvn spring-boot:run

but when I use:

java -jar target/bakery-app.jar

I got the following exception error

ERROR 3103 --- [nio-8002-exec-2] c.v.flow.router.InternalServerError : There was an exception while trying to navigate to 'login'

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.thalesgroup.ife.dutyfree.dutyfreeframework.ui.views.login.LoginView': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.thalesgroup.ife.dutyfree.dutyfreeframework.ui.views.login.LoginView]: Constructor threw exception; nested exception is java.lang.IllegalStateException: Can't find resource 'frontend://src/views/login/login-view.html' via the servlet context
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1232) ~[spring-beans-5.0.4.RELEASE.jar!/:5.0.4.RELEASE]

@pleku pleku added this to the 1.0 Maintenance milestone Mar 25, 2018
@docwho2
Copy link

docwho2 commented Mar 26, 2018

I just ran into this as well. This is the default behavior when you deploy to AWS Beanstalk. But what AWS does by default is rename your WAR file to "application.jar" and then executes "java -jar application.jar". Took me half a day to figure out renaming the WAR to JAR breaks everything. I had simple views before, but now that I'm including HTML in the views I'm seeing the same errors. I will change my deployment package to execute the WAR with mvn spring-boot:run until there is fix.

@Legioth
Copy link
Member

Legioth commented Mar 28, 2018

Similar messages also observed with mvn spring-boot:run for the vaadin_push.zip project referenced in #3738 (comment).

@denis-anisimov
Copy link
Contributor

Issue moved to vaadin/spring #265 via ZenHub

@gilberto-torrezan gilberto-torrezan modified the milestones: 1.0 Maintenance, 1.0.0.beta9 Apr 30, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants