soa-面向服务项目搭建

发布于:2021-10-24 11:14:49

1.创建新的工作空间,指定maven 工厂配置





1.1指定tomcat






1.2选择你自己本地拥有的对应的tomcat版本







1.3选择对应的目录和jdk版本







2.新建maven 项目 soa_web_pro

2.1选择项目类型








2.2填写相应的项








2.3更改jdk为1.7





2.4更改org.eclipse.wst.common.project.facet.core.xml文件





2.5完成相应的目录结构








2.6修改pom 文件

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
com.fangjian.platform
soa_web_pro
war
0.0.1-SNAPSHOT
soa_web_pro Maven Webapp
http://maven.apache.org


3.2.4.RELEASE

3.2.4

1.6.6
1.2.17
1.1.33
1.6
2.5
3.0.1

UTF-8
UTF-8

UTF-8




org.springframework
spring-core
${spring.version}



org.springframework
spring-web
${spring.version}



org.springframework
spring-oxm
${spring.version}



org.springframework
spring-tx
${spring.version}



org.springframework
spring-webmvc
${spring.version}



org.springframework
spring-aop
${spring.version}



org.springframework
spring-jdbc
${spring.version}



org.springframework
spring-context-support
${spring.version}



org.springframework
spring-test
${spring.version}



org.springframework
spring-aspects
${spring.version}





org.mybatis
mybatis
${mybatis.version}



org.mybatis
mybatis-spring
1.2.2



mysql
mysql-connector-java
5.1.8




junit
junit
4.11
test




com.alibaba
druid
1.0.2



com.alibaba
fastjson
${fastjson.version}


org.codehaus.jackson
jackson-mapper-asl
1.9.13



net.sf.json-lib
json-lib
2.4
jdk15




commons-fileupload
commons-fileupload
1.3.1



commons-lang
commons-lang
${commons-lang.version}



org.apache.commons
commons-lang3
3.4



commons-codec
commons-codec
${commons-codec.version}



javax.servlet
jstl
1.2
runtime





log4j
log4j
${log4j.version}


org.slf4j
slf4j-api
${slf4j.version}


org.slf4j
slf4j-log4j12
${slf4j.version}





com.fangjian.framework
fangjee_generator
0.0.1-SNAPSHOT



com.ckeditor
ckeditor-java-core
3.5.3



org.freemarker
freemarker
2.3.22




jsptags
pager-taglib
2.0




com.ning
async-http-client
1.8.13


com.thoughtworks.xstream
xstream
1.4.5



org.apache.httpcomponents
httpclient-cache
4.3.5


org.apache.httpcomponents
httpmime
4.3.5



org.apache.httpcomponents
httpclient
4.3.5



org.apache.httpcomponents
fluent-hc
4.3.5



org.apache.httpcomponents
httpcore
4.3.3



commons-httpclient
commons-httpclient
${commons-httpclient.version}





net.sf.ehcache
ehcache
2.9.1



javax.servlet
servlet-api
2.5
provided



com.fasterxml.jackson.core
jackson-databind
2.6.0


dom4j
dom4j
1.6


org.jdom
jdom
1.1.3



org.codehaus.xfire
xfire-all
1.2.6


org.springframework
spring







soa_web_pro




org.apache.maven.plugins
maven-compiler-plugin

1.7
1.7
UTF-8



org.apache.maven.plugins
maven-resources-plugin

UTF-8









2.7修改pom 文件


xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">


contextConfigLocation
classpath:spring-mybatis.xml,classpath:spring-xfire.xml



org.springframework.web.context.ContextLoaderListener



encodingFilter
org.springframework.web.filter.CharacterEncodingFilter

encoding
UTF-8


forceEncoding
true



encodingFilter
/services/*
/*





xfireServlet
org.codehaus.xfire.spring.XFireSpringServlet


xfireServlet

/services/*






default
*.htm



default
*.css



default
*.gif



default
*.png



default
*.jpg



default
*.js


default
*.ico



default
*.swf



default
*.xap



default
*.docx


default
*.doc



404
/WEB-INF/jsp/error/404.jsp





3.添加配置文件,并修改对应的参数



4.对应的目录,新建对应的UserDao接口、UserMapping.xml、userService接口和它的实现、实体entry







UserDao







UserService






UserServiceImpl






UserMapping







5.运行打包


http://localhost:8080/soa_web_pro/services


运行效果










Run As ---->Maven clean----> 成功后


成功标志







--->Maven install


成功后获取soa_web_pro的.war包









复制到tomcatwebapps下运行tomcat启动报异常






解决办法。


到项目中复制mapping文件到tomcat? webapps下的


D: est omcat8082webappssoa_web_pro-0.0.1-SNAPSHOTWEB-INFclassescomliang






修改项目名称







重新启动tomcat。


6.新建项目soa_web_cus方法同上





web.xml 配置

xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">



contextConfigLocation
classpath:spring-mybatis.xml


spring监听器
org.springframework.web.context.ContextLoaderListener





characterEncodingFilter
org.springframework.web.filter.CharacterEncodingFilter

encoding
UTF-8


forceEncoding
true




characterEncodingFilter
/*





spring mvc servlet
springMvc
org.springframework.web.servlet.DispatcherServlet

spring mvc 配置文件
contextConfigLocation
classpath:spring-mvc.xml


activeReverseAjaxEnabled
true

1



springMvc
*.do




index.jsp






UserService







UserServiceImpl







测试类







7.运行报错





解决方案


java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener

















相关推荐

最新更新

猜你喜欢