nublic / Nublic

Your home in Internet
6 stars 1 forks source link

Error saving playlist #32

Closed PabloTunnon closed 12 years ago

PabloTunnon commented 12 years ago

Request:

PUT http://192.168.56.101/music/server/playlists name: Batiburrillo songs: 60,61,68,69,71,32,30,33,29,3,4,15,22,24,27,28,34,35,40,41,42,43,44,48,52,53,54,55,56,57,58,59,49,50,51,32,30,33,2,29,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,60,61,62,63,64,65,66,67,68,69,70,71

Answer:

Apache Tomcat/6.0.32 - Informe de Error

Estado HTTP 500 -


type Informe de Excepción

mensaje

descripción El servidor encontró un error interno () que hizo que no pudiera rellenar este requerimiento.

excepción

java.lang.RuntimeException: Exception while executing statement : ERROR: duplicate key value violates unique constraint "SongPlaylistCPK"
  Detail: Key ("songId", "playlistId")=(32, 10) already exists.
errorCode: 0, sqlState: 23505
insert into "SongPlaylist" ("position", "playlistId", "songId") values (?,?,?)
    org.squeryl.internals.DatabaseAdapter$class._exec(DatabaseAdapter.scala:327)
    org.squeryl.internals.DatabaseAdapter$class.exec(DatabaseAdapter.scala:377)
    org.squeryl.adapters.PostgreSqlAdapter.exec(PostgreSqlAdapter.scala:24)
    org.squeryl.internals.DatabaseAdapter$class.executeUpdateForInsert(DatabaseAdapter.scala:399)
    org.squeryl.adapters.PostgreSqlAdapter.executeUpdateForInsert(PostgreSqlAdapter.scala:24)
    org.squeryl.Table$$anonfun$insert$1.apply(Table.scala:53)
    org.squeryl.logging.StackMarker$.lastSquerylStackFrame(StatisticsListener.scala:52)
    org.squeryl.Table.insert(Table.scala:34)
    com.nublic.app.music.server.MusicServer$$anonfun$addSongsToPlaylist$1.apply(MusicServer.scala:194)
    com.nublic.app.music.server.MusicServer$$anonfun$addSongsToPlaylist$1.apply(MusicServer.scala:192)
    scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    scala.collection.immutable.List.foreach(List.scala:45)
    scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
    scala.collection.immutable.List.map(List.scala:45)
    com.nublic.app.music.server.MusicServer.addSongsToPlaylist(MusicServer.scala:192)
    com.nublic.app.music.server.MusicServer$$anonfun$33$$anonfun$apply$19.apply(MusicServer.scala:206)
    com.nublic.app.music.server.MusicServer$$anonfun$33$$anonfun$apply$19.apply(MusicServer.scala:201)
    org.squeryl.dsl.QueryDsl$class._using(QueryDsl.scala:44)
    org.squeryl.dsl.QueryDsl$class._executeTransactionWithin(QueryDsl.scala:100)
    org.squeryl.dsl.QueryDsl$class.transaction(QueryDsl.scala:64)
    org.squeryl.PrimitiveTypeMode$.transaction(PrimitiveTypeMode.scala:40)
    com.nublic.app.music.server.MusicServer$$anonfun$33.apply(MusicServer.scala:201)
    com.nublic.app.music.server.MusicServer$$anonfun$33.apply(MusicServer.scala:198)
    com.nublic.app.music.server.MusicServer.withUser(MusicServer.scala:69)
    com.nublic.app.music.server.MusicServer$$anonfun$putUser$1.apply(MusicServer.scala:81)
    com.nublic.app.music.server.MusicServer$$anonfun$put2$1.apply(MusicServer.scala:59)
    org.scalatra.ScalatraKernel$$anonfun$invoke$1.apply(ScalatraKernel.scala:212)
    org.scalatra.ScalatraKernel$$anonfun$invoke$1.apply(ScalatraKernel.scala:211)
    org.scalatra.ScalatraKernel$class.withRouteMultiParams(ScalatraKernel.scala:271)
    com.nublic.app.music.server.MusicServer.withRouteMultiParams(MusicServer.scala:30)
    org.scalatra.ScalatraKernel$class.invoke(ScalatraKernel.scala:210)
    com.nublic.app.music.server.MusicServer.invoke(MusicServer.scala:30)
    org.scalatra.ScalatraKernel$$anonfun$runRoutes$1$$anonfun$apply$2.apply(ScalatraKernel.scala:196)
    org.scalatra.ScalatraKernel$$anonfun$runRoutes$1$$anonfun$apply$2.apply(ScalatraKernel.scala:195)
    scala.Option.flatMap(Option.scala:147)
    org.scalatra.ScalatraKernel$$anonfun$runRoutes$1.apply(ScalatraKernel.scala:195)
    org.scalatra.ScalatraKernel$$anonfun$runRoutes$1.apply(ScalatraKernel.scala:194)
    scala.collection.immutable.Stream.flatMap(Stream.scala:213)
    org.scalatra.ScalatraKernel$class.runRoutes(ScalatraKernel.scala:194)
    com.nublic.app.music.server.MusicServer.runRoutes(MusicServer.scala:30)
    org.scalatra.ScalatraKernel$class.executeRoutes(ScalatraKernel.scala:165)
    com.nublic.app.music.server.MusicServer.executeRoutes(MusicServer.scala:30)
    org.scalatra.ScalatraKernel$$anonfun$handle$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(ScalatraKernel.scala:139)
    org.scalatra.ScalatraKernel$$anonfun$handle$1$$anonfun$apply$mcV$sp$1.apply(ScalatraKernel.scala:137)
    org.scalatra.ScalatraKernel$$anonfun$handle$1$$anonfun$apply$mcV$sp$1.apply(ScalatraKernel.scala:137)
    scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
    org.scalatra.ScalatraKernel$$anonfun$handle$1.apply$mcV$sp(ScalatraKernel.scala:137)
    org.scalatra.ScalatraKernel$$anonfun$handle$1.apply(ScalatraKernel.scala:137)
    org.scalatra.ScalatraKernel$$anonfun$handle$1.apply(ScalatraKernel.scala:137)
    scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
    org.scalatra.ScalatraKernel$class.handle(ScalatraKernel.scala:136)
    com.nublic.app.music.server.MusicServer.handle(MusicServer.scala:30)
    org.scalatra.ScalatraFilter$$anonfun$doFilter$1.apply$mcV$sp(ScalatraFilter.scala:30)
    org.scalatra.ScalatraFilter$$anonfun$doFilter$1.apply(ScalatraFilter.scala:30)
    org.scalatra.ScalatraFilter$$anonfun$doFilter$1.apply(ScalatraFilter.scala:30)
    scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
    org.scalatra.ScalatraFilter$class.doFilter(ScalatraFilter.scala:29)
    com.nublic.app.music.server.MusicServer.doFilter(MusicServer.scala:30)

causa raíz

org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint "SongPlaylistCPK"
  Detail: Key ("songId", "playlistId")=(32, 10) already exists.
    org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2102)
    org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1835)
    org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:257)
    org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:500)
    org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:388)
    org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:334)
    org.squeryl.internals.DatabaseAdapter$$anonfun$executeUpdateForInsert$1.apply$mcI$sp(DatabaseAdapter.scala:401)
    org.squeryl.internals.DatabaseAdapter$$anonfun$executeUpdateForInsert$1.apply(DatabaseAdapter.scala:399)
    org.squeryl.internals.DatabaseAdapter$$anonfun$executeUpdateForInsert$1.apply(DatabaseAdapter.scala:399)
    org.squeryl.internals.DatabaseAdapter$class._exec(DatabaseAdapter.scala:323)
    org.squeryl.internals.DatabaseAdapter$class.exec(DatabaseAdapter.scala:377)
    org.squeryl.adapters.PostgreSqlAdapter.exec(PostgreSqlAdapter.scala:24)
    org.squeryl.internals.DatabaseAdapter$class.executeUpdateForInsert(DatabaseAdapter.scala:399)
    org.squeryl.adapters.PostgreSqlAdapter.executeUpdateForInsert(PostgreSqlAdapter.scala:24)
    org.squeryl.Table$$anonfun$insert$1.apply(Table.scala:53)
    org.squeryl.logging.StackMarker$.lastSquerylStackFrame(StatisticsListener.scala:52)
    org.squeryl.Table.insert(Table.scala:34)
    com.nublic.app.music.server.MusicServer$$anonfun$addSongsToPlaylist$1.apply(MusicServer.scala:194)
    com.nublic.app.music.server.MusicServer$$anonfun$addSongsToPlaylist$1.apply(MusicServer.scala:192)
    scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:194)
    scala.collection.LinearSeqOptimized$class.foreach(LinearSeqOptimized.scala:59)
    scala.collection.immutable.List.foreach(List.scala:45)
    scala.collection.TraversableLike$class.map(TraversableLike.scala:194)
    scala.collection.immutable.List.map(List.scala:45)
    com.nublic.app.music.server.MusicServer.addSongsToPlaylist(MusicServer.scala:192)
    com.nublic.app.music.server.MusicServer$$anonfun$33$$anonfun$apply$19.apply(MusicServer.scala:206)
    com.nublic.app.music.server.MusicServer$$anonfun$33$$anonfun$apply$19.apply(MusicServer.scala:201)
    org.squeryl.dsl.QueryDsl$class._using(QueryDsl.scala:44)
    org.squeryl.dsl.QueryDsl$class._executeTransactionWithin(QueryDsl.scala:100)
    org.squeryl.dsl.QueryDsl$class.transaction(QueryDsl.scala:64)
    org.squeryl.PrimitiveTypeMode$.transaction(PrimitiveTypeMode.scala:40)
    com.nublic.app.music.server.MusicServer$$anonfun$33.apply(MusicServer.scala:201)
    com.nublic.app.music.server.MusicServer$$anonfun$33.apply(MusicServer.scala:198)
    com.nublic.app.music.server.MusicServer.withUser(MusicServer.scala:69)
    com.nublic.app.music.server.MusicServer$$anonfun$putUser$1.apply(MusicServer.scala:81)
    com.nublic.app.music.server.MusicServer$$anonfun$put2$1.apply(MusicServer.scala:59)
    org.scalatra.ScalatraKernel$$anonfun$invoke$1.apply(ScalatraKernel.scala:212)
    org.scalatra.ScalatraKernel$$anonfun$invoke$1.apply(ScalatraKernel.scala:211)
    org.scalatra.ScalatraKernel$class.withRouteMultiParams(ScalatraKernel.scala:271)
    com.nublic.app.music.server.MusicServer.withRouteMultiParams(MusicServer.scala:30)
    org.scalatra.ScalatraKernel$class.invoke(ScalatraKernel.scala:210)
    com.nublic.app.music.server.MusicServer.invoke(MusicServer.scala:30)
    org.scalatra.ScalatraKernel$$anonfun$runRoutes$1$$anonfun$apply$2.apply(ScalatraKernel.scala:196)
    org.scalatra.ScalatraKernel$$anonfun$runRoutes$1$$anonfun$apply$2.apply(ScalatraKernel.scala:195)
    scala.Option.flatMap(Option.scala:147)
    org.scalatra.ScalatraKernel$$anonfun$runRoutes$1.apply(ScalatraKernel.scala:195)
    org.scalatra.ScalatraKernel$$anonfun$runRoutes$1.apply(ScalatraKernel.scala:194)
    scala.collection.immutable.Stream.flatMap(Stream.scala:213)
    org.scalatra.ScalatraKernel$class.runRoutes(ScalatraKernel.scala:194)
    com.nublic.app.music.server.MusicServer.runRoutes(MusicServer.scala:30)
    org.scalatra.ScalatraKernel$class.executeRoutes(ScalatraKernel.scala:165)
    com.nublic.app.music.server.MusicServer.executeRoutes(MusicServer.scala:30)
    org.scalatra.ScalatraKernel$$anonfun$handle$1$$anonfun$apply$mcV$sp$1.apply$mcV$sp(ScalatraKernel.scala:139)
    org.scalatra.ScalatraKernel$$anonfun$handle$1$$anonfun$apply$mcV$sp$1.apply(ScalatraKernel.scala:137)
    org.scalatra.ScalatraKernel$$anonfun$handle$1$$anonfun$apply$mcV$sp$1.apply(ScalatraKernel.scala:137)
    scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
    org.scalatra.ScalatraKernel$$anonfun$handle$1.apply$mcV$sp(ScalatraKernel.scala:137)
    org.scalatra.ScalatraKernel$$anonfun$handle$1.apply(ScalatraKernel.scala:137)
    org.scalatra.ScalatraKernel$$anonfun$handle$1.apply(ScalatraKernel.scala:137)
    scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
    org.scalatra.ScalatraKernel$class.handle(ScalatraKernel.scala:136)
    com.nublic.app.music.server.MusicServer.handle(MusicServer.scala:30)
    org.scalatra.ScalatraFilter$$anonfun$doFilter$1.apply$mcV$sp(ScalatraFilter.scala:30)
    org.scalatra.ScalatraFilter$$anonfun$doFilter$1.apply(ScalatraFilter.scala:30)
    org.scalatra.ScalatraFilter$$anonfun$doFilter$1.apply(ScalatraFilter.scala:30)
    scala.util.DynamicVariable.withValue(DynamicVariable.scala:57)
    org.scalatra.ScalatraFilter$class.doFilter(ScalatraFilter.scala:29)
    com.nublic.app.music.server.MusicServer.doFilter(MusicServer.scala:30)

nota La traza completa de la causa de este error se encuentra en los archivos de diario de Apache Tomcat/6.0.32.


Apache Tomcat/6.0.32

serras commented 12 years ago

This problem is caused by a primary key definition that was present in the previous version, where a song could only appear once in a playlist. I suppose Squeryl is not smart enough to remove the old unique constraint and add the newer one, so we may need to change it by hand. I close the issue because it's already fixed.