PDA

View Full Version : problem with Glassfish V3


pbelb
03-06-2010, 01:55 AM
I am wanting to use the quercus 4.0.3 war file contents within a netbeans 6.8 web application project.

having unpacked the war file, I have taken the .jar files, and put them into the project, and, defined the web.xml config file per the quercus 4.0.3 war file also.

I copied across the .php, .ico, and images directory to the project web files directory.

everything builds and looks like it should work.

when I then try deploying it on glassfish V3, I get the following error message:

An error has occurred
Exception while deploying the app : java.lang.RuntimeException: WEB9033: Unable to load class with name [com.caucho.distcache.AbstractCache], reason: java.lang.RuntimeException: WEB9033: Unable to load class with name [com.caucho.distcache.ObjectCache], reason: java.lang.NoClassDefFoundError: javax/cache/Cache

also, I note that a short time afterwards, there is a never ending stream of the following errors being reported:

WARNING: java.lang.NullPointerException
java.lang.NullPointerException
at com.caucho.util.Alarm.extractAlarm(Alarm.java:479)
at com.caucho.util.Alarm$CoordinatorThread.run(Alarm. java:744)

WARNING: java.lang.NullPointerException
java.lang.NullPointerException
at com.caucho.util.Alarm.extractAlarm(Alarm.java:479)
at com.caucho.util.Alarm$CoordinatorThread.run(Alarm. java:744)

and eventually glassfish becomes non responsive.

please advise.

thank you in advance!

peter

domdorn
03-06-2010, 06:44 PM
does this happen when you deploy your app or when you undeploy/redeploy the app?

if it happens when undeploying/redeploying: Thats a known bug in quercus on glassfish.. I also have this on my machine.

If you're using it on a production system, place the logs on a drive/partition other than your default partition as this error will fill up the whole disk in minutes, maybe preventing you from accessing the box from remote.

The problem with javax.cache.Cache is new... never seen it before, but maybe thats the reason why we have the problem at all.

do you use quercus open source or the $$ edition?

pbelb
03-06-2010, 10:12 PM
this is not the 'pro' version I'm using.

it happens when I deploy. If you try deploying via netbeans, it's a lot harder to see the issue reported, but it's still there, at the top of the log file (which becomes very big very quickly - agreed!)

if you deploy the netbeans generated war file via the glassfish web admin tool, it captures the error and displays it for you (but you do still get the runaway error log happening).

if it's a known bug, is there a work-around? what is the bug thread that has the most information on how to deal with this issue?

for completeness, here is the stack dump reported by glassfish on an unsuccessful deploy:

