现在的位置: 首页 > 综合 > 正文

Linux配置Spatial Data Server的WebServer(Tomcat)

2013年10月05日 ⁄ 综合 ⁄ 共 7074字 ⁄ 字号 评论关闭

一:Linux安装部署Apache Tomcat

1:先下载相应的Apache Tomcat和JDK
2:安装JDK 参考:http://blog.csdn.net/linghe301/article/details/7409979
3:修改权限、解压缩apache-tomcat-7.0.11.tar.gz

tar -xvf apache-tomcat-7.0.11.tar.gz 

4:解压缩完毕后会看到当前目录已经生成好了一个同名文件夹:apache-tomcat-7.0.11

[root@redhat6 home]# ll
total 89884
dr-xr-xr-x. 12 oracle    oinstall      8192 May 10  2011 aaa
drwx------. 25 ags       ags           4096 Jun 16 00:37 ags
drwxr-xr-x.  9 root      root          4096 Jun 16 22:33 apache-tomcat-7.0.11
-rwxrwxr-x.  1 root      root       7174582 Aug 12  2012 apache-tomcat-7.0.11.tar.gz
drwx------.  5 arcsde          507     4096 Jun 15 21:30 arcsde
drwx------.  4 esrichina esrichina     4096 Jun 15 13:32 esrichina
drwxr-xr-x. 10 root      root          4096 Jun 16 22:29 jdk1.6.0_20
-rwxrwxr-x.  1 root      root      84796967 Jun  6  2010 jdk-6u20-linux-i586.bin
drwx------.  2 root      root         16384 Jun 15 07:45 lost+found
drwx------.  4 mockbuild       506     4096 Jun 15 13:57 mockbuild
drwx------.  6 ora       ora           4096 Jun 16 04:01 ora
drwx------. 25 oracle    oracle        4096 Jun 16 21:15 oracle
drwx------. 10 sds oinstall 4096 Jun 16 21:45 sds
drwxr-xr-x. 3 root root 4096 Jun 15 21:37 soft

5:添加环境变量使之生效

[root@redhat6 ~]# vi .bash_profile
[root@redhat6 ~]# . ./.bash_profile
[root@redhat6 ~]# echo $TOMCAT_HOME
/home/apache-tomcat-7.0.11
[root@redhat6 ~]# source /etc/profile

6:启动服务

[root@redhat6 bin]# ./startup.sh
Using CATALINA_BASE:   /home/apache-tomcat-7.0.11
Using CATALINA_HOME:   /home/apache-tomcat-7.0.11
Using CATALINA_TMPDIR: /home/apache-tomcat-7.0.11/temp
Using JRE_HOME:        /home/jdk1.6.0_20
Using CLASSPATH:       /home/apache-tomcat-7.0.11/bin/bootstrap.jar:/home/apache                                                                                                             -tomcat-7.0.11/bin/tomcat-juli.jar

7:查看网页
http://192.168.100.203:8080/
能够看到到相关网页即可。

相关问题:如果进入manger提示错误

You are not authorized to view this page.

If you have already configured the Manager application to allow access and you have used your browsers back button, used a saved book-mark or similar then you may have triggered the cross-site request forgery (CSRF) protection that has been enabled for the HTML interface of the Manager application. You will need to reset this protection by returning to the main Manager page. Once you return to this page, you will be able to continue using the Manager appliction's HTML interface normally. If you continue to see this access denied message, check that you have the necessary permissions to access this application.

If you have not changed any configuration files, please examine the file conf/tomcat-users.xml in your installation. That file must contain the credentials to let you use this webapp.

For example, to add the manager-gui role to a user named tomcat with a password of s3cret, add the following to the config file listed above.

<role rolename="manager-gui"/>
<user username="tomcat" password="s3cret" roles="manager-gui"/>
Note that for Tomcat 7 onwards, the roles required to use the manager application were changed from the single manager role to the following four roles. You will need to assign the role(s) required for the functionality you wish to access.

manager-gui - allows access to the HTML GUI and the status pages
manager-script - allows access to the text interface and the status pages
manager-jmx - allows access to the JMX proxy and the status pages
manager-status - allows access to the status pages only
The HTML interface is protected against CSRF but the text and JMX interfaces are not. To maintain the CSRF protection:

Users with the manager-gui role should not be granted either the manager-script or manager-jmx roles.
If the text or jmx interfaces are accessed through a browser (e.g. for testing since these interfaces are intended for tools not humans) then the browser must be closed afterwards to terminate the session.
For more information - please see the Manager App HOW-TO.

需要修改$TOMCAT_HOME/conf/tomcat-users.xml添加如下

<tomcat-users>
    <role rolename="tomcat"/>
    <role rolename="role1"/>
    <role rolename="manager"/>
    <role rolename="admin"/>
    <role rolename="admin-gui"/>
    <role rolename="admin-script"/>
    <role rolename="manager-gui"/>
    <role rolename="manager-script"/>
    <role rolename="manager-jmx"/>
    <role rolename="manager-status"/> 
    <user username="tomcat" password="tomcat" roles="admin,manager,role1,tomcat,admin-gui,admin-script,manager-gui,manager-script,manager-jmx,manager-status" />
</tomcat-users>

重启也下服务即可

二:将Web应用部署到Tomcat上

