Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error trying to run tomcat hello server #537

Open
AntonBikineev opened this issue Jun 27, 2017 · 5 comments
Open

Error trying to run tomcat hello server #537

AntonBikineev opened this issue Jun 27, 2017 · 5 comments

Comments

@AntonBikineev
Copy link

Hi,
I've run into an error trying to run tomcat under avian-openjdk. The error is stackoverflow and it seems it is caused by a recursive call to ClassLoader.definePackage:

Exception

javax.servlet.ServletException: java.lang.StackOverflowError
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:338)
	javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
Root Cause

java.lang.StackOverflowError
	java.lang.ClassLoader.getPackage(Unknown Source)
	avian.SystemClassLoader.getPackage(Unknown Source)
	java.lang.ClassLoader.definePackage(Unknown Source)
	avian.SystemClassLoader.getPackage(Unknown Source)
	java.lang.ClassLoader.definePackage(Unknown Source)
	avian.SystemClassLoader.getPackage(Unknown Source)
	java.lang.ClassLoader.definePackage(Unknown Source)
	avian.SystemClassLoader.getPackage(Unknown Source)
	java.lang.ClassLoader.definePackage(Unknown Source)
...

Does anybody know why this happens? The command to run jvm is as follows:

~/git/avian-openjdk/build/linux-x86_64-openjdk-src/avian -cp bin/bootstrap.jar:bin/tomcat-juli.jar:lib/annotations-api.jar:lib/catalina-ant.jar:lib/catalina-ha.jar:lib/catalina.jar:lib/catalina-storeconfig.jar:lib/catalina-tribes.jar:lib/ecj-4.6.3.jar:lib/el-api.jar:lib/jasper-el.jar:lib/jasper.jar:lib/jaspic-api.jar:lib/jsp-api.jar:lib/servlet-api.jar:lib/tomcat-api.jar:lib/tomcat-coyote.jar:lib/tomcat-dbcp.jar:lib/tomcat-i18n-es.jar:lib/tomcat-jdbc.jar:lib/tomcat-jni.jar:lib/tomcat-util.jar:lib/tomcat-util-scan.jar:lib/tomcat-websocket.jar:lib/websocket-api.jar org.apache.catalina.startup.Bootstrap start

I've enumerated all jars in the classpath option because it seems like avian doesn't support wildcards yet.

@dicej
Copy link
Member

dicej commented Jun 28, 2017

Hi Anton,

That looks like a bug; thanks for reporting it. I'll investigate it this weekend when I have time.

@dicej
Copy link
Member

dicej commented Jul 3, 2017

Would you please give this a try when you have a chance?

#538

It's been a long time since I tried to run Tomcat with Avian, so there may be other issues besides this one. I'm currently running low on disk space on my laptop, so I can't test Tomcat myself right now, but the above PR should fix the StackOverflowError, at least.

@AntonBikineev
Copy link
Author

AntonBikineev commented Jul 3, 2017

Hi Joel,
Yeah, your patch fixes the problem! And the simple tomcat application runs fine. However, I've noticed a couple of other problems:

  1. There is no log in stdout/stderr that I can observe;
  2. I can run tomcat under hotspot using the following command line:
java -cp bin/bootstrap.jar:bin/tomcat-juli.jar org.apache.catalina.startup.Bootstrap start

I don't understand how hotspot recognizes that it needs to load jars from the lib directory (I couldn't find corresponding "Class-Path" lines in manifest files). If I run avian using the same arguments, it just returns with 0 error code.
3) With hotspot I can specify wildcards in '-cp' argument, whereas avian again returns with 0 return code. It also seems to speed up class loading in hotspot.
So the only way I found to run tomcat using avian is by specifying all jars in command line, e.g.:

 ~/git/avian-openjdk-2/build/linux-x86_64-openjdk-src/avian -cp bin/bootstrap.jar:bin/tomcat-juli.jar:lib/annotations-api.jar:lib/catalina-ant.jar:lib/catalina-ha.jar:lib/catalina.jar:lib/catalina-storeconfig.jar:lib/catalina-tribes.jar:lib/ecj-4.6.3.jar:lib/el-api.jar:lib/jasper-el.jar:lib/jasper.jar:lib/jaspic-api.jar:lib/jsp-api.jar:lib/servlet-api.jar:lib/tomcat-api.jar:lib/tomcat-coyote.jar:lib/tomcat-dbcp.jar:lib/tomcat-i18n-es.jar:lib/tomcat-jdbc.jar:lib/tomcat-jni.jar:lib/tomcat-util.jar:lib/tomcat-util-scan.jar:lib/tomcat-websocket.jar:lib/websocket-api.jar org.apache.catalina.startup.Bootstrap start

@dicej
Copy link
Member

dicej commented Jul 5, 2017

I just downloaded Tomcat 9 and tried running it with Avian. The output is at the end of this post.

It looks like there are several problems, the most serious of which is that the VM seems to be aborting due to an assertion failure when handling a lambda expression. That's not a big surprise, since lambdas are still a work in progress on Avian, as you can see in #539.

I'm not sure why you're not getting any stdout/stderr output, though. Which version of Tomcat are you using?

I'll look more closely at this when I have time this weekend.

