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

Not able to startup webapp inside of Tomcat #221

Closed
csavory opened this issue Jan 13, 2014 · 12 comments
Closed

Not able to startup webapp inside of Tomcat #221

csavory opened this issue Jan 13, 2014 · 12 comments

Comments

@csavory
Copy link
Contributor

csavory commented Jan 13, 2014

I can start my app (as a jar) from the command line, but as soon as I try to start from Tomcat (as a war) I get a a startup error.

SpringServletContainerInitializer will loop through all the WebApplicationInitializer that it finds:

        for (WebApplicationInitializer initializer : initializers) {
            initializer.onStartup(servletContext);
        }

SpringBootServletInitializer is found and and its onStartup is called.

SpringBootServletInitializer will create a new SpringApplicationBuilder on line 81:

SpringApplicationBuilder application = new SpringApplicationBuilder();

this is not passing any sources into the constructor.

Then on line 328 of SpringApplication there is an Assert that fails.

Assert.notEmpty(sources, "Sources must not be empty");

Am I configuring this wrong? I have tried several versions and even dropping back to 0.5.0.M7 and M6.

@dsyer
Copy link
Member

dsyer commented Jan 14, 2014

I think you must be doing something wrong. How is it going to know what sources to use? Aren't you supposed to provide your own subclass of SpringBootServletInitializer?

@csavory
Copy link
Contributor Author

csavory commented Jan 14, 2014

I do provide my own subclass of SpringBootServletInitializer and it gets loaded fine. But then it appears (from the Debugger) as if SpringServletContainerInitializer is picking up SpringBootServletInitializer in addition to my subclass even though it is declared as abstract.

@dsyer
Copy link
Member

dsyer commented Jan 14, 2014

I never saw that before. Can you share your code? Also, what version of Boot and Tomcat are you using/

@csavory
Copy link
Contributor Author

csavory commented Jan 14, 2014

I can't share my code, but I can try to reproduce with a sample project. I'll try to get to it this week. Where is the best place to upload?

@dsyer
Copy link
Member

dsyer commented Jan 14, 2014

Github is great. But anywhere we can grab it and build it. If you can make it a Maven build that's best, but if it's a simple project, don't mind much.

@csavory
Copy link
Contributor Author

csavory commented Jan 14, 2014

@dsyer
Copy link
Member

dsyer commented Jan 14, 2014

Your SpringBootServletInitializer doesn't actually override the configure() method, so you have provided a non-abstract instance of it with no sources. I guess that's the explanation?

@csavory
Copy link
Contributor Author

csavory commented Jan 14, 2014

I'm not following you. StringWebXml does override configure()

@dsyer
Copy link
Member

dsyer commented Jan 14, 2014

Ah, didn't see that. I was looking at StringApplication. I guess you need to remove the extends ... from the declaration of that (personally I like to keep SpringBootServletInitializer in the same place is my main method, but it's up to you).

@csavory
Copy link
Contributor Author

csavory commented Jan 14, 2014

@dsyer it is working now that I consolidated StringWebXml into StringApplication

It's really not that important, but do you think there is still a defect here about having multiple SpringBootServletInitializer in the classpath? Or is that forbidden with spring-boot?

@dsyer
Copy link
Member

dsyer commented Feb 24, 2017

@nedjs I don't think that's even vaguely relevant to this (closed) issue. If you have a usage question please go to stackoverflow. If you have an issue you want to raise with the Spring Boot team, please open a new one (with a bit more context to explain what you need than you provided so far please).

@nedjs
Copy link

nedjs commented Feb 24, 2017

@dsyer Oh my, I posted this on the wrong gosh darn issue last night in my tired haze. Sorry about that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants