question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

When using version 3.0.1-SNAPSHOT, its git hash is c459ac5cbb82cde4982a5a49df4b1715bc990fa8 I got the following error when starting my web application

Model already registered with different name

The issue is in springfox.documentation.schema.TypeNameIndexingAdapter#checkTypeRegistration, line 50

if (knownNames.containsKey(typeId)) {
      if (!knownNames.get(typeId).equals(typeName)) {
        LOGGER.debug("Rewriting type {} with model id: {} is not allowed, because it is already registered",
                 typeName,
                 typeId);
        throw new IllegalStateException("Model already registered with different name.");
      } 

I have debugged the code and revealed that the value of typeName is “Job” when knownNames.get(typeId) evaluates to “Job_1”. “Job” is a re-usable class which appears in multiple REST functions as return value like

List<Job> allJobs();
Job getJob(int id);

Job has a field of User type which is also used in multiple REST controllers.

Seems when scanning REST controllers springfox assigns different names to the same entity in case the entity appears in multiple REST functions.

I have noticed that the knownNames map has more than 1 record for the same entity, for example

“74_0_x.y.z.User” -> “User” “71_0_x.y.z.User” -> “User”

Removing prefix and suffix from typeName and model id could solve this issue with improved performance as a side effect.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:4
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
lianmengfancommented, Sep 23, 2021

hi, Has this problem been solved?

0reactions
hakanozerdencommented, Feb 4, 2022

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Errors Seen During the Computer Startup Process
An error message during startup is an indication of a specific problem, so it's important to troubleshoot the specific issue the message is ......
Read more >
Troubleshoot startup errors on Xbox
Troubleshoot errors from the “Something went wrong” startup screen on Xbox.
Read more >
Advanced troubleshooting for Windows boot problems
Method 1: Startup repair tool · Method 2: Repair boot codes · Method 3: Fix BCD errors · Method 4: Replace Bootmgr ·...
Read more >
If your Mac doesn't start up all the way - Apple Support
macOS startup screen displaying a prohibitory sign and URL: ... macOS startup options screen showing Macintosh HD and Options icons.
Read more >
[2023 Fixes] How to Fix Your Computer Was Unable to Start
When you are faced with Windows 10, 8, or 7 startup error - Your computer was unable to start. Startup repair is checking...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found