我在使用this教程在Openshift應用程序上安裝Geoserver。問題是Geoserver(.war)運行時,我必須從應用程序中刪除src文件夾和pom.xml,但我也需要在那裏開發一個應用程序。如何在Openshift上部署戰爭和應用程序
那麼,如何在WAR運行的同時保留pom.xml和src文件夾(我真的需要刪除這些東西才能使戰爭正常運行)?它甚至有可能嗎?
隨着src文件夾並pom.xml中我收到Openshift這樣的響應:
remote: [INFO] ---------- --------------------------------------------------------------
remote: [INFO] Building test 1.0
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO]
remote: [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) @ test ---
remote: [INFO]
remote: [INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ test ---
remote: [debug] execute contextualize
remote: [INFO] Using 'UTF-8' encoding to copy filtered resources.
remote: [INFO] Copying 1 resource
remote: [INFO]
remote: [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ test ---
remote: [INFO] Nothing to compile - all classes are up to date
remote: [INFO]
remote: [INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ test ---
remote: [debug] execute contextualize
remote: [INFO] Using 'UTF-8' encoding to copy filtered resources.
remote: [INFO] skip non existing resourceDirectory /var/lib/openshift/56f18c457628e1639500003d/app-root/runtime/repo/src/test/resources
remote: [INFO]
remote: [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ test ---
remote: [INFO] No sources to compile
remote: [INFO]
remote: [INFO] --- maven-surefire-plugin:2.10:test (default-test) @ test ---
remote: [INFO] Tests are skipped.
remote: [INFO]
remote: [INFO] --- maven-war-plugin:2.1.1:war (default-war) @ test ---
remote: [INFO] Packaging webapp
remote: [INFO] Assembling webapp [test] in [/var/lib/openshift/56f18c457628e1639500003d/app-root/runtime/repo/target/test]
remote: [INFO] Processing war project
remote: [INFO] Copying webapp resources [/var/lib/openshift/56f18c457628e1639500003d/app-root/runtime/repo/src/main/webapp]
remote: [INFO] Webapp assembled in [93 msecs]
remote: [INFO] Building war: /var/lib/openshift/56f18c457628e1639500003d/app-root/runtime/repo/webapps/ROOT.war
remote: [INFO] WEB-INF/web.xml already added, skipping
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] BUILD SUCCESS
remote: [INFO] ------------------------------------------------------------------------
remote: [INFO] Total time: 4.278s
remote: [INFO] Finished at: Tue Mar 22 14:31:40 EDT 2016
remote: [INFO] Final Memory: 8M/111M
remote: [INFO] ------------------------------------------------------------------------
remote: Preparing build for deployment
remote: Deployment id is a3cec3f4
remote: Activating deployment
remote: Starting Postgres cartridge
remote: Postgres started
remote: Emptying tmp dir: /var/lib/openshift/56f18c457628e1639500003d/jbossews//tmp/Geotools
remote: Starting jbossews cartridge
remote: Found 127.3.185.129:8080 listening port
remote: -------------------------
remote: Git Post-Receive Result: success
remote: Activation status: success
remote: Deployment completed with status: success
我的pom.xml的是默認的pom.xml是Openshift用品:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>test</groupId>
<artifactId>test</artifactId>
<packaging>war</packaging>
<version>1.0</version>
<name>test</name>
<repositories>
<repository>
<id>eap</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>eap</id>
<url>http://maven.repository.redhat.com/techpreview/all</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.6</maven.compiler.source>
<maven.compiler.target>1.6</maven.compiler.target>
</properties>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.2-1003-jdbc4</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.25</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
<scope>provided</scope>
</dependency>
</dependencies>
<profiles>
<profile>
<!-- When built in OpenShift the 'openshift' profile will be used when
invoking mvn. -->
<!-- Use this profile for any OpenShift specific customization your app
will need. -->
<!-- By default that is to put the resulting archive into the 'webapps'
folder. -->
<!-- http://maven.apache.org/guides/mini/guide-building-for-different-environments.html -->
<id>openshift</id>
<build>
<finalName>test</finalName>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<outputDirectory>webapps</outputDirectory>
<warName>ROOT</warName>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
POSDATA:我知道如何讓戰爭在自己的背景下運行(例如http://test-testdomain.rhcloud.com/war/)。
更新:這裏是我的rhc tail -a geoserver
==> app-root/logs/postgresql.log <==
2016-03-23 12:51:43 GMT LOG: shutting down
2016-03-23 12:51:43 GMT LOG: database system is shut down
2016-03-23 12:52:01 GMT LOG: could not bind socket for statistics collector: Permission denied
2016-03-23 12:52:01 GMT LOG: trying another address for the statistics collector
2016-03-23 12:52:01 GMT LOG: could not bind socket for statistics collector: Cannot assign requested address
2016-03-23 12:52:01 GMT LOG: disabling statistics collector for lack of working socket
2016-03-23 12:52:01 GMT WARNING: autovacuum not started because of misconfiguration
2016-03-23 12:52:01 GMT HINT: Enable the "track_counts" option.
2016-03-23 12:52:01 GMT LOG: database system was shut down at 2016-03-23 12:51:43 GMT
2016-03-23 12:52:01 GMT LOG: database system is ready to accept connections
==> app-root/logs/jbossews.log <==
Mar 23, 2016 8:52:49 AM org.geoserver.GeoserverInitStartupListener contextDestroyed
INFO: Cleaned up javabean caches
Mar 23, 2016 8:52:50 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/geoserver] registered the JDBC driver [org.hsqldb.jdbc.JDBCDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Mar 23, 2016 8:52:50 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/56f28b760c1e66c08b000209/app-root/runtime/dependencies/jbossews/webapps/geoserver.war has finished in 40,390 ms
Mar 23, 2016 8:52:50 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-127.3.223.1-8080"]
Mar 23, 2016 8:52:50 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 44333 ms
而且,我已經檢查了$ {} OPENSHIFT_JBOSSEWS_DIR web應用,和我有geoserver.war
和ROOT.war
。
更新2:觸摸命令,我再次rhc til -a geoserver
後得到:
==> app-root/logs/postgresql.log <==
2016-03-23 14:46:22 GMT LOG: shutting down
2016-03-23 14:46:22 GMT LOG: database system is shut down
2016-03-23 14:46:40 GMT LOG: could not bind socket for statistics collector: Permission denied
2016-03-23 14:46:40 GMT LOG: trying another address for the statistics collector
2016-03-23 14:46:40 GMT LOG: could not bind socket for statistics collector: Cannot assign requested address
2016-03-23 14:46:40 GMT LOG: disabling statistics collector for lack of working socket
2016-03-23 14:46:40 GMT WARNING: autovacuum not started because of misconfiguration
2016-03-23 14:46:40 GMT HINT: Enable the "track_counts" option.
2016-03-23 14:46:40 GMT LOG: database system was shut down at 2016-03-23 14:46:22 GMT
2016-03-23 14:46:40 GMT LOG: database system is ready to accept connections
==> app-root/logs/jbossews.log <==
Mar 23, 2016 10:47:54 AM org.geoserver.GeoserverInitStartupListener contextDestroyed
INFO: Cleaned up javabean caches
Mar 23, 2016 10:47:57 AM org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
SEVERE: The web application [/geoserver] registered the JDBC driver [org.hsqldb.jdbc.JDBCDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
Mar 23, 2016 10:47:57 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deployment of web application archive /var/lib/openshift/56f28b760c1e66c08b000209/app-root/runtime/dependencies/jbossews/webapps/geoserver.war has finished in 68,308 ms
Mar 23, 2016 10:47:57 AM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-127.3.223.1-8080"]
Mar 23, 2016 10:47:57 AM org.apache.catalina.startup.Catalina start
INFO: Server startup in 72395 ms
但我不能得到利用Geoserver(WAR)時運行,如果我有src文件夾和pom.xml中。 –
@LadyPeanut噢,對不起,我沒有注意到的是,指南中的庫只是提供了WAR神器和一些示例數據,我認爲這是源代碼。那麼你的意圖究竟是什麼?在同一個設備上部署geoserver和你的應用程序?或只是geoserver? – saljuama
我想在同一個齒輪上使用geoserver和我自己的應用程序(來自源代碼) –