Skip to main content

[Glassfish embedded] Can't get latest 3.1 builds working

2 replies [Last post]
andersaab
Offline
Joined: 2009-12-22

Hi everybody
I am trying to get a simple test project (one jpa2 entity and one ejb) running on the latest builds (b19 as we speak).

I initialize the container like this:
---
Map properties = new HashMap();
properties.put(EJBContainer.MODULES, new File("target/classes"));
properties.put("org.glassfish.ejb.embedded.glassfish.instance.root", "./src/test/glassfish");
properties.put(EJBContainer.APP_NAME, "myapp");

container = EJBContainer.createEJBContainer(properties);
---

And ./src/test/glassfish contains config/ which contains domain.xml. This structure worked with 3.0. The domain.xml is copied from a 3.1 installation.

The first problem I encounter is this error message:

13.sep.2010 14:14:50 com.sun.enterprise.v3.services.impl.LogManagerService postConstruct
WARNING: C:\Dev\workspace-admin\simple\gfembed2376540396315183300tmp\config\logging.properties not found, creating new file from template.
FAILED CONFIGURATION: @BeforeSuite setUp
javax.ejb.EJBException: No EJBContainer provider available
Provider named org.glassfish.ejb.embedded.EJBContainerProviderImpl threw unexpected exception at create EJBContainer:
java.lang.RuntimeException
java.lang.RuntimeException: java.lang.RuntimeException: org.jvnet.hk2.component.ComponentException: problem initializing: null
at org.glassfish.api.embedded.Server.(Server.java:290)
at org.glassfish.api.embedded.Server.(Server.java:68)
at org.glassfish.api.embedded.Server$Builder.build(Server.java:178)
at org.glassfish.api.embedded.Server$Builder.build(Server.java:160)
at org.glassfish.ejb.embedded.EJBContainerProviderImpl.init(EJBContainerProviderImpl.java:163)
at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:122)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:120)
at no.evote.SimpleServiceTest.setUp(SimpleServiceTest.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:640)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:503)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:193)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:123)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:258)
at org.testng.SuiteRunner.run(SuiteRunner.java:221)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:40)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:83)
at org.testng.internal.thread.ThreadUtil$CountDownLatchedRunnable.run(ThreadUtil.java:151)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: org.jvnet.hk2.component.ComponentException: problem initializing: null
at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(GlassFishImpl.java:79)
at org.glassfish.api.embedded.Server.(Server.java:270)
... 23 more

I have tried putting logging.properties all around the workspace without that changing anything. However, after looking at the source I managed to get around it by specifying:

System.setProperty("java.util.logging.config.file", "C:\\logging.properties");

Now I get a different exception:

SEVERE: Unable to start v3. Closing all ports
org.jvnet.hk2.component.UnsatisfiedDependencyException: Unsatisfied dependency exception : org.glassfish.admin.rest.RestService org.glassfish.admin.rest.RestAdapter.restService
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:157)
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:86)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:105)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:92)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:136)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:66)
at org.jvnet.hk2.component.Habitat$5.get(Habitat.java:687)
at java.util.AbstractList$Itr.next(AbstractList.java:345)
at com.sun.enterprise.v3.services.impl.GrizzlyService.registerNetworkProxy(GrizzlyService.java:492)
at com.sun.enterprise.v3.services.impl.GrizzlyService.postConstruct(GrizzlyService.java:390)
at com.sun.hk2.component.AbstractWombImpl.inject(AbstractWombImpl.java:109)
at com.sun.hk2.component.ConstructorWomb.initialize(ConstructorWomb.java:92)
at com.sun.hk2.component.SingletonInhabitant.get(SingletonInhabitant.java:67)
at com.sun.hk2.component.EventPublishingInhabitant.get(EventPublishingInhabitant.java:136)
at com.sun.hk2.component.AbstractInhabitantImpl.get(AbstractInhabitantImpl.java:66)
at com.sun.enterprise.v3.server.AppServerStartup.run(AppServerStartup.java:239)
at com.sun.enterprise.v3.server.AppServerStartup.start(AppServerStartup.java:131)
at com.sun.enterprise.glassfish.bootstrap.GlassFishImpl.start(GlassFishImpl.java:75)
at org.glassfish.api.embedded.Server.(Server.java:270)
at org.glassfish.api.embedded.Server.(Server.java:68)
at org.glassfish.api.embedded.Server$Builder.build(Server.java:178)
at org.glassfish.api.embedded.Server$Builder.build(Server.java:160)
at org.glassfish.ejb.embedded.EJBContainerProviderImpl.init(EJBContainerProviderImpl.java:163)
at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:122)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:120)
at no.evote.SimpleServiceTest.setUp(SimpleServiceTest.java:50)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:640)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:503)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:193)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:123)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:258)
at org.testng.SuiteRunner.run(SuiteRunner.java:221)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:40)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:83)
at org.testng.internal.thread.ThreadUtil$CountDownLatchedRunnable.run(ThreadUtil.java:151)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.jvnet.hk2.component.UnsatisfiedDependencyException: Unsatisfied dependency exception : org.glassfish.admin.rest.RestService org.glassfish.admin.rest.RestAdapter.restService
at org.jvnet.hk2.component.InjectionManager.inject(InjectionManager.java:152)
... 42 more

