Error Running RCP Project in Eclipse - java

I have inherited an existing RCP project, and I am totally new to how this type of project works.
I am running Eclipse IDE for Java Developers (Version: Oxygen.3 Release (4.7.3)).
When I try to run the project as an Eclipse application, I get the following error:
java.lang.NullPointerException
at org.eclipse.e4.ui.internal.workbench.ModelServiceImpl.<init>(ModelServiceImpl.java:122)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createDefaultContext(E4Application.java:511)
at org.eclipse.e4.ui.internal.workbench.swt.E4Application.createE4Workbench(E4Application.java:204)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:614)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:594)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:148)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:151)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
I have seen some solutions for this issue saying org.eclipse.equinox.ds and org.eclipse.equinox.event are required to be included in the plugin dependencies, but this has not solved my problem.

To solve this issue, I did the following:
Delete my Run configuration: Run > Run Configuration, then select the configuration, press big red x button, close
Created product configuration: File > New > Other, then Plugin Development > Product Configuration, next, select project, provide product configuration filename, finish
Product configuration file should be opened automatically (if not, open it), then, select Contents tab, and add the org.eclipse.equinox.event plugin
Select Configuration tab, add org.eclipse.equinox.event to Start Levels and set Auto-Start to true

Related

Java - UML Diagram [duplicate]

I'm trying to use ObjectAid tool for UML diagram.
When I tried to create UML diagram for my package, in spring boot project
(⌘ + N -> ObjectAid Class Diagram ) , and when I hit finish, nothing happens, the window remains as it is, but in log, an exception appears.
The below exception appears each time I click on 'finish'.:-
java.lang.NoClassDefFoundError: Could not initialize class com.thoughtworks.xstream.converters.collections.PropertiesConverter
at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:647)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:445)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:385)
at com.thoughtworks.xstream.XStream.<init>(XStream.java:342)
at com.objectaid.uml.model.persistence.DiagramXStream.<init>(DiagramXStream.java:30)
at com.objectaid.uml.model.diagram.DiagramFactory.createXStream(DiagramFactory.java:99)
at com.objectaid.uml.model.diagram.DiagramFactory.getStream(DiagramFactory.java:89)
at com.objectaid.uml.model.diagram.DiagramFactory.marshal(DiagramFactory.java:268)
at com.objectaid.uml.model.diagram.DiagramFactory.marshalComplete(DiagramFactory.java:297)
at com.objectaid.uml.editor.NewDiagramWizard.createNewFile(NewDiagramWizard.java:99)
at com.objectaid.uml.editor.NewDiagramWizard.performFinish(NewDiagramWizard.java:59)
at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:832)
at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:472)
at org.eclipse.jface.dialogs.Dialog.lambda$0(Dialog.java:619)
at org.eclipse.swt.events.SelectionListener$1.widgetSelected(SelectionListener.java:84)
at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:252)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4441)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1512)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1535)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1324)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4227)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3837)
at org.eclipse.jface.window.Window.runEventLoop(Window.java:823)
at org.eclipse.jface.window.Window.open(Window.java:799)
at org.eclipse.ui.internal.handlers.WizardHandler$New.executeHandler(WizardHandler.java:263)
at org.eclipse.ui.internal.handlers.WizardHandler.execute(WizardHandler.java:283)
at org.eclipse.ui.internal.handlers.HandlerProxy.execute(HandlerProxy.java:283)
at org.eclipse.ui.internal.handlers.E4HandlerProxy.execute(E4HandlerProxy.java:97)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
at org.eclipse.e4.core.internal.di.InjectorImpl.invokeUsingClass(InjectorImpl.java:319)
at org.eclipse.e4.core.internal.di.InjectorImpl.invoke(InjectorImpl.java:253)
at org.eclipse.e4.core.contexts.ContextInjectionFactory.invoke(ContextInjectionFactory.java:173)
at org.eclipse.e4.core.commands.internal.HandlerServiceHandler.execute(HandlerServiceHandler.java:156)
at org.eclipse.core.commands.Command.executeWithChecks(Command.java:488)
at org.eclipse.core.commands.ParameterizedCommand.executeWithChecks(ParameterizedCommand.java:487)
at org.eclipse.e4.core.commands.internal.HandlerServiceImpl.executeHandler(HandlerServiceImpl.java:213)
at org.eclipse.ui.internal.handlers.LegacyHandlerService.executeCommand(LegacyHandlerService.java:389)
at org.eclipse.ui.internal.actions.CommandAction.runWithEvent(CommandAction.java:142)
at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:580)
at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:414)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4441)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1512)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1535)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1520)
at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1324)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4227)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3837)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:644)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:551)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:156)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:78)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:654)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1462)
I am on mac, followed installation instructions from official page: https://www.objectaid.com/install-objectaid
Eclipse version:
Eclipse IDE for Enterprise Java and Web Developers (includes
Incubating components)
Version: 2021-06 (4.20.0) Build id: 20210612-2011
It seems that ObjectAid is no longer maintained. I got this error running on JDK17.
There is a workaround:
Download xstream 1.4.18 jar
Locate the com.objectaid.uml_1.2.4.jar file and open it (with the zip tool of your choice)
Delete the xstream-1.3.1.jar file inside the lib directory. Add the xstream-1.4.18.jar to the lib directory.
Open the file META-INF/MANIFEST.MF and replace line lib/xstream-1.3.1.jar with lib/xstream-1.4.18.jar.
Add to your eclipse.ini the following vmargs: --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED
Restart Eclipse with -clean to ensure the OSGI cache is purged.
Working with Eclipse 2022-09 and Java 17, I faced similar issues as described initially. For that I just followed the points 1 .- 4., but worked on an "installation archive" of ObjectAID.
Instead of editing the eclipse.ini, I simply uninstalled the 'old' ObjectAID and re-installed it from that edited "installation archive". That worked!