SEVERE: Exception while deploying the app
java.lang.RuntimeException: WEB9033: Unable to load class with name [com.caucho.distcache.AbstractCache], reason: java.lang.RuntimeException: WEB9033: Unable to load class with name [com.caucho.distcache.ObjectCache], reason: java.lang.NoClassDefFoundError: javax/cache/Cache
at org.glassfish.web.loader.WebappClassLoader.findCla ss(WebappClassLoader.java:944)
at org.glassfish.web.loader.WebappClassLoader.loadCla ss(WebappClassLoader.java:1420)
at com.sun.enterprise.deployment.annotation.impl.Modu leScanner.getElements(ModuleScanner.java:247)
at com.sun.enterprise.deployment.archivist.Archivist. processAnnotations(Archivist.java:541)
at com.sun.enterprise.deployment.archivist.Archivist. readAnnotations(Archivist.java:447)
at com.sun.enterprise.deployment.archivist.Archivist. readAnnotations(Archivist.java:420)
at com.sun.enterprise.deployment.archivist.Archivist. readRestDeploymentDescriptors(Archivist.java:396)
at com.sun.enterprise.deployment.archivist.Archivist. readDeploymentDescriptors(Archivist.java:373)
at com.sun.enterprise.deployment.archivist.Archivist. open(Archivist.java:238)
at com.sun.enterprise.deployment.archivist.Archivist. open(Archivist.java:247)
at com.sun.enterprise.deployment.archivist.Archivist. open(Archivist.java:208)
at com.sun.enterprise.deployment.archivist.Applicatio nFactory.openArchive(ApplicationFactory.java:148)
at org.glassfish.javaee.core.deployment.DolProvider.l oad(DolProvider.java:155)
at org.glassfish.javaee.core.deployment.DolProvider.l oad(DolProvider.java:78)
at com.sun.enterprise.v3.server.ApplicationLifecycle. loadDeployer(ApplicationLifecycle.java:612)
at com.sun.enterprise.v3.server.ApplicationLifecycle. setupContainerInfos(ApplicationLifecycle.java:554)
at com.sun.enterprise.v3.server.ApplicationLifecycle. deploy(ApplicationLifecycle.java:262)
at com.sun.enterprise.v3.server.ApplicationLifecycle. deploy(ApplicationLifecycle.java:183)
at org.glassfish.deployment.admin.DeployCommand.execu te(DeployCommand.java:272)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.ex ecute(CommandRunnerImpl.java:305)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCo mmand(CommandRunnerImpl.java:320)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCo mmand(CommandRunnerImpl.java:1176)
at com.sun.enterprise.v3.admin.CommandRunnerImpl.acce ss$900(CommandRunnerImpl.java:83)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$Exec utionContext.execute(CommandRunnerImpl.java:1235)
at com.sun.enterprise.v3.admin.CommandRunnerImpl$Exec utionContext.execute(CommandRunnerImpl.java:1224)
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand (AdminAdapter.java:365)
at com.sun.enterprise.v3.admin.AdminAdapter.service(A dminAdapter.java:204)
at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service( GrizzlyAdapter.java:166)
at com.sun.enterprise.v3.server.HK2Dispatcher.dispath (HK2Dispatcher.java:100)
at com.sun.enterprise.v3.services.impl.ContainerMappe r.service(ContainerMapper.java:245)
at com.sun.grizzly.http.ProcessorTask.invokeAdapter(P rocessorTask.java:791)
at com.sun.grizzly.http.ProcessorTask.doProcess(Proce ssorTask.java:693)
at com.sun.grizzly.http.ProcessorTask.process(Process orTask.java:954)
at com.sun.grizzly.http.DefaultProtocolFilter.execute (DefaultProtocolFilter.java:170)
at com.sun.grizzly.DefaultProtocolChain.executeProtoc olFilter(DefaultProtocolChain.java:135)
at com.sun.grizzly.DefaultProtocolChain.execute(Defau ltProtocolChain.java:102)
at com.sun.grizzly.DefaultProtocolChain.execute(Defau ltProtocolChain.java:88)
at com.sun.grizzly.http.HttpProtocolChain.execute(Htt pProtocolChain.java:76)
at com.sun.grizzly.ProtocolChainContextTask.doCall(Pr otocolChainContextTask.java:53)
at com.sun.grizzly.SelectionKeyContextTask.call(Selec tionKeyContextTask.java:57)
at com.sun.grizzly.ContextTask.run(ContextTask.java:6 9)
at com.sun.grizzly.util.AbstractThreadPool$Worker.doW ork(AbstractThreadPool.java:330)
at com.sun.grizzly.util.AbstractThreadPool$Worker.run (AbstractThreadPool.java:309)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.RuntimeException: WEB9033: Unable to load class with name [com.caucho.distcache.ObjectCache], reason: java.lang.NoClassDefFoundError: javax/cache/Cache
at org.glassfish.web.loader.WebappClassLoader.findCla ss(WebappClassLoader.java:944)
at org.glassfish.web.loader.WebappClassLoader.loadCla ss(WebappClassLoader.java:1420)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:316)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java :616)
at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:124)
at org.glassfish.web.loader.WebappClassLoader.findCla ss(WebappClassLoader.java:914)
... 43 more
Caused by: java.lang.NoClassDefFoundError: javax/cache/Cache
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java :616)
at java.security.SecureClassLoader.defineClass(Secure ClassLoader.java:124)
at org.glassfish.web.loader.WebappClassLoader.findCla ss(WebappClassLoader.java:914)
... 49 more
Caused by: java.lang.ClassNotFoundException: javax.cache.Cache
at java.net.URLClassLoader$1.run(URLClassLoader.java: 200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.j ava:188)
at org.glassfish.web.loader.WebappClassLoader.findCla ss(WebappClassLoader.java:949)
at org.glassfish.web.loader.WebappClassLoader.loadCla ss(WebappClassLoader.java:1420)
at java.lang.ClassLoader.loadClassInternal(ClassLoade r.java:316)
... 53 more

domdorn
03-08-2010, 06:54 PM
do you get it when deploying on a clean instance, meaning you have first undeployed to old app, stopped glassfish, started it again and then deploy the new app?

Because on my machine, the alert-loop is 5-10 seconds after undeploying of the last qercus app, which may look like its the new app making problems.

This is how I _fixed_ it in my setup:

domdorn resin-trunk $ svn diff modules/kernel/src/com/caucho/util/Alarm.java
Index: modules/kernel/src/com/caucho/util/Alarm.java
================================================== =================
--- modules/kernel/src/com/caucho/util/Alarm.java (revision 6830)
+++ modules/kernel/src/com/caucho/util/Alarm.java (working copy)
@@ -34,6 +34,7 @@
import com.caucho.loader.Environment;
import com.caucho.loader.EnvironmentListener;

+import java.lang.Exception;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.LockSupport;
import java.util.logging.Level;
@@ -493,6 +494,13 @@

Alarm []heap = _heap;

+ if(heap == null){
+ log.warning("Calling ExtractAlarm but HEAP IS NULL! Will create a new heap");
+ new Exception().printStackTrace();
+ _heap = new Alarm[256];
+ return null;
+ }
+
Alarm alarm = heap[1];

if (alarm == null)
@@ -682,7 +690,15 @@
return "Alarm[" + _name + "]";
}

- static class AlarmThread extends Thread {
+ private static com.caucho.util.Alarm[] get_heap() {
+ return _heap;
+ }
+
+ private static void set_heap(com.caucho.util.Alarm[] _heap) {
+ Alarm._heap = _heap;
+ }
+
+ static class AlarmThread extends Thread {
private static final long MIN = 10L;
private static final long MAX = 250L;

pbelb
03-08-2010, 09:18 PM
when I say that I see the error while trying to deploy, I mean to an instance of glassfish that did not have the app deployed previously, and has been freshly restarted.

ie: this is happening upon initial deployment.

pbelb
03-10-2010, 09:08 PM
ok, well, this is interesting.

so I took the trunk from the svn repository and built quercus.

now, when I have a freshly restarted app, the issue with the alarm related code is not complaining until the app gets redeployed to the server.

so, it's now behaving in line with what domdorn described.

I have patched the code per the suggestion, and it does seem to be behaving much better - no more complaints about javax.cache classes not being findable.