Skip to main content

java.lang.ClassNotFoundException: [Ljava.lang.String;

11 replies [Last post]
cayhorstmann
Offline
Joined: 2003-06-13

I am trying to deploy a JSF app that uses MyFaces Tomahawk 1.1.2 into GlassFish v2-b05. (Tomahawk is in WEB-INF/lib and depends on commons-logging-1.1, which I also included in WEB-INF/lib.)

I thought I've seen it all, but this error message tops it. The class loader can't load java.lang.String[]. Huh?

Any hints on how to trouble-shoot this?

Thanks,

Cay

Exception sending context initialized event to listener instance of class com.sun.faces.config.GlassFishConfigureListener
javax.faces.FacesException: java.lang.ClassNotFoundException: [Ljava.lang.String;
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:535)
at com.sun.faces.config.GlassFishConfigureListener.contextInitialized(GlassFishConfigureListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4236)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4760)
at com.sun.enterprise.web.WebModule.start(WebModule.java:292)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:833)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:817)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:659)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1478)
at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1143)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:171)
at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:275)
at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:954)
at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:941)
at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:448)
at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:160)
at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:296)
at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:203)
at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:285)
at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:119)
at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:263)
at com.sun.enterprise.deployment.phasing.PEDeploymentService.deploy(PEDeploymentService.java:281)
at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.deploy(ApplicationsConfigMBean.java:534)
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:589)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:353)
at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:336)
at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:448)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
at sun.reflect.GeneratedMethodAccessor15.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:589)
at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:77)
at $Proxy1.invoke(Unknown Source)
at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.invokeDeploymentService(AutoDeployer.java:413)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deploy(AutoDeployer.java:394)
at com.sun.enterprise.deployment.autodeploy.AutoDeployer.deployAll(AutoDeployer.java:253)
at com.sun.enterprise.deployment.autodeploy.AutoDeployControllerImpl$AutoDeployTask.run(AutoDeployControllerImpl.java:361)
at java.util.TimerThread.mainLoop(Timer.java:512)
at java.util.TimerThread.run(Timer.java:462)
Caused by: java.lang.ClassNotFoundException: [Ljava.lang.String;
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1508)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1289)
at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:1020)
at com.sun.faces.config.ConfigureListener.configure(ConfigureListener.java:770)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:529)
... 45 more

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
kniffte
Offline
Joined: 2007-06-25

Hello!

I'm sorry for posting a 2nd time now, but things look a little different here. I also have a Servlet deployed, which has (following to these posts here) been compiled using JDK1.5.0_12 (linux). But upon calling this Servlet, I get the java.lang.ClassNotFoundException.

The class is definitely there, the .war structure looks like the following:
/servlet.war
--> META-INF
---> MANIFEST.MF
--> WEB-INF
---> classes/
----> de/ ... / webservice/OrderServlet.class
---> web.xml

Upon calling, I receive the following tracelog:

---- begin tracelog ---

[#|2007-07-15T02:52:54.178+0200|INFO|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=23;_ThreadName=httpSSLWorkerThread-8080-1;|PWC1412: WebModule[/servlets] ServletContext.log():PWC1409: Marking servlet OrderServlet as unavailable|#]

[#|2007-07-15T02:52:54.181+0200|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=23;_ThreadName=httpSSLWorkerThread-8080-1;_RequestID=0a207b61-ce76-46c9-aaaa-dc3fbaaf0246;|WebModule[/servlets]Error loading WebappClassLoader
delegate: true
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
EJBClassLoader :
urlSet = []
doneCalled = false
Parent -> java.net.URLClassLoader@12922f6

de.uniba.wiai.lspi.ss07.pi2.gruppe3.ass03.rentorg.webservice.OrderServlet.class
java.lang.ClassNotFoundException: de.uniba.wiai.lspi.ss07.pi2.gruppe3.ass03.rentorg.webservice.OrderServlet.class
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1490)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1096)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:819)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:184)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:258)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:189)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:81)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:193)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:255)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:618)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:549)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:790)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:248)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:199)
at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:345)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:93)
|#]

[#|2007-07-15T02:52:54.184+0200|SEVERE|sun-appserver9.1|javax.enterprise.system.container.web|_ThreadID=23;_ThreadName=httpSSLWorkerThread-8080-1;_RequestID=0a207b61-ce76-46c9-aaaa-dc3fbaaf0246;|StandardWrapperValve[OrderServlet]: PWC1382: Allocate exception for servlet OrderServlet
java.lang.ClassNotFoundException: de.uniba.wiai.lspi.ss07.pi2.gruppe3.ass03.rentorg.webservice.OrderServlet.class
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1490)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1096)
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:819)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:184)
at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:258)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:189)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:81)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:193)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:611)
at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:564)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:558)
at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1067)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:255)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:618)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:549)
at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:790)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:326)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:248)
at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:199)
at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:345)
at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:93)
|#]

--- end tracelog ---

