码迷,mamicode.com
首页 > Web开发 > 详细

idea eclipse web项目

时间:2017-03-28 22:02:28      阅读:390      评论:0      收藏:0      [点我收藏+]

标签:错误信息   oca   msi   monit   nal   file   jsp   rect   ati   

关于idea如何集成svn请看前一篇,这里主要说说我导入eclipse纯web项目遇到的错误以及解决方法。

(一)导入项目

技术分享

技术分享

导入项目后会有很多报错,原因是各种依赖没有引入。下面讲讲如何具体解决

1)处理Project

技术分享

如图显示1先new一个jdk环境,这个选择本地的就好

2则选择对应jdk版本的特性

3是选择编译后class文件输出的目录

2)处理Modules

Modeules是Project的子模块

修改src目录为Sources,resource为Resources

技术分享

修改编译输出路径(有没有发现这和之前的project一样哎,废话因为Modules是Project的子模块,此处是但Modules的Project所以这里的设置和前面是一样的)

技术分享

将eclipse的web项目的中lib文件里的jar引入到此项目中

技术分享

add一个web

技术分享

修改Path为你项目的web.xml的地址

技术分享

修改Web Resource Directory将其指向导入的web项目的WebContent路径技术分享

3)处理Libraries中的信息

向Libraries中添加jar,这里和Modules中Dependencies中的区别是他是模块共享的

此处添加的Tomcat中包含servlet的api的jar

技术分享

4)处理Artifacts

选择打war的模块

技术分享

此处的Output directory随便搞个地方都无所谓的

(二)配置容器,我这边是Tomcat

首先添加一个Tomcat

技术分享

Server基本不用做什么修改

Deployment这个地方需要注意下Application context默认是/,当项目启动时(以我本地为例),访问项目通过url:localhost:8080/index.html有没有觉得和正常的eclipse启动的不太一样?

没错,这边的端口号后面直接就是访问的页面的路径了,并没有带项目名。如果你想想eclipse那样的话只需修改Application context的值在/后写你的项目名即可。这时候访问地址就变成了localhost:8080/项目名/index.html

Logs配置的是选择输出的log

这么一个截图大概就能明白了

技术分享

(三)启动项目

这里我故意修改下我的数据库连接信息,让其报错。来直观体验下。

先贴下在eclipse中启动报错的样子

技术分享

看了后很直观,是哪边出错了。

现在贴下idea中一开始发现的错误的显示

 - -!图帖不了了,就直接copy了

INFO - Closing Root WebApplicationContext: startup date [Tue Mar 28 20:32:24 CST 2017]; root of context hierarchy
INFO - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@33526b60: defining beans [dataSource_1,sqlSessionFactory_1,mapperScannerConfigurer_1,dailyScanSendSalesStatementServiceImpl,flowOrderDailyStatisticsServiceImpl,interfaceDataServiceImpl,smsInterfaceMonitorSchedulerServiceImpl,org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0,dailyScanSendSalesStatementMapper,flowOrderDailyStatisticsMapper,interfaceDataMapper,smsInterfaceMonitorSchedulerMapper]; root of factory hierarchy
三月 28, 2017 8:32:25 下午 org.apache.catalina.loader.WebappClassLoaderBase clearReferencesJdbc
SEVERE: The web application [/sms] registered the JDBC driver [org.postgresql.Driver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
[2017-03-28 08:32:25,622] Artifact sms-interface-monitor:war exploded: Error during artifact deployment. See server log for details.
三月 28, 2017 8:32:31 下午 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory D:\development\tomcat\apache-tomcat-7.0.70\webapps\manager
三月 28, 2017 8:32:31 下午 org.apache.catalina.startup.TldConfig execute
INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
三月 28, 2017 8:32:31 下午 org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deployment of web application directory D:\development\tomcat\apache-tomcat-7.0.70\webapps\manager has finished in 104 ms

我发现了这么条信息Error during artifact deployment. See server log for details.

然后我翻到项目启动时打印的信息

D:\development\tomcat\apache-tomcat-7.0.70\bin\catalina.bat run
[2017-03-28 08:40:34,220] Artifact sms-interface-monitor:war exploded: Server is not connected. Deploy is not available.
Using CATALINA_BASE:   "C:\Users\Administrator\.IntelliJIdea2016.3\system\tomcat\Unnamed_sms-interface-monitor_2"
Using CATALINA_HOME:   "D:\development\tomcat\apache-tomcat-7.0.70"
Using CATALINA_TMPDIR: "D:\development\tomcat\apache-tomcat-7.0.70\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk1.7.0_17"
Using CLASSPATH:       "D:\development\tomcat\apache-tomcat-7.0.70\bin\bootstrap.jar;D:\development\tomcat\apache-tomcat-7.0.70\bin\tomcat-juli.jar"

我就去了C:\Users\Administrator\.IntelliJIdea2016.3\system\tomcat\Unnamed_sms-interface-monitor_2

进入到logs目录下就会看到一堆日志文件也就是(二)中最后的截图的样子

打开localhost.2017-03-28.log其中一段就是

 技术分享

(到家了,终于又可以贴图了)

这个打印的消息就是eclipse中打印的消息。也就是错误信息,起初,我觉得idea好不人性,看个错误还要这么费事。然后又看看了,原来错误信息可以在这里看的

 

技术分享

至此,在idea中搞个eclipse中的项目所遇到的问题基本都解决了。

idea eclipse web项目

标签:错误信息   oca   msi   monit   nal   file   jsp   rect   ati   

原文地址:http://www.cnblogs.com/vincentren/p/6636732.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!