Java 尝试使用Jetty server加载web应用程序时出现获取HTTP错误:503

Java 尝试使用Jetty server加载web应用程序时出现获取HTTP错误:503,java,spring,http,jboss,jetty,Java,Spring,Http,Jboss,Jetty,我使用intellij IDE和Jetty server来创建和部署我的spring应用程序 我在运行服务器时得到这个消息 [INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for com.vcllabs.adsops:adsops-core:war:0.0.1-SNAPSHOT [WARNING] 'd

我使用intellij IDE和Jetty server来创建和部署我的spring应用程序

我在运行服务器时得到这个消息

    [INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.vcllabs.adsops:adsops-core:war:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: javax.mail:mail:jar -> version 1.4 vs 1.4.7 @ line 177, column 21
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-surefire-plugin is missing. @ line 249, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building adsops-core 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> jetty-maven-plugin:9.3.6.v20151106:run (default-cli) > test-compile @ adsops-core >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ adsops-core ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 2309 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:compile (default-compile) @ adsops-core ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 50 source files to E:\Projects\ADpost\ops\dev\target\classes
[INFO] /E:/Projects/ADpost/ops/dev/src/main/java/com/vlclabs/adsops/configuration/JPAConfiguration.java: Some input files use or override a deprecated API.
[INFO] /E:/Projects/ADpost/ops/dev/src/main/java/com/vlclabs/adsops/configuration/JPAConfiguration.java: Recompile with -Xlint:deprecation for details.
[INFO] /E:/Projects/ADpost/ops/dev/src/main/java/com/vlclabs/adsops/repository/IndividualProfileRepositoryImpl.java: E:\Projects\ADpost\ops\dev\src\main\java\com\vlclabs\adsops\repository\IndividualProfileRepositoryImpl.java uses unchecked or unsafe operations.
[INFO] /E:/Projects/ADpost/ops/dev/src/main/java/com/vlclabs/adsops/repository/IndividualProfileRepositoryImpl.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ adsops-core ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\Projects\ADpost\ops\dev\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.3:testCompile (default-testCompile) @ adsops-core ---
[INFO] No sources to compile
[INFO]
[INFO] <<< jetty-maven-plugin:9.3.6.v20151106:run (default-cli) < test-compile @ adsops-core <<<
[INFO]
[INFO]
[INFO] --- jetty-maven-plugin:9.3.6.v20151106:run (default-cli) @ adsops-core ---
[INFO] Logging initialized @4907ms
[INFO] Configuring Jetty for project: adsops-core
[INFO] webAppSourceDirectory not set. Trying src\main\webapp
[INFO] Reload Mechanic: automatic
[INFO] Classes = E:\Projects\ADpost\ops\dev\target\classes
[INFO] Context path = /adsops
[INFO] Tmp directory = E:\Projects\ADpost\ops\dev\target\tmp
[INFO] Web defaults = org/eclipse/jetty/webapp/webdefault.xml
[INFO] Web overrides =  none
[INFO] web.xml file = null
[INFO] Webapp directory = E:\Projects\ADpost\ops\dev\src\main\webapp
[INFO] jetty-9.3.6.v20151106
[INFO] 2 Spring WebApplicationInitializers detected on classpath
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Initializing Spring root WebApplicationContext
[WARNING] Failed startup of context o.e.j.m.p.JettyWebAppContext@2084e65a{/adsops,file:///E:/Projects/ADpost/ops/dev/src/main/webapp/,STARTING}{file:///E:/Projects/ADpost/ops/dev/src/main/webapp/}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'emailConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'mailSender.host' in value "${mailSender.host}"
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:372)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
        at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:443)
        at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:325)
        at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)
        at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:835)
        at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:530)
        at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:808)
        at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:342)
        at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1379)
        at org.eclipse.jetty.maven.plugin.JettyWebAppContext.startWebapp(JettyWebAppContext.java:323)
        at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1341)
        at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:772)
        at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:259)
        at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:517)
        at org.eclipse.jetty.maven.plugin.JettyWebAppContext.doStart(JettyWebAppContext.java:398)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
        at org.eclipse.jetty.server.handler.ContextHandlerCollection.doStart(ContextHandlerCollection.java:161)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:114)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:132)
        at org.eclipse.jetty.server.Server.start(Server.java:405)
        at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:106)
        at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:61)
        at org.eclipse.jetty.server.Server.doStart(Server.java:372)
        at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
        at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.startJetty(AbstractJettyMojo.java:460)
        at org.eclipse.jetty.maven.plugin.AbstractJettyMojo.execute(AbstractJettyMojo.java:328)
        at org.eclipse.jetty.maven.plugin.JettyRunMojo.execute(JettyRunMojo.java:170)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
        at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
        at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309)
        at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194)
        at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107)
        at org.apache.maven.cli.MavenCli.execute(MavenCli.java:993)
        at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:345)
        at org.apache.maven.cli.MavenCli.main(MavenCli.java:191)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
        at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
        at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
        at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'mailSender.host' in value "${mailSender.host}"
        at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174)
        at org.springframework.util.PropertyPlaceholderHelper.replacePlaceholders(PropertyPlaceholderHelper.java:126)
        at org.springframework.core.env.AbstractPropertyResolver.doResolvePlaceholders(AbstractPropertyResolver.java:236)
        at org.springframework.core.env.AbstractPropertyResolver.resolveRequiredPlaceholders(AbstractPropertyResolver.java:210)
        at org.springframework.context.support.PropertySourcesPlaceholderConfigurer$2.resolveStringValue(PropertySourcesPlaceholderConfigurer.java:172)
        at org.springframework.beans.factory.support.AbstractBeanFactory.resolveEmbeddedValue(AbstractBeanFactory.java:831)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1086)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:1066)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:585)
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:366)
        ... 65 more
[INFO] Started ServerConnector@522ece34{HTTP/1.1,[http/1.1]}{0.0.0.0:8888}
[INFO] Started @9079ms
[INFO] Started Jetty Server
然后我得到

HTTP ERROR: 503

    Problem accessing /adsops/user-management/login. Reason:

        Service Unavailable
我也尝试过使用jboss服务器部署我的项目。但在这种情况下,部署失败了


我已经搜索了http错误:503。据我所知,这是一个服务器问题。我是web应用程序开发新手。所以请帮我解决这个问题

你的问题似乎包含了答案:

[WARNING] Failed startup of context o.e.j.m.p.JettyWebAppContext@2084e65a{/adsops,file:///E:/Projects/ADpost/ops/dev/src/main/webapp/,STARTING}{file:///E:/Projects/ADpost/ops/dev/src/main/webapp/}
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'emailConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'mailSender.host' in value "${mailSender.host}"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:372)
无法解析值“${mailSender.host}”中的占位符“mailSender.host”

这意味着您没有指定相应的属性
mailssender.host
,并且您没有此属性的默认值。由于卸载的属性,未创建相应的bean:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'emailConfiguration': Injection of autowired dependencies failed; ...

如果指定默认值或要从配置(属性)文件加载的值,此问题将得到解决。

我使用属性文件中的参数值,但没有配置其类路径。我刚刚配置了类路径

@PropertySource("classpath:email.properties")

我认为重要的部分可能在
IllegalArgumentException中:无法解析值“${mailSender.host}”中的占位符“mailSender.host”
,因此请在模板/资源文件中查看此
mailSender.host
。可能没有这样的字段或格式是无效的。我使用的是属性文件,没有设置它的类路径。
@PropertySource("classpath:email.properties")