And this is where I'm at. Any suggestions? Is embedded even supposed to work in the latest builds?

Regards,

Anders

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
andersaab
Offline
Joined: 2009-12-22

Bah, my bad.. I was using a different GF Embedded dependency version for my JPA2 project, that seems to have caused the problem. Now I get a different error during startup, but the server continues so it doesn't seem to be a big problem:

WARNING: Exception while performing resource-adapter's security permission check :
java.io.FileNotFoundException: C:\Dev\workspace-admin\simple\gfembed6298667110700233753tmp\config\server.policy (The system cannot find the file specified)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:106)
at java.io.FileReader.(FileReader.java:55)
at com.sun.enterprise.connectors.service.ConnectorConfigurationParserServiceImpl.getFileContent(ConnectorConfigurationParserServiceImpl.java:134)
at com.sun.enterprise.connectors.service.ConnectorConfigurationParserServiceImpl.getSecurityPermissionSpec(ConnectorConfigurationParserServiceImpl.java:93)
at com.sun.enterprise.connectors.ConnectorRuntime.getSecurityPermissionSpec(ConnectorRuntime.java:619)
at com.sun.enterprise.connectors.service.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:225)
at com.sun.enterprise.connectors.service.ResourceAdapterAdminServiceImpl.createActiveResourceAdapter(ResourceAdapterAdminServiceImpl.java:324)
at com.sun.enterprise.connectors.ConnectorRuntime.createActiveResourceAdapter(ConnectorRuntime.java:343)
at com.sun.enterprise.connectors.service.ConnectorService.loadDeferredResourceAdapter(ConnectorService.java:176)
at com.sun.enterprise.connectors.service.ConnectorService.loadResourcesAndItsRar(ConnectorService.java:145)
at com.sun.enterprise.connectors.service.ConnectorService.checkAndLoadPool(ConnectorService.java:317)
at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl.createConnectorResource(ConnectorResourceAdminServiceImpl.java:99)
at com.sun.enterprise.connectors.ConnectorRuntime.createConnectorResource(ConnectorRuntime.java:283)
at com.sun.enterprise.resource.deployer.JdbcResourceDeployer.deployResource(JdbcResourceDeployer.java:106)
at org.glassfish.javaee.services.ResourceProxy.create(ResourceProxy.java:90)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:531)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:474)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.sun.appserv.connectors.internal.api.ResourceNamingService.lookup(ResourceNamingService.java:219)
at com.sun.enterprise.connectors.service.ConnectorResourceAdminServiceImpl.lookup(ConnectorResourceAdminServiceImpl.java:214)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:449)
at com.sun.enterprise.connectors.ConnectorRuntime.lookupPMResource(ConnectorRuntime.java:466)
at org.glassfish.persistence.jpa.ProviderContainerContractInfoBase.lookupDataSource(ProviderContainerContractInfoBase.java:62)
at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.(PersistenceUnitInfoImpl.java:108)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:154)
at org.glassfish.persistence.jpa.PersistenceUnitLoader.(PersistenceUnitLoader.java:119)
at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:140)
at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:247)
at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:147)
at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:719)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:341)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:220)
at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:193)
at org.glassfish.kernel.embedded.EmbeddedDeployerImpl.deploy(EmbeddedDeployerImpl.java:142)
at org.glassfish.ejb.embedded.EJBContainerImpl.deploy(EJBContainerImpl.java:137)
at org.glassfish.ejb.embedded.EJBContainerProviderImpl.createEJBContainer(EJBContainerProviderImpl.java:128)
at javax.ejb.embeddable.EJBContainer.createEJBContainer(EJBContainer.java:120)
at no.evote.SimpleServiceTest.setUp(SimpleServiceTest.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:641)
at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:525)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:196)
at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:126)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:258)
at org.testng.SuiteRunner.run(SuiteRunner.java:221)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:40)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:83)
at org.testng.internal.thread.ThreadUtil$CountDownLatchedRunnable.run(ThreadUtil.java:151)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:619)

mvatkina
Offline
Joined: 2005-04-04

This should've been fixed in the recent builds.

-marina