Hi. I am using glassfish-embedded-all.jar to start up an embedded EJb container. At certain point I want to look up a JDBC DataSource configured in the domain. The lookup succeds but in the background I get the exception:
[code]
Jul 2, 2010 10:45:06 AM com.sun.enterprise.connectors.service.ConnectorConfigurationParserServiceImpl getFileContent
WARNING: Exception while performing resource-adapter's security permission check :
java.io.FileNotFoundException: /home/rafal/EclipseWorkspaces/Workspace/GlassFishTest/gfembed3601547759702059688tmp/config/server.policy (No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:106)
at java.io.FileReader.<init>(FileReader.java:55)
at com.sun.enterprise.connectors.service.ConnectorConfigurationParserServiceImpl.getFileContent(ConnectorConfigurationParserServiceImpl.java:133)
at com.sun.enterprise.connectors.service.ConnectorConfigurationParserServiceImpl.getSecurityPermissionSpec(ConnectorConfigurationParserServiceImpl.java:92)
at com.sun.enterprise.connectors.ConnectorRuntime.getSecurityPermissionSpec(ConnectorRuntime.java:495)
at com.sun.enterprise.connectors.service.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:239)
at com.sun.enterprise.connectors.service.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:338)
at com.sun.enterprise.connectors.ConnectorRuntime.createActiveResourceAdapter(ConnectorRuntime.java:327)
at com.sun.enterprise.connectors.service.ConnectorService.loadDeferredResourceAdapter(ConnectorService.java:164)
at com.sun.enterprise.connectors.service.ConnectorService.loadResourcesAndItsRar(ConnectorService.java:133)
at com.sun.enterprise.connectors.service.ConnectorService.checkAndLoadPool(ConnectorService.java:307)
at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl.createConnectorResource(ConnectorResourceAdminServiceImpl.java:91)
at com.sun.enterprise.connectors.ConnectorRuntime.createConnectorResource(ConnectorRuntime.java:266)
at com.sun.enterprise.resource.deployer.JdbcResourceDeployer.deployResource(JdbcResourceDeployer.java:107)
at org.glassfish.javaee.services.ResourceProxy.create(ResourceProxy.java:84)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:432)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.test.EmbeddedEJBTest.main(EmbeddedEJBTest.java:31)
[/code]
The code is:
[code]
EJBContainer ejb = null;
try {
Map<Object, Object> properties = new HashMap<Object, Object>();
properties.put(EJBContainer.MODULES, "TestBeanArchive");
properties.put("org.glassfish.ejb.embedded.glassfish.installation.root", "glassfish");
ejb = EJBContainer.createEJBContainer(properties);
Context ic = ejb.getContext();
DataSource ds = (DataSource) ic.lookup("jdbc/DS");
System.out.println("DataSource looked up: " + ds);
DatabaseMetaData md = ds.getConnection().getMetaData();
System.out.println("Database is: " + md.getDatabaseProductName() + ", " + md.getDatabaseMajorVersion() + ", " + md.getDatabaseMinorVersion());
} finally {
if (ejb != null) {
ejb.close();
}
}
[/code]
Can anyone advise how to get rid of this problem? How can I tell GF to copy this file from domains/domain1/config/server.policy to its temp directory?
szcyp
[Message sent by forum member 'szczyp']
http://forums.java.net/jive/thread.jspa?messageID=476629