I am trying to get my development environment up and running, and I am having trouble with Tomcat trying to load JSF classes for some reason. My application does not use JSF; in fact, I haven't even deployed my application to tomcat yet. I am getting a number of stack traces in the startup logs and I cannot load the default tomcat homepage when I try to open http://localhost:8080 (I just get the tomcat 404 page).
Here is what the first stack trace is:
SEVERE: Error configuring application listener of class com.sun.faces.util.ReflectionUtils$ReflectionUtilsListener
java.lang.ClassNotFoundException: com.sun.faces.util.ReflectionUtils$ReflectionUtilsListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1386)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1232)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3712)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4216)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:544)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:626)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:553)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:488)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1150)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:736)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:700)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
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:324)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:295)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:433)
I also get similar stack traces for the following other classes:
com.sun.faces.config.ConfigureListener
com.sun.faces.application.WebappLifecycleListener
I'm not sure if this is relevant, but I am running Tomcat 5.5.27 with the 1.4 compatibility pack installed, with Java 1.4.2, on Mas OS 10.5.
Thanks for any ideas!
EDIT: It seems that each of the default applications that come with Tomcat (host-manager, balancer, tomcat-docs, jsp-examples, etc) was relying on these JSF classes. I removed these default applications, and everything seems to be working.
So, my question is now:
Why does tomcat come with applications that don't include their dependencies, and what do I need to do to make those default applicaitons work?
Is your tomcat installation totally clean, or is it one you have inherited?
Check if the webapps contains existing wars/directories which may be referencing JSF classes?
UPDATE: Ah -- I see you found this was the case :-)
Not sure why tomcat doesn't include all its dependencies. Perhaps you downloaded a developer release instead of a stable one?
You might have to clean the Tomcat work directory.
Related
When Tomcat loads my war, I get this error:
Exception in thread "ClientMessageReceptor0" java.lang.NoClassDefFoundError: java/net/Inet6Address
at org.jacorb.orb.iiop.IIOPAddress.getNetworkInetAddresses(IIOPAddress.java:675)
at org.jacorb.orb.iiop.IIOPAddress.getLocalHost(IIOPAddress.java:591)
at org.jacorb.orb.iiop.IIOPAddress.getLocalHostAddress(IIOPAddress.java:574)
at org.jacorb.orb.listener.SSLListenerUtil.processException(SSLListenerUtil.java:73)
at org.jacorb.orb.iiop.IIOPConnection.handleCommFailure(IIOPConnection.java:77)
at org.jacorb.orb.etf.StreamConnectionBase.read(StreamConnectionBase.java:139)
at org.jacorb.orb.giop.GIOPConnection.getMessage(GIOPConnection.java:389)
at org.jacorb.orb.giop.GIOPConnection.receiveMessagesLoop(GIOPConnection.java:541)
at org.jacorb.orb.giop.GIOPConnection.receiveMessages(GIOPConnection.java:533)
at org.jacorb.orb.giop.MessageReceptor.doWork(MessageReceptor.java:69)
at org.jacorb.util.threadpool.ConsumerTie.run(ConsumerTie.java:60)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassNotFoundException: Illegal access: this web application instance has been stopped already. Could not load [java.net.Inet6Address]. The following stack trace is thrown for debugging purposes as well as to attempt to terminate the thread which caused the illegal access.
at org.apache.catalina.loader.WebappClassLoaderBase.checkStateForClassLoading(WebappClassLoaderBase.java:1375)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1226)
at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1188)
Our application uses Tomcat v9.0.41 and JDK 1.8.0_111 . This same combination works for others in my team and also it worked for me sometime back. I'm not sure what changed now. I have looked at other similar posts and they suggest mismatch between Tomcat and JDK version. But above combination of Tomcat and JDK works for others.
I have removed all other JDK and JRE version on my system.
Ensured JAVA_HOME points to JDK 1.8.0_111 and PATH points to correct JRE.
Any pointers on how to debug this further? Can I turn on some logging during Tomcat startup to see what paths are being used by Tomcat? Any suggestions are highly appreciated :).
In our application we sometimes (about 1 out of 10 times) get a NoClassDefFoundError when trying to instantiate a class. It happens when a project is opened from without our application.
The full stack trace looks like this:
!ENTRY org.eclipse.jface 4 2 2011-11-18 12:45:33.941
!MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.jface".
!STACK 0
java.lang.NoClassDefFoundError: com.mycompany.products.myapp.gui.model.provider.EMyAppObjectItemProvider
at com.mycompany.products.myapp.gui.model.provider.MyappguimodelItemProviderAdapterFactory.createMyAppGuiPortAdapter(MyappguimodelItemProviderAdapterFactory.java:159)
at com.mycompany.products.myapp.gui.model.util.MyappguimodelAdapterFactory$1.caseMyAppGuiPort(MyappguimodelAdapterFactory.java:185)
at com.mycompany.products.myapp.gui.model.util.MyappguimodelAdapterFactory$1.caseMyAppGuiPort(MyappguimodelAdapterFactory.java:1)
at com.mycompany.products.myapp.gui.model.util.MyappguimodelSwitch.doSwitch(MyappguimodelSwitch.java:226)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:59)
at org.eclipse.emf.ecore.util.Switch.doSwitch(Switch.java:75)
at com.mycompany.products.myapp.gui.model.util.MyappguimodelAdapterFactory.createAdapter(MyappguimodelAdapterFactory.java:462)
at org.eclipse.emf.common.notify.impl.AdapterFactoryImpl.createAdapter(AdapterFactoryImpl.java:133)
at org.eclipse.emf.common.notify.impl.AdapterFactoryImpl.adaptNew(AdapterFactoryImpl.java:107)
at org.eclipse.emf.common.notify.impl.AdapterFactoryImpl.adapt(AdapterFactoryImpl.java:93)
at com.mycompany.products.myapp.gui.model.provider.MyappguimodelItemProviderAdapterFactory.adapt(MyappguimodelItemProviderAdapterFactory.java:1127)
at org.eclipse.emf.edit.provider.ComposedAdapterFactory.adapt(ComposedAdapterFactory.java:300)
at org.eclipse.emf.edit.provider.ComposedAdapterFactory.adapt(ComposedAdapterFactory.java:277)
at org.eclipse.emf.edit.provider.ComposedAdapterFactory.adapt(ComposedAdapterFactory.java:264)
at org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider.getColumnText(AdapterFactoryLabelProvider.java:496)
at org.eclipse.jface.viewers.TableColumnViewerLabelProvider.update(TableColumnViewerLabelProvider.java:70)
at org.eclipse.jface.viewers.ViewerColumn.refresh(ViewerColumn.java:152)
at org.eclipse.jface.viewers.AbstractTableViewer.doUpdateItem(AbstractTableViewer.java:399)
at org.eclipse.jface.viewers.StructuredViewer$UpdateItemSafeRunnable.run(StructuredViewer.java:485)
at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
at org.eclipse.ui.internal.JFaceUtil$1.run(JFaceUtil.java:49)
at org.eclipse.jface.util.SafeRunnable.run(SafeRunnable.java:175)
at org.eclipse.jface.viewers.StructuredViewer.updateItem(StructuredViewer.java:2167)
at org.eclipse.jface.viewers.AbstractTableViewer.createItem(AbstractTableViewer.java:277)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefreshAll(AbstractTableViewer.java:757)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:649)
at org.eclipse.jface.viewers.AbstractTableViewer.internalRefresh(AbstractTableViewer.java:636)
at org.eclipse.jface.viewers.AbstractTableViewer$2.run(AbstractTableViewer.java:592)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1443)
at org.eclipse.jface.viewers.StructuredViewer.preservingSelection(StructuredViewer.java:1404)
at org.eclipse.jface.viewers.AbstractTableViewer.inputChanged(AbstractTableViewer.java:590)
at org.eclipse.jface.viewers.ContentViewer.setInput(ContentViewer.java:280)
at org.eclipse.jface.viewers.StructuredViewer.setInput(StructuredViewer.java:1690)
at com.mycompany.products.myapp.gui.views.port.composites.Ipv4PortComposite.projectOpenedOrClosed(Ipv4PortComposite.java:732)
at com.mycompany.products.myapp.gui.project.MyAppResourceController.tellOpenCloseListeners(MyAppResourceController.java:186)
at com.mycompany.products.myapp.gui.actions.project.MyAppGuiResourceController.openProject(MyAppGuiResourceController.java:266)
at com.mycompany.products.myapp.gui.project.MyAppResourceController.open(MyAppResourceController.java:592)
at com.mycompany.products.myapp.gui.project.MyAppResourceController.openWithoutUpdating(MyAppResourceController.java:612)
at com.mycompany.products.myapp.gui.actions.file.MyAppRecentProjectAction.run(MyAppRecentProjectAction.java:55)
at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3588)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3209)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2696)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2660)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2494)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:674)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:667)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at com.mycompany.products.myapp.gui.MyAppApplication.start(MyAppApplication.java:175)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:344)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
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:616)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:622)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:577)
at org.eclipse.equinox.launcher.Main.run(Main.java:1410)
at org.eclipse.equinox.launcher.M
These related questions didn't answer my problem:
NoClassDefFoundError on JFace FontRegistry
Getting class not found Exception when running in eclipse
From what I've read this exception occurs when the class is not found in the runtime class-path. So I think it would be useful if I could print the runtime search paths before the actual attempt at instantiation. This way I can check if there is any difference in the 1/10 times it fails. However, I haven't found yet how to get the list of runtime search paths. Any hints on how to get them?
Can anyone help me fix this problem?
For classloading issues Java offers some tools. Look Do you really get class loaders on Slideshare. I once had a similar problem with the help system of Eclipse which I integrated in my RCP product. When started within the IDE everything worked fine but when starting the exported product the help system just doesn't come up.
Do you get this when starting the application? This sounds like some bundles haven't been initialized at that point. OSGi will start modules based on the dependencies, but there's a random element when you don't have the proper dependencies set in place. I would suggest looking at that. If you want more info, you can use the OSGi console to examine your environment:
http://www.ibm.com/developerworks/library/os-ecl-osgiconsole/index.html
Hope this helps.
Try to run your application in the debugger with the OSGi console enabled (-console). Add a Class breakpoint for NoClassDefFoundError or alternatively on the offending line of code (MyappguimodelItemProviderAdapterFactory.java:159).
And, when the breakpoint is hit:
find the bundle ID of the bundle with MyappguimodelItemProviderAdapterFactory - e.g. with the ss OSGi command
find the complete status of the bundle with the bundle <id> OSGi command
check whether the package in question - com.mycompany.products.myapp.gui.model.provider - is wired correctly in the "Imported Packages" section
I don't know what can be wrong, but you should check that
the correct package wiring has been set up - possibly using packages com.mycompany.products.myapp.gui.model.provider OSGi command to find all the providers
the bundle with EMyAppObjectItemProvider actually includes the class - you can find the jar used by OSGi with the status OSGi command (don't assume you know :-))
I am using the following code in a servlet of my app
java.awt.Image awtImg = java.awt.Toolkit.getDefaultToolkit().createImage(str1);
When I run the application and call the servlet I get the following error
java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11.XToolkit
java.lang.Class.forName0(Native Method)
java.lang.Class.forName(Class.java:169)
java.awt.Toolkit$2.run(Toolkit.java:834)
java.security.AccessController.doPrivileged(Native Method)
java.awt.Toolkit.getDefaultToolkit(Toolkit.java:826)
noticeandreports.pdf.appendFiles.PdfFunctionsClass.addSealSpace(PdfFunctionsClass.java:198)
OJ.NoticesandReports.generate_151_OJNotice.execute(generate_151_OJNotice.java:768)
org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:425)
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:228)
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913)
org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462)
javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
I have hosted the app on a Linux machine with Java version JDK 1.6.20..
What might be causing the issue...
noticeandreports.pdf.appendFiles.PdfFunctionsClass is the class where the code is written and OJ.NoticesandReports.generate_151_OJNotice is the servlet that calls the method inside the above class...
To use AWT classes in a server side application, I believe you need to run in "headless" mode. Change your servlet container's startup to include:
-Djava.awt.headless=true
(Or set the system property within your own code if you really have to.)
You might also want to consider using an alternative imaging library - either a third-party one or the javax.imageio package.
That is almost certainly not the complete stack trace. Either that stack trace or an earlier one in the log file will tell you what caused the initialization of sun.awt.X11.XToolkit to fail.
However, I'd hazard a guess that the root cause is that the JVM running the web countainer is "headless"; i.e. it doesn't have an accessible display.
The Oracle Java Technical Article entitled "Using Headless Mode in the Java SE Platform" (by Artem Ananiev and Alla Redko, June 2006) describes the issue and what to do about it.
The solution is probably as simple as adding -Djava.awt.headless=true to the JVM options in the web container startup script. For instance, if you are using Tomcat, add that to the $JAVA_OPTS environment variable before calling catalina.sh.
hey, I am having somewhat related issue only. Recently the external SOAP interface which were generating client for changed to https one. and I had an old code base at hand which was generating the java files through cxf and unsecured, http:// based wsdl. I chnaged the uri and on maven side everything works fine even the test pass. but when i use this jar in the main project of mine I get this:
Caused by: java.lang.NoSuchMethodError: javax.net.ssl.HttpsURLConnection.getSSLSocketFactory()Ljavax/net/ssl/SSLSocketFactory;
at sun.net.www.protocol.https.DelegateHttpsURLConnection.getSSLSocketFactory(DelegateHttpsURLConnection.java:50)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:172)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:801)
at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:158)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1049)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:234)
at java.net.URL.openStream(URL.java:1010)
at org.apache.cxf.resource.URIResolver.tryFileSystem(URIResolver.java:169)
at org.apache.cxf.resource.URIResolver.resolve(URIResolver.java:119)
at org.apache.cxf.resource.ExtendedURIResolver.resolve(ExtendedURIResolver.java:41)
at org.apache.cxf.transport.TransportURIResolver.resolve(TransportURIResolver.java:134)
at org.apache.cxf.catalog.CatalogWSDLLocator.getBaseInputSource(CatalogWSDLLocator.java:72)
at org.apache.cxf.wsdl11.AbstractWrapperWSDLLocator.getBaseInputSource(AbstractWrapperWSDLLocator.java:57)
at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:214)
at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:179)
at org.apache.cxf.wsdl11.WSDLServiceFactory.(WSDLServiceFactory.java:91)
at org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:207)
at org.apache.cxf.jaxws.ServiceImpl.(ServiceImpl.java:150)
at org.apache.cxf.jaxws.spi.ProviderImpl.createServiceDelegate(ProviderImpl.java:63)
at javax.xml.ws.Service.(Service.java:56)
at generated.webservices.com.gbm.sso.ssoclient.AuthenticationServiceInternal.(AuthenticationServiceInternal.java:49)
at com.gbm.caprice.sso.client.CachingSSOClient.init(CachingSSOClient.java:42)
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:597)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1536)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
... 45 more
Can you please help?
Since you're getting a NoSuchMethodError (which is caught/thrown by the compiler), My suggestion is that you are using a version of Java class (in this case, javax.net.ssl.HttpsURLConnection) which doesn't have the following method signature:
javax.net.ssl.HttpsURLConnection.getSSLSocketFactory()
This class can be found in the JRE/lib jsse.jar (as from time of writing, JDK 1.6.0_21). Make sure that your java libraries and your Apache CXF libaries are declared in the java CLASSPATH.
That's what I can help you based on your caused exception.
I would like to monitor remote glassfish server. I have enabled JMX Connection in domain.xml:
<jmx-connector accept-all="true" address="0.0.0.0" auth-realm-name="admin-realm" enabled="true" name="system" port="8686" protocol="rmi_jrmp" security-enabled="false">
But this didn't help. I still can't connect to server with JConsole. Then I've found solution - I need to specify JVM properties in domain.xml to open 8686 port for remote connection.
So I added this lines into java-config section:
<jvm-options>-Dcom.sun.management.jmxremote</jvm-options>
<jvm-options>-Dcom.sun.management.jmxremote.port=8686</jvm-options>
<jvm-options>-Dcom.sun.management.jmxremote.local.only=false</jvm-options>
<jvm-options>-Dcom.sun.management.jmxremote.authenticate=false</jvm-options>
But now when I'm starting server, I'm getting following errors:
Could not load Logmanager
"com.sun.enterprise.server.logging.ServerLogManager"
java.lang.ClassNotFoundException:
com.sun.enterprise.server.logging.ServerLogManager
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:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at java.util.logging.LogManager$1.run(LogManager.java:166)
at java.security.AccessController.doPrivileged(Native
Method)
at java.util.logging.LogManager.(LogManager.java:156)
at java.util.logging.Logger.getLogger(Logger.java:273)
at sun.management.snmp.util.MibLogger.(MibLogger.java:57)
at sun.management.snmp.util.MibLogger.(MibLogger.java:42)
at sun.management.jmxremote.ConnectorBootstrap.(ConnectorBootstrap.java:760)
at sun.management.Agent.startAgent(Agent.java:127)
at sun.management.Agent.startAgent(Agent.java:239)
javax.management.JMRuntimeException:
Failed to load MBeanServerBuilder
class
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder:
java.lang.ClassNotFoundException:
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder
at javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:480)
at javax.management.MBeanServerFactory.getNewMBeanServerBuilder(MBeanServerFactory.java:511)
at javax.management.MBeanServerFactory.newMBeanServer(MBeanServerFactory.java:298)
at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:213)
at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:174)
at sun.management.ManagementFactory.createPlatformMBeanServer(ManagementFactory.java:302)
at java.lang.management.ManagementFactory.getPlatformMBeanServer(ManagementFactory.java:504)
at sun.management.jmxremote.ConnectorBootstrap.initialize(ConnectorBootstrap.java:392)
at sun.management.Agent.startAgent(Agent.java:127)
at sun.management.Agent.startAgent(Agent.java:239)
Caused by:
java.lang.ClassNotFoundException:
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder
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:307)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at javax.management.MBeanServerFactory.loadBuilderClass(MBeanServerFactory.java:423)
at javax.management.MBeanServerFactory.checkMBeanServerBuilder(MBeanServerFactory.java:465)
... 9 more Exception thrown by the agent :
javax.management.JMRuntimeException:
Failed to load MBeanServerBuilder
class
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder:
java.lang.ClassNotFoundException:
com.sun.enterprise.admin.server.core.jmx.AppServerMBeanServerBuilder
How can I fix the problem?
Thanks in advance.
Still mystical behavior, but with these 4 settings you can connect to the JVM running Glassfish (add to domain.xml in admin console, restart required)
-Djava.rmi.server.hostname=yourhost
-Dcom.sun.management.jmxremote.port=8686
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
Beware ! This is not safe, as anyone now can connect a jconsole to it !
IMO this is not the Glassfish way, which is using the JMX connector.
(Above works in GF 3.1)
Steps to solve the problem are:
1. use default settings
2. add -Djava.rmi.server.hostname= in the JVM Options of the instance of GlassFish.
I ended up setting the following option to ensure that JMX with Glassfish is firewall friendly:
<jvm-options>-Dcom.sun.aas.jconsole.server.cbport=XXXX</jvm-options>
Where XXXX is the port number that you use in the firewall together with the application server configured JMX port number (usually 8686).
Read more in this blogpost. Note that this feature requires a newer version of Glassfish. I've successfully used it with Glassfish 2.1.1.
Isn't it GlassFish issue 1409?
If run your application inside Glassfish app server, simply run the following asadmin command, you would need to restart all running servers for the change to take affect.
./asadmin enable-secure-admin
There are extra Glassfish server configurations to further enable security, see more at Connecting remotely to Glassfish through JMX.
You do need to follow the steps on JVM options, these are instructions for Java applications in general. For a Java application that runs with Glassfish application server, simply using the asadm command. That saved me lots of time!
** Another note, with only the settings using JVM options, Glassfish would fail to start with the above runtime exceptions.
** I am using GF3.1.2 and above, and Java 7.