stefan@debian:~$ ls -al /usr/local/lib/glassfish/domains/domain1/applications/j2ee-modules/servlets/WEB-INF/classes/de/uniba/wiai/lspi/ss07/pi2/gruppe3/ass03/rentorg/webservice
insgesamt 25
drwxr-sr-x 2 root staff 1024 2007-07-15 02:39 .
drwxr-sr-x 4 root staff 1024 2007-07-15 02:39 ..
-rw-r--r-- 1 root staff 818 2007-07-15 02:39 Confirmation.class
-rw-r--r-- 1 root staff 7889 2007-07-15 02:39 ConfirmationServlet.class
-rw-r--r-- 1 root staff 1983 2007-07-15 02:39 Inquiry.class
-rw-r--r-- 1 root staff 9596 2007-07-15 02:39 OrderServlet.class
-rw-r--r-- 1 root staff 1027 2007-07-15 02:39 VehicleDesc.class
stefan@debian:~$ less /usr/local/lib/glassfish/domains/domain1/generated/xml/j2ee-modules/servlets/WEB-INF/web.xml


xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">


rentOrg





ConfirmationServlet

ConfirmationServlet

de.uniba.wiai.lspi.ss07.pi2.gruppe3.ass03.rentorg.webservice.ConfirmationServlet.class






OrderServlet

OrderServlet

de.uniba.wiai.lspi.ss07.pi2.gruppe3.ass03.rentorg.webservice.OrderServlet.class



ConfirmationServlet
/setConfirmation


OrderServlet
/setOrder

I called: URL endpoint = new URL( "http://localhost:8080/servlets" + "/setOrder");

SOAPMessage response = con.call(msg, endpoint);

where msg = SOAPMessage

The same result occurs, if I use JDK1.6.0_1 and JDK1.6.0_2 (both Win + Linux versions)
On the other hand, I have a second (very simple) Servlet (made from Sun's JavaEE CoffeeBreak - Tutorial), that runs if called.

I would be great, if somebody could help me out.

Thanks and have a good one.

Stefan

jtp51
Offline
Joined: 2003-10-25

So plain and simple?

Is this a Tomahawk issue or a Glassfish issue?

I understand the thread and I've looked at the bug report. However, I am currently running Tomcat 5.0.28, JSF 1.1 and when I use Java 6 - I do receive this Class exception.

Thanks,

--Todd

xamjadmin
Offline
Joined: 2005-05-29

FWIW - I see this in JDK 1.6.0_01 in client app. I think it's a significant JRE bug. It messes up serialization for starters.

Jan.Luehe@Sun.COM

glassfish@javadesktop.org wrote:

>FWIW - I see this in JDK 1.6.0_01 in client app. I think it's a significant JRE bug. It messes up serialization for starters.
>
>

I filed this issue, which is in "accepted" state, against the JDK last year:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6434149
("(cl) ClassLoader.loadClass() throws
java.lang.ClassNotFoundException: [Ljava.lang.String; in JDK 6.0")

Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@glassfish.dev.java.net
For additional commands, e-mail: users-help@glassfish.dev.java.net

dfuchs
Offline
Joined: 2004-12-16

Hi,

We have encountered a similar error a while back while
we were testing the JMX RI.
In your case the culprit seems to be here:
[code]Caused by: java.lang.ClassNotFoundException: [Ljava.lang.String;
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1508)[/code]
The problem is that the catalina code apparently calls [code]ClassLoader.loadClass()[/code]
instead of calling [code]Class.forName(String, boolean, ClassLoader)[/code]

Hope this helps,

-- daniel
JMX, SNMP, Java, etc...
http://blogs.sun.com/roller/page/jmxetc

cayhorstmann
Offline
Joined: 2003-06-13

Thank you very much for your reply. Is this an issue with GlassFish or with Tomahawk? Or an unfortunate interaction? As you may imagine, I am not actively trying to load any class.

AFAIK, catalina is the code name for the Tomcat web container which probably is a part of GlassFish.

I tried deploying the same app into GlassFish b41, and that ran fine. (Actually, there was another wrinkle. I ran b41 with Java 5 and v2b05 with Java 6.)

Thanks,

Cay

jluehe
Offline
Joined: 2004-12-01

The problem you've run into seems to have been caused by a regression in the Java runtime, and is independent of the webapp classloader.

In fact, it can be reproduced very easily using this test program:

public class test {

public static void main(String[] args) throws Exception {

String[] s = new String[] { "123" };
String clName = s.getClass().getName();
test.class.getClassLoader().loadClass(clName);
}
}

This program runs fine with JDK 1.5, but throws this exception on JDK 1.6:

Exception in thread "main" java.lang.ClassNotFoundException: [Ljava.lang.String;
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:276)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at test.main(test.java:7)

I'll file a P1 against JDK 1.6 and will update you as soon as I know more.

jluehe
Offline
Joined: 2004-12-01
kniffte
Offline
Joined: 2007-06-25

Hello!

So, is there any way I can solve this for my Servlet?
We have to use Java 1.6 and we'll have to turn in our assignment next Friday.

By the way, when deploying these Servlets, I'll always find the following message in \domain1\log\server.log:

|PWC1412: WebModule[/servlets] ServletContext.log():PWC1409: Marking servlet OrderServlet as unavailable

whereas "OrderServlet" is the Servlet to be used.

Thanks a lot in advance.

Bye,
Stefan

pavelr
Offline
Joined: 2005-06-28

I do not know if it is bug or feature of Java 1.6, but I think it can be solved by VM option:
-Dsun.lang.ClassLoader.allowArraySyntax=true

Pavel

km
Offline
Joined: 2005-10-28

Wow. You learn something new every day!