Issue Details (XML | Word | Printable)

Key: GLASSFISH-20563
Type: Bug Bug
Status: Resolved Resolved
Resolution: Works as designed
Priority: Blocker Blocker
Assignee: marina vatkina
Reporter: sd_
Votes: 0
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
glassfish

webApplication.unknownError will be thrown when virtualServers are not set before ejb-timer-service-app deployment

Created: 21/May/13 12:41 PM   Updated: 30/Jul/13 10:25 PM   Resolved: 30/Jul/13 10:25 PM
Component/s: ejb_container
Affects Version/s: 4.0_b89_RC5
Fix Version/s: 4.0.1

Time Tracking:
Not Specified

Environment:

Linux


Tags:
Participants: guojun.shan, Hong Zhang, Jeremy_Lv, marina vatkina, sd_ and Shing Wai Chan


 Description  « Hide

Hello,

I got a problem when deploying the standard delivered application ejb-timer-service-app.war under glassfish4 build89. This application will be deployed automatically, when a deployed application uses Timer-EJBs. :

[glassfish 4.0] [SEVERE] [] [javax.enterprise.web] [tid: _ThreadID=26 _ThreadName=admin-listener(5)] [timeMillis: ...] [levelValue: 1000] [[
webApplication.unknownError]]

After investigation I can see in com.sun.enterprise.web.WebApplication#start(ApplicationContext appContext) an invocation of
com.sun.enterprise.web.WebContainer#loadWebModule(loadWebModule(WebModuleConfig wmInfo, String j2eeApplication,Properties deploymentProperties).
It seems to be that the instance of wmInfo does not have a the virtual servers set, so the local field _vsIDs of that instance is an empty string and
the used initializing form of the result list
List <Result<WebModule>> results = container.loadWebModule(wmInfo, "null", props);

will return an empty resultset :

com.sun.enterprise.web.WebContainer#loadWebModule(WebModuleConfig wmInfo, String j2eeApplication,Properties deploymentProperties) :

List<Result<WebModule>> results = new ArrayList<Result<WebModule>>();
String vsIDs = wmInfo.getVirtualServers();
List<String> vsList = StringUtils.parseStringList(vsIDs, " ,");
if (vsList == null || vsList.isEmpty()) {
if (logger.isLoggable(Level.INFO))

Unknown macro: { logger.log(Level.INFO, WEB_MODULE_NOT_LOADED_NO_VIRTUAL_SERVERS, wmInfo.getName()); }

return results;
}

and so this ErrorMessage will be created in com.sun.enterprise.web.WebApplication#start(ApplicationContext appContext):

if (results.size() == 0)

Unknown macro: { logger.log(Level.SEVERE, "webApplication.unknownError"); return false; }

If the p.e. WebModuleConfig#setVirtualServers("__asadmin") will be invoked before, the deployment will be successfull.



Hong Zhang added a comment - 22/May/13 12:29 AM

As the quoted code is from web container, assign to web team for initial evaluation.


sd_ added a comment - 22/May/13 07:57 AM

As an additional information, the EJB Timer Service was setup against a cluster configuration.


Shing Wai Chan added a comment - 22/May/13 06:17 PM

Can you provide more details about your environment?
Can you attach the application, too?


Shing Wai Chan added a comment - 31/May/13 03:35 AM

I saw the following in instance log file.

java.lang.RuntimeException: javax.naming.NamingException: Lookup failed for 'jdbc/__TimerPool' in SerialContext[myEnv={com.sun.enterprise.connectors.jndisuffix=__pm, java.naming.factory.initial=com.sun.enterprise.naming.impl.SerialInitContextFactory, java.naming.factory.state=com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl, java.naming.factory.url.pkgs=com.sun.enterprise.naming} [Root exception is javax.naming.NameNotFoundException: __TimerPool not found]
	at org.glassfish.persistence.jpa.PersistenceUnitInfoImpl.<init>(PersistenceUnitInfoImpl.java:111)
	at org.glassfish.persistence.jpa.PersistenceUnitLoader.loadPU(PersistenceUnitLoader.java:142)
	at org.glassfish.persistence.jpa.PersistenceUnitLoader.<init>(PersistenceUnitLoader.java:107)
	at org.glassfish.persistence.jpa.JPADeployer$1.visitPUD(JPADeployer.java:223)
	at org.glassfish.persistence.jpa.JPADeployer$PersistenceUnitDescriptorIterator.iteratePUDs(JPADeployer.java:510)
	at org.glassfish.persistence.jpa.JPADeployer.createEMFs(JPADeployer.java:230)
	at org.glassfish.persistence.jpa.JPADeployer.prepare(JPADeployer.java:168)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.prepareModule(ApplicationLifecycle.java:922)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:431)
	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
	at org.glassfish.ejb.persistent.timer.PersistentEJBTimerService.deployEJBTimerService(PersistentEJBTimerService.java:1464)
	at org.glassfish.ejb.persistent.timer.PersistentEJBTimerService.initEJBTimerService(PersistentEJBTimerService.java:1370)
	at org.glassfish.ejb.persistent.timer.DistributedEJBTimerService.initPersistentTimerService(DistributedEJBTimerService.java:98)
	at com.sun.ejb.containers.EJBTimerService.initEJBTimerService(EJBTimerService.java:230)
	at com.sun.ejb.containers.EJBTimerService.getEJBTimerService(EJBTimerService.java:205)
	at com.sun.ejb.containers.EJBTimerService.getEJBTimerService(EJBTimerService.java:187)
	at com.sun.ejb.containers.BaseContainer.<init>(BaseContainer.java:758)

