我尝试在Heroku上托管我的应用程序,我的应用程序使用带有PostgreSql驱动程序的Wildfly 9.0.1。我按照网络教程, 但本教程默认只涵盖Wildfly,此时,我成功部署并在heroku上启动Wildfly,步骤如下:
在pom.xml上:
<!-- this plugin install Wildfly on HEROKU -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>unpack</id>
<phase>package</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-dist</artifactId>
<version>9.0.1.Final</version>
<type>zip</type>
<overWrite>false</overWrite>
<outputDirectory>target</outputDirectory>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>9.3-1103-jdbc41</version>
</dependency>
</dependencies>
</plugin>
<!-- tell application uses the above wildfly. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<outputDirectory>target/wildfly-9.0.1.Final/standalone/deployments</outputDirectory>
<warName>hktest</warName>
</configuration>
</plugin>
完成后,Heroku在Procfile上需要这一行(Procfile是一种机制,用于声明应用程序运行的命令)。
web: target/wildfly-9.0.1.Final/bin/standalone.sh -Djboss.http.port=$PORT -b 0.0.0.0
现在,我需要配置postgreSql驱动程序并为Wildfly配置数据源,我该怎么做?在第一个插件中我把驱动程序 依赖,在日志中,我看到是否下载了这个airfact,但需要在Wildfly上安装。
答案 0 :(得分:0)
是的,你需要安装驱动程序,也许这个教程很有用: Configure wildfly datasource 或这个: This use the Wildfly console to install the driver