automatically import maven projects from .bat file

I have a .bat file that is creating the workspace for eclipse when executed on windows.
I want to import the maven projects when the .bat file is executed.(instead of manually adding the maven projects in eclipse)
So I added in the .bat file:
call mvn -Declipse.workspace=eclipseWorkspace eclipse:add-maven-repo
call eclipse -nosplash -application
org.eclipse.cdt.managedbuilder.core.headlessbuild -importAll
"svn://Repository..."
but got this error for the second call eclipse..:
!MESSAGE Application error !STACK 1 java.lang.RuntimeException:
Application "org.eclipse.cdt.managedbuilder.core.headlessbuild" could
not be found in the registry. The applications available are:
org.eclipse.ant.core.antRunner,
org.eclipse.e4.ui.workbench.swt.E4Application,
org.eclipse.e4.ui.workbench.swt.GenTopic,
org.eclipse.equinox.app.error, org.eclipse.equinox.p2.director,
org.eclipse.equinox.p2.garbagecollector.application,
org.eclipse.equinox.p2.publisher.InstallPublisher,
org.eclipse.equinox.p2.publisher.EclipseGenerator,
org.eclipse.equinox.p2.publisher.ProductPublisher,
org.eclipse.equinox.p2.publisher.FeaturesAndBundlesPublisher,
org.eclipse.equinox.p2.reconciler.application,
org.eclipse.equinox.p2.repository.repo2runnable,
org.eclipse.equinox.p2.repository.metadataverifier,
org.eclipse.equinox.p2.artifact.repository.mirrorApplication,
org.eclipse.equinox.p2.metadata.repository.mirrorApplication,
org.eclipse.equinox.p2.touchpoint.natives.nativePackageExtractor,
org.eclipse.equinox.p2.updatesite.UpdateSitePublisher,
org.eclipse.equinox.p2.publisher.UpdateSitePublisher,
org.eclipse.equinox.p2.publisher.CategoryPublisher,
org.eclipse.jdt.apt.core.aptBuild, org.eclipse.ui.ide.workbench,
org.eclipse.ant.ui.antRunner,
org.eclipse.help.base.infocenterApplication,
org.eclipse.help.base.helpApplication,
org.eclipse.help.base.indexTool,
org.eclipse.jdt.core.JavaCodeFormatter,
org.eclipse.jdt.core.JavaIndexer. at
org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:248)
at
org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:29)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
at
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
at
org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
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(Method.java:497) at
org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669) at
org.eclipse.equinox.launcher.Main.basicRun(Main.java:608) at
org.eclipse.equinox.launcher.Main.run(Main.java:1515)
I could not find an example how to import maven project into eclipse through cmd. If someone can share some knowledge it will be highly appreciated.
Regards,
Kire
What is the reason you import it headless?
If you want to provide a "taylormade" Eclipse incl. Workspace you can try Oomph or Eclipse Profiles -> http://profiles.yatta.de?download. Eclipse Profiles has SVN ...