sd_ added a comment - 11/Jun/13 10:13 AM

please notice that the problem occurs in a clustered environment. Please check if it is deployed to the target : server. The DB Pool is standard available EJB TimerPool, so the config in domain.xml looks like

<jdbc-connection-pool datasource-classname="org.apache.derby.jdbc.EmbeddedXADataSource" res-type="javax.sql.XADataSource" name="__TimerPool">
      <property name="databaseName" value="${com.sun.aas.instanceRoot}/lib/databases/ejbtimer"></property>
      <property name="connectionAttributes" value=";create=true"></property>
</jdbc-connection-pool>

Jeremy_Lv added a comment - 11/Jun/13 03:05 PM - edited

Shing wai:

I think you need to execute the command as "asadmin create-resource-ref --target cluster_name --enabled=true jdbc/__TimerPool" to avoid the exception you have come up with.


marina vatkina added a comment - 11/Jun/13 09:21 PM

Note that in a clustered environment the timer pool must be reconfigured by the user - see http://docs.oracle.com/cd/E26576_01/doc.312/e24930/ejb.htm#gktqo


Shing Wai Chan added a comment - 29/Jun/13 12:07 AM

Besides the ear file, what else do we need to set up for this case? Please let us know.


guojun.shan added a comment - 02/Jul/13 06:35 AM

Hi Shing Wai Chan, anything we can do in naming module now?
if not, could you please take this issue accordingly?
thanks.


Shing Wai Chan added a comment - 08/Jul/13 10:44 PM

I have talked to the filer sd_.
The following are the steps to setup the environment:
create-domain
start-domain
delete-http-listener --target server-config http-listener-1
delete-http-listener --target server-config http-listener-2
delete-virtual-server --target server-config server
stop-domain
start-domain
create-cluster gfcluster
add-resources --target gfcluster derby.xml
set gfcluster.ejb-container.ejb-timer-service.timer-datasource=DataSourceTimer
create-local-instance instance1
start-database
start-local-instance instance1

deploy --target gfcluster EjbTimerServiceWebAppDeploymentBugEar.ear

where derby.xml is as follows:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE resources PUBLIC "-//Sun Microsystems, Inc.//DTD GlassFish Application Server 3.0 Resource Definitions//EN" "http://www.sun.com/software/appserver/dtds/sun-resources_1_4.dtd">

<resources>
    <jdbc-connection-pool
        is-isolation-level-guaranteed="false"
datasource-classname="org.apache.derby.jdbc.ClientDataSource"
        res-type="javax.sql.DataSource"
        name="DataSourceTimerPool"
        steady-pool-size="1"
        max-pool-size="5">
              <property name="PortNumber" value="1527"></property>
              <property name="Password" value="test"></property>
              <property name="User" value="test"></property>
              <property name="serverName" value="localhost"></property>
              <property name="DatabaseName" value="test"></property>
              <property name="connectionAttributes" value=";create=true"></property>
    </jdbc-connection-pool>

   <jdbc-resource
        enabled="true"
        jndi-name="DataSourceTimer"
        object-type="user"
        pool-name="DataSourceTimerPool"/>

</resources>

With this setup, I see the following in GlassFish 4.0 server.log:
org.glassfish.deployment.common.DeploymentException: Failed to create automatic timers for bug.Timer – EJB Timer Service is not available
at org.glassfish.ejb.startup.EjbDeployer.createAutomaticPersistentTimersForEJB(EjbDeployer.java:566)
at org.glassfish.ejb.startup.EjbDeployer.checkEjbBundleForTimers(EjbDeployer.java:535)
at org.glassfish.ejb.startup.EjbDeployer.event(EjbDeployer.java:508)
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:484)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:528)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:524)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:523)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:554)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$3.run(CommandRunnerImpl.java:546)
at java.security.AccessController.doPrivileged(Native Method)
at javax.security.auth.Subject.doAs(Subject.java:356)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:545)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1453)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:109)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1824)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1709)
at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:396)
at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:234)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125)
at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)
at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:224)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:198)
at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:946)
at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:331)
at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:173)
at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:179)
at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:496)
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:175)
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:187)
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:837)
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:565)
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:545)
at java.lang.Thread.run(Thread.java:722)


marina vatkina added a comment - 08/Jul/13 10:59 PM

I suspect that the answer will be - it's by design...

Will the following commands not allow to deploy anything to DAS:
delete-http-listener --target server-config http-listener-1
delete-http-listener --target server-config http-listener-2
delete-virtual-server --target server-config server

If yes, the TS won't be able to create automatic timers in a clustered environment. The TS is a web app, and it's started on DAS to pre-create automatic timers on various instances in a cluster (so that not all timers are running on the same instance.


marina vatkina added a comment - 30/Jul/13 10:25 PM

It might be a doc issue, but this behavior is per design