Thursday, June 16, 2011

Boom!

The next test is to try to go for the gold and move everything to Scala and get rid of the local interface. Here's the bean implementation:


package com.scalaejb

import javax.ejb.Stateless

trait ScalaEjbRemote

@Stateless
class ScalaEjbImpl extends ScalaEjbRemote {
def sayHi( name:String ) { println("Hi 3, "+name ) }
}
Looks really nice, doesn't it? Too bad it goes boom when deployed.
Here's the exception you'll get:

[#|2011-06-16T15:23:37.188-0500|SEVERE|glassfish3.1|org.apache.catalina.core.ContainerBase|_ThreadID=17;_ThreadName=Thread-1;|ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class com.scalaejb.servlet.StartupShutdown
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5271)
at com.sun.enterprise.web.WebModule.start(WebModule.java:500)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:917)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:901)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:755)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1980)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1630)
at com.sun.enterprise.web.WebApplication.start(WebApplication.java:100)
at org.glassfish.internal.data.EngineRef.start(EngineRef.java:130)
at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:269)
at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:286)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:461)
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:240)
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:360)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:370)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1067)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1200(CommandRunnerImpl.java:96)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1247)
at org.glassfish.deployment.autodeploy.AutoOperation.run(AutoOperation.java:145)
at org.glassfish.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:577)
at org.glassfish.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:463)
at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:395)
at org.glassfish.deployment.autodeploy.AutoDeployer.run(AutoDeployer.java:380)
at org.glassfish.deployment.autodeploy.AutoDeployService$1.run(AutoDeployService.java:213)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by: java.lang.IllegalArgumentException: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class co.bookleaf.servlet.StartupShutdown
at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:2688)
at org.apache.catalina.core.StandardContext.addApplicationListener(StandardContext.java:1932)
at com.sun.enterprise.web.TomcatDeploymentConfig.configureApplicationListener(TomcatDeploymentConfig.java:234)
at com.sun.enterprise.web.TomcatDeploymentConfig.configureWebModule(TomcatDeploymentConfig.java:93)
at com.sun.enterprise.web.WebModuleContextConfig.start(WebModuleContextConfig.java:274)
at com.sun.enterprise.web.WebModuleContextConfig.lifecycleEvent(WebModuleContextConfig.java:172)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:149)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:5268)
... 26 more
Caused by: javax.servlet.ServletException: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class co.bookleaf.servlet.StartupShutdown
at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:2798)
at org.apache.catalina.core.StandardContext.loadListener(StandardContext.java:4745)
at com.sun.enterprise.web.WebModule.loadListener(WebModule.java:1603)
at org.apache.catalina.core.StandardContext.addListener(StandardContext.java:2685)
... 33 more
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class co.bookleaf.servlet.StartupShutdown
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:317)
at com.sun.enterprise.web.WebContainer.createListenerInstance(WebContainer.java:734)
at com.sun.enterprise.web.WebModule.createListenerInstance(WebModule.java:1981)
at org.apache.catalina.core.StandardContext.createListener(StandardContext.java:2796)
... 36 more
Caused by: com.sun.enterprise.container.common.spi.util.InjectionException: Exception attempting to inject Remote ejb-ref name=co.bookleaf.servlet.StartupShutdown/localEJB,Remote 3.x interface =com.scalaejb.ScalaEjbLocal,ejb-link=null,lookup=,mappedName=,jndi-name=com.scalaejb.ScalaEjbLocal,refType=Session into class co.bookleaf.servlet.StartupShutdown
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:698)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.inject(InjectionManagerImpl.java:468)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:146)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.injectInstance(InjectionManagerImpl.java:132)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl.createManagedObject(InjectionManagerImpl.java:311)
... 39 more
Caused by: javax.naming.NamingException: Lookup failed for 'java:comp/env/co.bookleaf.servlet.StartupShutdown/localEJB' in SerialContext[myEnv={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.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=co.bookleaf.servlet.StartupShutdown/localEJB,Remote 3.x interface =com.scalaejb.ScalaEjbLocal,ejb-link=null,lookup=,mappedName=,jndi-name=com.scalaejb.ScalaEjbLocal,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'com.scalaejb.ScalaEjbLocal#com.scalaejb.ScalaEjbLocal' [Root exception is javax.naming.NamingException: Lookup failed for 'com.scalaejb.ScalaEjbLocal#com.scalaejb.ScalaEjbLocal' in SerialContext[myEnv={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: com.scalaejb.ScalaEjbLocal#com.scalaejb.ScalaEjbLocal not found]]]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.sun.enterprise.container.common.impl.util.InjectionManagerImpl._inject(InjectionManagerImpl.java:597)
... 43 more
Caused by: javax.naming.NamingException: Exception resolving Ejb for 'Remote ejb-ref name=co.bookleaf.servlet.StartupShutdown/localEJB,Remote 3.x interface =com.scalaejb.ScalaEjbLocal,ejb-link=null,lookup=,mappedName=,jndi-name=com.scalaejb.ScalaEjbLocal,refType=Session' . Actual (possibly internal) Remote JNDI name used for lookup is 'com.scalaejb.ScalaEjbLocal#com.scalaejb.ScalaEjbLocal' [Root exception is javax.naming.NamingException: Lookup failed for 'com.scalaejb.ScalaEjbLocal#com.scalaejb.ScalaEjbLocal' in SerialContext[myEnv={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: com.scalaejb.ScalaEjbLocal#com.scalaejb.ScalaEjbLocal not found]]
at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:178)
at com.sun.enterprise.container.common.impl.ComponentEnvManagerImpl$EjbReferenceProxy.create(ComponentEnvManagerImpl.java:1097)
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:772)
at com.sun.enterprise.naming.impl.GlassfishNamingManagerImpl.lookup(GlassfishNamingManagerImpl.java:740)
at com.sun.enterprise.naming.impl.JavaURLContext.lookup(JavaURLContext.java:172)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:498)
... 47 more
Caused by: javax.naming.NamingException: Lookup failed for 'com.scalaejb.ScalaEjbLocal#com.scalaejb.ScalaEjbLocal' in SerialContext[myEnv={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: com.scalaejb.ScalaEjbLocal#com.scalaejb.ScalaEjbLocal not found]
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:518)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at javax.naming.InitialContext.lookup(InitialContext.java:392)
at com.sun.ejb.EjbNamingReferenceManagerImpl.resolveEjbReference(EjbNamingReferenceManagerImpl.java:173)
... 52 more
Caused by: javax.naming.NameNotFoundException: com.scalaejb.ScalaEjbLocal#com.scalaejb.ScalaEjbLocal not found
at com.sun.enterprise.naming.impl.TransientContext.doLookup(TransientContext.java:248)
at com.sun.enterprise.naming.impl.TransientContext.lookup(TransientContext.java:215)
at com.sun.enterprise.naming.impl.SerialContextProviderImpl.lookup(SerialContextProviderImpl.java:77)
at com.sun.enterprise.naming.impl.LocalSerialContextProviderImpl.lookup(LocalSerialContextProviderImpl.java:119)
at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:505)
... 56 more
|#]


Not pretty, is it. Well now the hard part. There seems to be some name mangling going on since the last part of the exception says it couldn't find "com.scalaejb.ScalaEjbLocal#com.scalaejb.ScalaEjbLocal". Need to think on that a bit...

Anyone have any knowledge/ideas on what Glassfish might be looking for?

No comments:

Post a Comment