Eclipse stops working, hangs and stops responding to any actions

Eclipse hangs.
I've run jstack on the process and got the following:
"main" prio=10 tid=0x00007f531000b000 nid=0xbd3 waiting for monitor entry [0x00007f5317b69000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.tmatesoft.svn.core.internal.util.jna.SVNGnomeKeyring$3.callback(SVNGnomeKeyring.java:88)
- waiting to lock <0x0000000606027b40> (a java.lang.Object)
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:606)
at com.sun.jna.CallbackReference$DefaultCallbackProxy.invokeCallback(CallbackReference.java:455)
at com.sun.jna.CallbackReference$DefaultCallbackProxy.callback(CallbackReference.java:485)
at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2302)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3361)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:140)
at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:611)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
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:354)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
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:606)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Eclipse version is:
Eclipse Standard/SDK
Version: Kepler Service Release 2
Build id: 20140224-0627
Plugins:
Subclipse 1.10.5 with:
Subclipse (Required) 1.10.5 org.tigris.subversion.subclipse.feature.group tigris.org
Subversion Client Adapter (Required) 1.10.1 org.tigris.subversion.clientadapter.feature.feature.group tigris.org
SVNKit Client Adapter (Not required) 1.8.9 org.tigris.subversion.clientadapter.svnkit.feature.feature.group tigris.org
SVNKit Library 1.7.9.r9659_v20130411_2103 org.tmatesoft.svnkit.feature.group TMate Software
OS:
lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04 LTS
Release: 14.04
Codename: trusty
Any ideas how to resove it? I tried to reinstall plugins, reinstall Eclipse itself. The problem still exists.
This looks like Issue 1651 in the Subclipse issue tracker, which falls right between Subclipse, SVNKit and GNOME Keyring.
The issue can be worked around by configuring Subversion not to use GNOME Keyring. If storing credentials in plaintext is acceptable, Subversion may be configured as following:
In ~/.subversion/servers, under [global], set store-passwords and store-plaintext-passwords to yes:
[global]
#...skipping...
#
# Password / passphrase caching parameters:
store-passwords = yes
store-plaintext-passwords = yes
In ~/.subversion/config, under [auth], set password-stores to an empty string:
[auth]
#...skipping...
### To disable all password stores, use an empty list:
password-stores =
(Tested on Subversion 1.9.5, configuration may differ for other versions.)

Deploying web app using Ant results in NoClassDefFoundError

