我正在使用GlassFish 3.0.1嵌入Java EE 5应用程序。我已经可以部署它(在没有特定配置的情况下使用时),但是当尝试使用domain.xml运行服务器(基本上是JAAS信息)时,我收到此错误:
java.lang.IllegalArgumentException: URI is not absolute
我的代码是这样的(错误指向最后一行):
Server.Builder builder = new Server.Builder("ipc");
EmbeddedFileSystem.Builder efsb = new EmbeddedFileSystem.Builder();
File domainDir = new File( "domains/ipc-domain" );
File domainXML = new File( domainDir.getAbsoluteFile(), "config/domain.xml" );
efsb.instanceRoot( domainDir.getAbsoluteFile() );
efsb.configurationFile( domainXML.getAbsoluteFile() );
EmbeddedFileSystem efs = efsb.build();
builder.embeddedFileSystem(efs);
//Trying to set variable used at domain.xml (blind shot)
Properties props = new Properties();
props.setProperty( "com.sun.aas.instanceRoot" , domainDir.toURI().toString());
Server server = builder.build( props );
我的domain.xml(特定部分)有:
<domain log-root="${com.sun.aas.instanceRoot}/logs" application-root="${com.sun.aas.instanceRoot}/applications" version="10.0">
<system-applications/>
<applications>
<application context-root="/IPC" location="${com.sun.aas.instanceRoot}/applications/IPC/" name="IPC" object-type="user">
<property name="keepSessions" value="false"></property>
<property name="defaultAppName" value="IPC"></property>
<module name="IPC">
<engine sniffer="ejb"></engine>
<engine sniffer="security"></engine>
<engine sniffer="jpa"></engine>
<engine sniffer="web"></engine>
</module>
</application>
</applications>
<resources>
<jdbc-connection-pool pool-resize-quantity="1" datasource-classname="org.apache.derby.jdbc.ClientDataSource" max-pool-size="2" res-type="javax.sql.DataSource" steady-pool-size="1" name="ipc-pool">
<property name="PortNumber" value="1527"></property>
<property name="ServerName" value="0.0.0.0"></property>
<property name="User" value="app"></property>
<property name="Password" value="root"></property>
<property name="DatabaseName" value="IPC"></property>
</jdbc-connection-pool>
<jdbc-resource pool-name="ipc-pool" jndi-name="jdbc/IPC"></jdbc-resource>
</resources>
我已经尝试更改与“$ {com.sun.aas.instanceRoot}”变量相关的部分,但后来我对URI错误的变化很小。有什么见解吗?