$ ~/p/avian/build/linux-x86_64-debug-openjdk/avian-dynamic -cp bin/bootstrap.jar:bin/tomcat-juli.jar org.apache.catalina.startup.Bootstrap start
Jul 05, 2017 7:47:30 AM org.apache.tomcat.util.digester.Digester endElement
SEVERE: End event threw exception
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:377)
at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:145)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:923)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2967)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1435)
at org.apache.tomcat.util.modeler.modules.MbeansDescriptorsDigesterSource.execute(MbeansDescriptorsDigesterSource.java:169)
at org.apache.tomcat.util.modeler.modules.MbeansDescriptorsDigesterSource.loadDescriptors(MbeansDescriptorsDigesterSource.java:148)
at org.apache.tomcat.util.modeler.Registry.load(Registry.java:589)
at org.apache.tomcat.util.modeler.Registry.loadDescriptors(Registry.java:667)
at org.apache.catalina.mbeans.MBeanUtils.createRegistry(MBeanUtils.java:545)
at org.apache.catalina.mbeans.MBeanUtils.(MBeanUtils.java:71)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.(GlobalResourcesLifecycleListener.java:66)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:117)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1153)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1418)
at org.apache.catalina.startup.Catalina.load(Catalina.java:580)
at org.apache.catalina.startup.Catalina.load(Catalina.java:631)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)
Caused by: java.lang.NoClassDefFoundError: IllegalName: org/apache/tomcat/util/modeler/ParameterInfo
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at avian.Classes.forName(Classes.java:298)
at avian.Classes.forCanonicalName(Classes.java:316)
at java.lang.invoke.MethodType.parameters(Unknown Source)
at java.lang.invoke.MethodType.result(Unknown Source)
at java.lang.invoke.LambdaMetafactory.makeInvocationCode(LambdaMetafactory.java:198)
at java.lang.invoke.LambdaMetafactory.makeLambda(LambdaMetafactory.java:283)
at java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:335)
at org.apache.tomcat.util.modeler.ManagedBean.createOperationKey(ManagedBean.java:570)
at org.apache.tomcat.util.modeler.ManagedBean.addOperation(ManagedBean.java:266)
... 52 more

Jul 05, 2017 7:47:31 AM org.apache.tomcat.util.modeler.modules.MbeansDescriptorsDigesterSource execute
SEVERE: Error digesting Registry data
org.xml.sax.SAXParseException; lineNumber: 43; columnNumber: 17; Error at (43, 17) : null
at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:1854)
at org.apache.tomcat.util.digester.Digester.createSAXException(Digester.java:1886)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:926)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(AbstractSAXParser.java:609)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XMLDocumentFragmentScannerImpl.java:1782)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2967)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1435)
at org.apache.tomcat.util.modeler.modules.MbeansDescriptorsDigesterSource.execute(MbeansDescriptorsDigesterSource.java:169)
at org.apache.tomcat.util.modeler.modules.MbeansDescriptorsDigesterSource.loadDescriptors(MbeansDescriptorsDigesterSource.java:148)
at org.apache.tomcat.util.modeler.Registry.load(Registry.java:589)
at org.apache.tomcat.util.modeler.Registry.loadDescriptors(Registry.java:667)
at org.apache.catalina.mbeans.MBeanUtils.createRegistry(MBeanUtils.java:545)
at org.apache.catalina.mbeans.MBeanUtils.(MBeanUtils.java:71)
at org.apache.catalina.mbeans.GlobalResourcesLifecycleListener.(GlobalResourcesLifecycleListener.java:66)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRule.java:117)
at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1153)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser.emptyElement(AbstractXMLDocumentParser.java:182)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1339)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2784)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(SAXParserImpl.java:643)
at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1418)
at org.apache.catalina.startup.Catalina.load(Catalina.java:580)
at org.apache.catalina.startup.Catalina.load(Catalina.java:631)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:311)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:494)
Caused by: java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.tomcat.util.IntrospectionUtils.callMethod1(IntrospectionUtils.java:377)
at org.apache.tomcat.util.digester.SetNextRule.end(SetNextRule.java:145)
at org.apache.tomcat.util.digester.Digester.endElement(Digester.java:923)
... 45 more
Caused by: java.lang.NoClassDefFoundError: IllegalName: org/apache/tomcat/util/modeler/ParameterInfo
at java.lang.ClassLoader.preDefineClass(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at avian.Classes.forName(Classes.java:298)
at avian.Classes.forCanonicalName(Classes.java:316)
at java.lang.invoke.MethodType.parameters(Unknown Source)
at java.lang.invoke.MethodType.result(Unknown Source)
at java.lang.invoke.LambdaMetafactory.makeInvocationCode(LambdaMetafactory.java:198)
at java.lang.invoke.LambdaMetafactory.makeLambda(LambdaMetafactory.java:283)
at java.lang.invoke.LambdaMetafactory.metafactory(LambdaMetafactory.java:335)
at org.apache.tomcat.util.modeler.ManagedBean.createOperationKey(ManagedBean.java:570)
at org.apache.tomcat.util.modeler.ManagedBean.addOperation(ManagedBean.java:266)
... 52 more

Jul 05, 2017 7:47:31 AM org.apache.tomcat.util.modeler.Registry loadDescriptors
SEVERE: Error loading jar:file:/home/dicej/trash/apache-tomcat-9.0.0.M22/lib/catalina.jar!/org/apache/catalina/mbeans/mbeans-descriptors.xml
Aborted

@dicej
Copy link
Member

dicej commented Jul 9, 2017

Tomcat 9 is working for me as of this commit: a329416

I run it like this:

~/p/avian/build/linux-x86_64-debug-openjdk/avian-dynamic -cp bin/bootstrap.jar:bin/tomcat-juli.jar org.apache.catalina.startup.Bootstrap start

Please let me know if you're still having trouble with the latest code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants