Re: Duplicated mapping id

Splash Forums PrettyFaces Users Duplicated mapping id Re: Duplicated mapping id

#21521

Hey mika,

I looked at your logs and there is definitively something wrong. It seems like your packaging is not correct. PrettyFaces implements the annotation scanning by searching for the /WEB-INF/classes/ directory of your webapp and then recursively scans all directories for interesting class files.

The problem I see with your logs is that the classes folder contains all kind of stuff that doesn’t belong there. Especially it seems like that class files are packaged more than once (in different directories).

Valid directories for example are:

jndi:/localhost/myapp/WEB-INF/classes/com/myapp/sample/dao/
jndi:/localhost/myapp/WEB-INF/classes/com/myapp/sample/beans/

But these look strange:

jndi:/localhost/myapp/WEB-INF/classes/src/main/webapp/WEB-INF/
jndi:/localhost/myapp/WEB-INF/classes/target/classes/com/myapp/sample/beans/
jndi:/localhost/myapp/WEB-INF/classes/target/myapp/WEB-INF/classes/

As the packaging is not correct, I could think of another cause for this issue. JAR files (which are ZIP files) can contain multiple entries with exactly the same path. Yes this doesn’t make sense, but ZIP files allow something like this. When unpacking such duplicated entries they usually overwrite each other

Perhaps its similar in your case? If the LoginBean.class file is packed twice in the WAR file this error may occur.

I recommend that you check you packaging. Perhaps Eclipse is doing something wrong? Sometimes it helps to right-click on the Server entry and perform “Clean”. And you should also perform a full clean for your project. You could also check what exactly is deployed to the Tomcat server by looking at this directory:

<your-workspace>/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps

Please note that tmp0 may vary if you have multiple servers defined.

Let us know if this solves your issues. I would be very interested to know what is really causing this.

Christian