I'm using Ant 1.9.3 and Tomcat version 8.0. I'm using the Ant deploy target to deploy web apps in the Apache Tomcat using the manager credentials. The deploy target fails with the following exception:
java.lang.NoClassDefFoundError:
org/apache/tomcat/util/codec/binary/Base64
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalina
Task.java:204)
at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:196)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.jav
a:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:435)
at org.apache.tools.ant.Target.performTasks(Target.java:456)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1393)
at org.apache.tools.ant.Project.executeTarget(Project.java:1364)
at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExe
cutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1248)
at org.apache.tools.ant.Main.runBuild(Main.java:851)
at org.apache.tools.ant.Main.startAnt(Main.java:235)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.ClassNotFoundException: org.apache.tomcat.util.codec.binary
.Base64
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 19 more
When I tried to find the class Base64 in the package org\apache\tomcat\util\codec\binary\ which is in tomcat-util.jar, and it is in the classpath which I've verified by an echo in Ant build file.
I'm not able to solve the issue.
Just in case someone runs into the same problem I was having:
I was following the tutorial on the Tomcat website and I ran into the same NoClassDefFoundError issue when I tried to run ant install.
The tutorial mentions that you have to copy $CATALINA_HOME/lib/catalina-ant.jar1 (which contains the implementation code for the Ant custom tasks) to the lib directory of your Ant installation.
It does not mention, however, that you need to do the same thing for tomcat-util.jar. As soon as I copied tomcat-util.jar to my Ant directory, things started working (source).
1$CATALINA_HOME is the directory of your Tomcat installation, e.g. /usr/share/tomcat8
Please make sure you have added the tomcat-util.jar in the classpath as below.
<path id="catalina-ant-classpath">
<!-- We need the Catalina jars for Tomcat -->
<!-- * for other app servers - check the docs -->
<fileset dir="${appserver.lib}">
<include name="catalina-ant.jar"/>
<include name="tomcat-util.jar"/>
</fileset>
</path>

Log4jConfigListener cannot be found -- context fails to start

I am trying to set up a web application on Eclipse. I am using Tomcat 6.0 and jdk 1.6.0_23.
For some reason I am getting this error:
SEVERE: Error configuring application listener of class org.springframework.web.util.Log4jConfigListener
java.lang.ClassNotFoundException: org.springframework.web.util.Log4jConfigListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4078)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Jan 24, 2011 11:44:08 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoaderListener
java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1645)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4078)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
I checked if all libraries have been added to the build path and everything seems correct. log4j-1.2.15.jar is included and all the necessary spring libraries.
I am very confused as to what the problem especially because the project was working fine in another computer. Any help with this problem will be highly appreciated.
Naftal
Reticulogic's second suggestion is correct. However, in Eclipse Helios, the "Java EE Module Dependencies" option has been removed. The fix for Helios is as follows:
Right click on your project in Eclipse and go to Properties-->Deployment Assembly
Click "Add..."
Select "Java Build Path Entries" and click "Next"
select "Maven Dependencies" and click "Finish"
The org.springframework.web.util.Log4jConfigListener class is definitely not in your classpath.
The first thing I would suggest is that you turn up the logging level in Tomcat -- in the conf folder -- to "ALL" or "DEBUG" so that you can see exactly what is going on in the container that is preventing this class from being found.
Second, I'd recommend you check your JAR files for the missing class file by running grep, if on linux/mac:
# run at the root of your lib folders:
grep -ri "org.springframework.web.util.Log4jConfigListener" *
The above command will return all JAR files that contain that package. Once the JAR file is isolated, then you can further troubleshoot.
Third, make sure you don't have any conflicts. Multiple versions of Log4j being in your classpath will wreak havoc. How is the system supposed to know which org.springframework.web.util.Log4jConfigListener package to load if there are 2 of them? Tomcat has 3 different classpath folders:
shared/lib
lib
webapps/yourapp/WEB-INF/lib
Make sure you have only one log4j JAR file in only one of these folders.
A simple solution is to clean the Tomcat directory in Eclipse. It worked for me.
If you are using maven and eclipse
1) Look in your web project .classpath file. If you have a classpath entry "org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER", then make sure the attribute is there as well.
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
2) If that does not work, then right click on your web project in eclipse and go to Properties-->JavaEE Module dependencies. Make sure the Maven Dependencies box is checked.
Then save, build deploy yada yada
Migrating to log4j2?
Don't forget to check your webapp/WEB-INF/web.xml (Web Application Deployment Descriptor) for extraneous Event Listener definitions.
If you use, log4j2, you can find these classes in
org.apache.logging.log4j.web.*
package.
As you can see from the class name org.springframework.web.util.Log4jConfigListener is part of spring framework.
And it was depricated since spring 4.2.1 . So check your spring version.

Categories

Resources