gpt4 book ai didi

java - 创建 servlet 完成时发生错误?

转载 作者:行者123 更新时间:2023-11-28 23:05:30 25 4
gpt4 key购买 nike

我在 Eclipse 中创建一个新的 Servlet 时遇到了这个错误:

 java.lang.Error: Unresolved compilation problems: 
The import org.eclipse.jst.j2ee.internal cannot be resolved
CreateServletTemplateModel cannot be resolved to a type
CreateServletTemplateModel cannot be resolved to a type
at org.eclipse.jst.j2ee.web.ServletTemplate.<init>(ServletTemplate.java:3)

at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)

at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)

at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)

at java.lang.reflect.Constructor.newInstance(Unknown Source)

at java.lang.Class.newInstance0(Unknown Source)

at java.lang.Class.newInstance(Unknown Source)

at org.eclipse.emf.codegen.jet.JETEmitter.setMethod(JETEmitter.java:279)

at org.eclipse.jst.j2ee.internal.project.WTPJETEmitter.loadClass(WTPJETEmitter.java:358)

at org.eclipse.jst.j2ee.internal.project.WTPJETEmitter.initialize(WTPJETEmitter.java:231)

at org.eclipse.jst.j2ee.internal.project.WTPJETEmitter.<init>(WTPJETEmitter.java:111)

at org.eclipse.jst.j2ee.internal.web.operations.NewServletClassOperation.generateTemplateSource(NewServletClassOperation.java:351)

at org.eclipse.jst.j2ee.internal.web.operations.NewServletClassOperation.generateUsingTemplates(NewServletClassOperation.java:245)

at org.eclipse.jst.j2ee.internal.web.operations.NewServletClassOperation.doExecute(NewServletClassOperation.java:180)

at org.eclipse.jst.j2ee.internal.web.operations.NewServletClassOperation.execute(NewServletClassOperation.java:423)

at org.eclipse.jst.j2ee.internal.web.operations.AddServletOperation.createServletClass(AddServletOperation.java:144)

at org.eclipse.jst.j2ee.internal.web.operations.AddServletOperation.doExecute(AddServletOperation.java:120)

at org.eclipse.jst.j2ee.internal.web.operations.AddServletOperation$1.run(AddServletOperation.java:426)

at org.eclipse.jst.jee.model.internal.JEE5ModelProvider.modify(JEE5ModelProvider.java:237)

at org.eclipse.jst.j2ee.internal.web.operations.AddServletOperation.execute(AddServletOperation.java:432)

at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl$1.run(DataModelPausibleOperationImpl.java:376)

at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1797)

at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:401)

at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.runOperation(DataModelPausibleOperationImpl.java:352)

at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.doExecute(DataModelPausibleOperationImpl.java:242)

at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.executeImpl(DataModelPausibleOperationImpl.java:214)

at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.cacheThreadAndContinue(DataModelPausibleOperationImpl.java:89)

at org.eclipse.wst.common.frameworks.internal.datamodel.DataModelPausibleOperationImpl.execute(DataModelPausibleOperationImpl.java:202)

at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard$1$CatchThrowableRunnableWithProgress.run(DataModelWizard.java:211)

at org.eclipse.jface.operation.ModalContext.runInCurrentThread(ModalContext.java:369)

at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:313)

at org.eclipse.jface.wizard.WizardDialog.run(WizardDialog.java:934)

at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard.runOperations(DataModelWizard.java:220)

at org.eclipse.wst.common.frameworks.internal.datamodel.ui.DataModelWizard.performFinish(DataModelWizard.java:178)

at org.eclipse.jface.wizard.WizardDialog.finishPressed(WizardDialog.java:742)

at org.eclipse.jface.wizard.WizardDialog.buttonPressed(WizardDialog.java:373)

at org.eclipse.jface.dialogs.Dialog$2.widgetSelected(Dialog.java:618)

at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:227)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)

at org.eclipse.jface.window.Window.runEventLoop(Window.java:820)

at org.eclipse.jface.window.Window.open(Window.java:796)

at org.eclipse.ui.actions.NewWizardAction.run(NewWizardAction.java:182)

at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)

at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:546)

at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:490)

at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:402)

at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:66)

at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:938)

at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3682)

at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3293)

at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2389)

at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2353)

at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2219)

at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:466)

at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:289)

at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:461)

at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)

at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:106)

at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:169)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:106)

at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:76)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:363)

at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:176)

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:508)

at org.eclipse.equinox.launcher.Main.basicRun(Main.java:447)

at org.eclipse.equinox.launcher.Main.run(Main.java:1173)

我目前使用的是 java 1.6.0_32、Tomcat 7.0.27 和 Eclipse Europa。

我该如何解决这个错误?

最佳答案

可能是您的 Eclipse 安装有问题。尝试重新安装 WTP 或 get新 eclipse 。

关于java - 创建 servlet 完成时发生错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10245105/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com