求教一个tomcat解决跨域问题的问题

开源技术基础:教你如何熟练使用TOMCAT_Web服务器_绿色第一站
&|&&|&&|&&|&&|&&|&&|&&|&&|&&|&&|&&|&
&&>>&&>>&&>>&&>>&
开源技术基础:教你如何熟练使用TOMCAT
作者:佚名
文章来源:Onegreen.Net
浏览次数:(载入中...)
更新时间:
   一、小猫TOMCAT其实很可爱  2003年底,我换公司了,同样也换了WEBAPP,TOMCAT出现在我的面前(以前使用weblogic),我有点茫然,免费的东西真的能用的好么?担心ING&&(其实是在火星呆太久)出门一打听,原来此猫出自名门-jakarta项目,2001年度最具创新的java产品(Most Innovative Java Product),又有JAVA的老大SUN的力捧(官方推荐的servlet和jsp容器),以后就靠它吃饭了。不说二话,搞起来先:  1、 安装  TOMCAT最新版本是5.0.29(http://jakarta.apache.org/site/binindex.cgi)  如果在WINDOWS下它可以自动找到你的JDK或者set JAVA_HOME=c:/jdk  在LINUX下需要先解压,然后设置JAVA_HOME  export JAVA_HOME=/usr/local/jdk  2、 RUN  设置完毕后就可以运行tomcat服务器了,进入tomcat的bin目录,WINDOWS下用startup启动tomcat,linux下用startup.sh,相应的关闭tomcat的命令为shutdown和shutdown.sh。  启动服务后在浏览器里输入http://localhost:8080/来测试一下  3、 目录结构  Bin:存放启动和关闭tomcat脚本。  Conf:包含不同的配置文件,server.xml(Tomcat的主要配置文件)。  Work:存放jsp编译后产生的class文件。  Webapp:存放应用程序示例,以后你要部署的应用程序也要放到此目录。  Logs:存放日志文件  Comm./server/shared:这三个文件夹下的LIB文件夹放jar文件。  1、 配置server.xml文件  没有什么好说的,看TOMCAT的文档比较有用,这里提供一些主要的东西吧。  元素名  属性  解释  server  port  指定一个端口,这个端口负责监听关闭tomcat的请求  shutdown  指定向端口发送的命令字符串  service  name  指定service的名字  Connector(表示客户端和service之间的连接)  port  指定服务器端要创建的端口号,并在这个断口监听来自客户端的请求  minProcessors  服务器启动时创建的处理请求的线程数  maxProcessors  最大可以创建的处理请求的线程数  enableLookups  如果为true,则可以通过调用request.getRemoteHost()进行DNS查询来得到远程客户端的实际主机名,若为false则不进行DNS查询,而是返回其ip地址  redirectPort  指定服务器正在处理http请求时收到了一个SSL传输请求后重定向的端口号  acceptCount  指定当所有可以使用的处理请求的线程数都被使用时,可以放到处理队列中的请求数,超过这个数的请求将不予处理  connectionTimeout  指定超时的时间数(以毫秒为单位)  Engine(表示指定service中的请求处理机,接收和处理来自Connector的请求)  defaultHost  指定缺省的处理请求的主机名,它至少与其中的一个host元素的name属性值是一样的  Context(表示一个web应用程序,通常为WAR文件,关于WAR的具体信息见servlet规范)  docBase  应用程序的路径或者是WAR文件存放的路径  path  表示此web应用程序的url的前缀,这样请求的url为http://localhost:8080/path/**[1]&&
关 键 字:
相关文章:
上一篇文章: 下一篇文章:
子栏目导航
&&&&&&&&&&&&&17:42 提问
新人求教tomcat启动报错的一些问题
十二月 16, :16 下午 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor E:\briup1\apache-tomcat-7.0.65-windows-x64\apache-tomcat-7.0.65\conf\Catalina\localhost\bicycleRent1.xml
十二月 16, :16 下午 org.apache.catalina.startup.HostConfig deployDescriptor
警告: A docBase E:\briup1\apache-tomcat-7.0.65-windows-x64\apache-tomcat-7.0.65\webapps\bicycleRent1 inside the host appBase has been specified, and will be ignored
这是最开始启动的警告
我在tomcat中的service.xml中
Context docBase="bicycleRent1" path="/bicycleRent1" reloadable="true" source="org.eclipse.jst.jee.server:bicycleRent1"
把path的路径换成了绝对路径E:/briup1/apache-tomcat-7.0.65-windows-x64/apache-tomcat-7.0.65/webapps/bicycleRent1
重启后这个警告消失了,个人认为这是‘/’所代表的路径的问题不知道'/'代表什么。
下面是个错误:十二月 16, :23 下午 org.apache.catalina.core.StandardContext listenerStart
严重: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
我已经把这个jar加入webConent中的lib了,buildpath中也能找到,虽然把jar包放进tomcat的lib中能解决,但是我想是想请教大神,弄清楚是怎么回事
按赞数排序
其他相似问题求教:maven工程部署到tomcat出现问题八月20,下午org.apache.catalina.startup.CatalinastartSEVERE:Therequired
求教:maven工程部署到tomcat出现问题
八月 20, :39 下午 org.apache.catalina.startup.Catalina start
SEVERE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: Failed to start component [StandardServer[8005]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.startup.Catalina.start(Catalina.java:689)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:321)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:455)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardService[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:739)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 7 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154)
at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 9 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131)
at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:300)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
... 11 more
八月 20, :39 下午 org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-apr-8080"]
八月 20, :39 下午 org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["ajp-apr-8009"]
八月 20, :39 下午 org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service Catalina
八月 20, :39 下午 org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-apr-8080"]
八月 20, :39 下午 org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["ajp-apr-8009"]
八月 20, :39 下午 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
14:37:39 [INFO] org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:862) : Closing Root WebApplicationContext: startup date [Thu Aug 20 14:37:19 CST 2015]; root of context hierarchy
八月 20, :39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/emp] registered the JDBC driver [oracle.jdbc.driver.OracleDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
八月 20, :39 下午 org.apache.catalina.loader.WebappClassLoader clearReferencesThreads
SEVERE: The web application [/emp] appears to have started a thread named [Timer-0] but has failed to stop it. This is very likely to create a memory leak.
解决方案二:
导致上面的原因可能有多种情况。
你直接通过 maven打包成 war包(mvn clean install) 放到tomcat中能运行。如果能运行则可能是你IDE环境的问题,那么分别清理下项目和tomcat。
如果打包都不成功,则需要注意pom.xml文件,根据具体错误再找问题了
【云栖快讯】数据库技术天团集体亮相,分享一线生产实践经验,告诉你踩过的坑、走过的路,都是老司机,靠谱!干货分享,不可错过!&&
弹性可伸缩的计算服务,助您降低 IT 成本,提升运维效率
稳定可靠、可弹性伸缩的在线数据库服务,全球最受欢迎的开源数据库之一
6款热门基础云产品6个月免费体验;2款产品1年体验;1款产品2年体验
开发者常用软件,超百款实用软件一站式提供

我要回帖

更多关于 tomcat中文乱码问题 的文章

 

随机推荐