Uploaded image for project: 'Spring Tool Suite'
  1. Spring Tool Suite
  2. STS-3113

TypeNotPresentException when changing repository interface

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 3.2.0.M1
    • Fix Version/s: 3.2.0.M2
    • Component/s: DATA
    • Labels:
      None

      Description

      1. Create Spring project
      2. Paste in the following snippet
            import java.io.Serializable;
        
            import org.springframework.data.repository.Repository;
        
            public interface MyRepository<T, ID extends Serializable> extends Repository<T, ID> {
        
            	void sharedCustomMethod(ID id);
            }
        
      3. Save and build, if not triggered already
      4. Replace Repository with CrudRepository, save
      5. Add missing import, do not save

      =>

      java.lang.TypeNotPresentException: Type CrudRepository not present
      	at sun.reflect.generics.factory.CoreReflectionFactory.makeNamedType(Unknown Source)
      	at sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Unknown Source)
      	at sun.reflect.generics.tree.ClassTypeSignature.accept(Unknown Source)
      	at sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(Unknown Source)
      	at java.lang.Class.getGenericInterfaces(Unknown Source)
      	at org.springframework.core.GenericTypeResolver.doResolveTypeArguments(GenericTypeResolver.java:170)
      	at org.springframework.core.GenericTypeResolver.resolveTypeArguments(GenericTypeResolver.java:164)
      	at org.springframework.ide.eclipse.data.jdt.core.RepositoryInformation.getManagedDomainClass(RepositoryInformation.java:185)
      	at org.springframework.ide.eclipse.data.jdt.core.SpringDataCompilationParticipant.reconcile(SpringDataCompilationParticipant.java:70)
      	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation$1.run(ReconcileWorkingCopyOperation.java:257)
      	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:42)
      	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.notifyParticipants(ReconcileWorkingCopyOperation.java:244)
      	at org.eclipse.jdt.internal.core.ReconcileWorkingCopyOperation.executeOperation(ReconcileWorkingCopyOperation.java:94)
      	at org.eclipse.jdt.internal.core.JavaModelOperation.run(JavaModelOperation.java:728)
      	at org.eclipse.jdt.internal.core.JavaModelOperation.runOperation(JavaModelOperation.java:788)
      	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1244)
      	at org.eclipse.jdt.internal.core.CompilationUnit.reconcile(CompilationUnit.java:1205)
      	at org.eclipse.jdt.core.refactoring.CompilationUnitChange.releaseDocument(CompilationUnitChange.java:98)
      	at org.eclipse.ltk.core.refactoring.TextChange.perform(TextChange.java:248)
      	at org.eclipse.jdt.internal.ui.text.correction.proposals.ChangeCorrectionProposal.performChange(ChangeCorrectionProposal.java:172)
      	at org.eclipse.jdt.internal.ui.text.correction.proposals.CUCorrectionProposal.performChange(CUCorrectionProposal.java:334)
      	at org.eclipse.jdt.internal.ui.text.correction.proposals.AddImportCorrectionProposal.performChange(AddImportCorrectionProposal.java:47)
      	at org.eclipse.jdt.internal.ui.text.correction.proposals.CUCorrectionProposal.apply(CUCorrectionProposal.java:311)
      	at org.eclipse.jdt.internal.ui.text.java.hover.AbstractAnnotationHover$AnnotationInformationControl.apply(AbstractAnnotationHover.java:537)
      	at org.eclipse.jdt.internal.ui.text.java.hover.AbstractAnnotationHover$AnnotationInformationControl.access$2(AbstractAnnotationHover.java:514)
      	at org.eclipse.jdt.internal.ui.text.java.hover.AbstractAnnotationHover$AnnotationInformationControl$5.widgetSelected(AbstractAnnotationHover.java:508)
      	at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:240)
      	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
      	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
      	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1077)
      	at org.eclipse.swt.widgets.Widget.sendSelectionEvent(Widget.java:1094)
      	at org.eclipse.swt.widgets.Link.wmNotifyChild(Link.java:1071)
      	at org.eclipse.swt.widgets.Control.wmNotify(Control.java:5534)
      	at org.eclipse.swt.widgets.Composite.wmNotify(Composite.java:1896)
      	at org.eclipse.swt.widgets.Control.WM_NOTIFY(Control.java:5086)
      	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4584)
      	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4985)
      	at org.eclipse.swt.internal.win32.OS.CallWindowProcW(Native Method)
      	at org.eclipse.swt.internal.win32.OS.CallWindowProc(OS.java:2425)
      	at org.eclipse.swt.widgets.Link.callWindowProc(Link.java:172)
      	at org.eclipse.swt.widgets.Widget.wmLButtonUp(Widget.java:2057)
      	at org.eclipse.swt.widgets.Control.WM_LBUTTONUP(Control.java:4912)
      	at org.eclipse.swt.widgets.Link.WM_LBUTTONUP(Link.java:909)
      	at org.eclipse.swt.widgets.Control.windowProc(Control.java:4565)
      	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4985)
      	at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method)
      	at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:2531)
      	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3752)
      	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2701)
      	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2665)
      	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2499)
      	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:679)
      	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
      	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:668)
      	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
      	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:123)
      	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(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: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.Main.main(Main.java:1386)
      Caused by: java.lang.ClassNotFoundException: CrudRepository
      	at java.net.URLClassLoader$1.run(Unknown Source)
      	at java.net.URLClassLoader$1.run(Unknown Source)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at java.net.URLClassLoader.findClass(Unknown Source)
      	at java.lang.ClassLoader.loadClass(Unknown Source)
      	at java.lang.ClassLoader.loadClass(Unknown Source)
      	at java.lang.Class.forName0(Native Method)
      	at java.lang.Class.forName(Unknown Source)
      	... 69 more
      

        Attachments

          Activity

            People

            Assignee:
            zaza Tomasz Zarna
            Reporter:
            zaza Tomasz Zarna
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: