2017-08-30 26 views
-2

我使用intellij IDE和Jetty服務器來創建和部署我的Spring應用程序。嘗試使用Jetty服務器加載Web應用程序時出現HTTP ERROR:503

我得到這個,當我運行

[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 [email protected]{/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 [email protected]{HTTP/1.1,[http/1.1]}{0.0.0.0:8888} 
[INFO] Started @9079ms 
[INFO] Started Jetty Server 

然後我嘗試以下網址

http://localhost:8888/adsops/user-management/login 

然後我得到

HTTP ERROR: 503 

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

     Service Unavailable 

我試圖加載網頁鍵入服務器也可以使用jboss服務器部署我的項目。但在這種情況下部署失敗。

我已經搜索了http錯誤:503。據我瞭解這是一個服務器問題。我是Web應用程序開發新手。所以請幫助我解決這個問題。

+1

我認爲重要的部分可能in'IllegalArgumentException:無法解析佔位符「mailSender.host」價值「$ {} mailSender.host」'所以看在你的模板/資源文件這個'mailSender.host '。也許沒有這樣的字段或格式無效 – varren

+0

我正在使用屬性文件而未設置其類路徑。 – sndu

回答

2

看來你的問題包含答案:

[WARNING] Failed startup of context [email protected]{/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) 

Could not resolve placeholder 'mailSender.host' in value "${mailSender.host}"

這意味着你沒有指定對應屬性mailSender.host,和你沒有這個默認值。由於空載特性的對應未創建的bean:

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

如果指定缺省值或值從裝載配置(屬性)文件,這個問題將得到解決。

-1

我正在使用屬性文件中的參數值而未配置其類路徑。我只是配置了類路徑。

@PropertySource("classpath:email.properties") 
相關問題