[sds@localhost java]$ pwd
/home/sds/arcgis/SDS10.1/java
[sds@localhost java]$ ll
total 27160
-rwxr-xr-x  1 sds oinstall 27742110 Apr 20 13:55 arcgis.war
drwxr-xr-x  2 sds oinstall     4096 Jun  9 01:58 bin
-rwxr-xr-x  1 sds oinstall      340 Apr 20 12:19 clientaccesspolicy.xml
-rwxr-xr-x  1 sds oinstall      222 Apr 20 12:19 crossdomain.xml
drwxrwxr-x 11 sds oinstall     4096 Jun  9 01:58 help
drwxr-xr-x  2 sds oinstall     4096 Jun  9 01:58 License
drwxrwxr-x  3 sds oinstall     4096 Jun  9 01:58 REST
drwxr-xr-x  3 sds oinstall     4096 Jun  9 01:58 Support
drwxr-xr-x  2 sds oinstall     4096 Jun  9 02:00 sysgen
-rwxr-xr-x  1 sds oinstall     1286 Jun  9 01:58 uninstall_ArcGISSpatialDataSerer

将SDS文件里面的arcgis.war拷贝到TOMCAT的webapps文件夹中

[root@redhat6 webapps]# cp /home/sds/arcgis/SDS10.1/java/arcgis.war  /home/apache-tomcat-7.0.11/webapps

三:注册Spatial Data Server lic

注册有两种选择:

第一种就是使用浏览器来注册,非常简单,但有一个问题

当用户执行http://192.168.205.135:8080/arcgis/admin,系统会提示,不能在其他客户端执行该网站,必须在本机(Spatial Data Sever安装的机器上)执行

Error
ArcGIS Spatial Data Server-The License file does not exist or is inaccessible. Go to Http://localhost:8080/arcgis/admin/authorizeSDS to authosize SDS.

code :580

附加说明不同WebServer的端口号不一样

Tomcat = 8080
WebSphere = 9080
WebLogic = 7001

第二种可以参考:http://resources.arcgis.com/en/help/install-guides/arcgis-spatial-data-server-java-unix/10.1/index.html#/without_a_web_browser/01pw0000001q000000/

注册之后就可以看到相关的信息了

ArcGIS REST Services Directory
Home  >  admin
JSON
Site Root - /

Server Type: Java SDS
Current Version: 10.1
Resources:	datasources	services

四:配置数据源

如果我们发布的服务需要连接数据库信息,我们需要将相关的信息添加上去web.xml里面

[root@localhost conf]# pwd
/home/apache-tomcat-7.0.11/conf
[root@localhost conf]# ll
total 100
drwxr-xr-x 3 root root  4096 Jun  9 02:06 Catalina
-rw------- 1 root root 11620 Mar 10  2011 catalina.policy
-rw------- 1 root root  4979 Mar 10  2011 catalina.properties
-rw------- 1 root root  1394 Mar 10  2011 context.xml
-rw------- 1 root root  3152 Mar 10  2011 logging.properties
-rw------- 1 root root  6503 Mar 10  2011 server.xml
-rw------- 1 root root  2026 Jun  9 02:05 tomcat-users.xml
-rw------- 1 root root 52060 Mar 10  2011 web.xml

不同的数据库是不一样的

以oracle数据库为例

<Context>
    <Resource name="jdbc/oraservername_osid_orausername" 
              auth="Container"
              type="javax.sql.DataSource" 
              driverClassName="oracle.jdbc.OracleDriver"
              url="jdbc:oracle:thin:@oraservername:1521:osid"
              username="orausername" 
              password="0rapassword123" 
              maxActive="20" 
              maxIdle="10"
              maxWait="-1"/>
</Context>

下面仍然是oracle 但是使用了jdbc连接池

<Context>
    <Resource name="jdbc/oraservername_osid_orausername" 
              factory="org.apache.tomcat.jdbc.pool.DataSourceFactory" 
              driverClassName="oracle.jdbc.driver.OracleDriver"
              url="jdbc:oracle:thin:@oraservername:1521:osid" 
              username="orausername"
              password="0rapassword123"
              initialSize="20"
              maxActive="80" 
              maxIdle = "30" 
              minIdle="20"
              timeBetweenEvictionRunsMillis="30000"
              minEvictableIdleTimeMillis="60000"
              testOnBorrow="true"
              validationQuery="SELECT 1 FROM DUAL" 
              validationInterval="30000" 
              removeAbandoned="true"
              removeAbandonedTimeout="60" 
              logAbandoned="true" 
              abandonWhenPercentageFull="60"
              jdbcInterceptors="org.apache.tomcat.jdbc.pool.interceptor.ResetAbandonedTimer"/>
</Context>

如果用户是postgreSQL或者DB2可以参考:http://resources.arcgis.com/en/help/install-guides/arcgis-spatial-data-server-java-unix/10.1/index.html#/Data_source_configuration_for_Java_when_using_an_Apache_Tomcat_web_server/01pw00000017000000/

 -------------------------------------------------------------------------------------------------------
版权所有,文章允许转载,但必须以链接方式注明源地址,否则追究法律责任!
Blog:               http://blog.csdn.net/linghe301
Weibo:            http://www.weibo.com/linghe301

------------------------------------------------------------------------------------------------------

抱歉!评论已关闭.