这是我的 glassfish-resources.xml:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Resource Definitions//EN" "http://glassfish.org/dtds/glassfish-resources_1_5.dtd">
<resources>
<jdbc-connection-pool res-type="javax.sql.DataSource"
datasource-classname="org.h2.jdbcx.JdbcDataSource"
pool-resize-quantity="1" max-pool-size="5" steady-pool-size="0"
statement-timeout-in-seconds="60" name="jdbc/test_pool">
<property name="driverClass" value="org.h2.Driver"/>
<property name="URL" value="jdbc:h2:D:\test\test;IFEXISTS=TRUE;AUTO_SERVER=TRUE"/>
<property name="User" value="root"/>
<property name="Password" value="root"/>
</jdbc-connection-pool>
<jdbc-resource object-type="system-all" enabled="true" jndi-name="jdbc/test" pool-name="jdbc/test_pool" />
</resources>
通过m2eclipse使用maven glassfish插件将war部署到服务器后,当我这样做时,asadmin> list-jdbc-connection-pools
我的连接池不在列表中。我真的迷路了
编辑。
asadmin add-resources
出于某种原因工作正常
Glassfish 3.1.2(构建 23)
POM.xml:
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>maven-embedded-glassfish-plugin</artifactId>
<version>3.1.1</version>
<type>maven-plugin</type>
</dependency>
<plugin>
<groupId>org.glassfish.maven.plugin</groupId>
<artifactId>maven-glassfish-plugin</artifactId>
<version>2.1</version>
<configuration>
<glassfishDirectory>d:\glassfish3</glassfishDirectory>
<user>admin</user>
<passwordFile>d:\password.txt</passwordFile>
<debug>true</debug>
<echo>true</echo>
<domain>
<name>domain1</name>
<adminPort>4848</adminPort> <!-- mandatory for mvn glassfish:deploy -->
</domain>
<components>
<component>
<name>${project.artifactId}</name>
<artifact>${project.build.directory}/${project.build.finalName}.war</artifact>
</component>
</components>
</configuration>
</plugin>
EDIT2 问题已解决。谢谢大家!!!