|
View:
New views
9 Messages
—
Rating Filter:
Alert me
|
|
|
error executing mvn sonar:sonar: 'Incorrect string value: '...' for column 'data' at row 1'Hello,
When I try to execute mvn sonar:sonar I get the following error (full stack trace below): Caused by: java.sql.SQLException: Incorrect string value: '\xF0\x93\xB1\x93\xEF\xBF...' for column 'data' at row 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723) at com.mysql.jdbc.Connection.execSQL(Connection.java:3283) I have Sonar setup to use MySQL and it is apparently connecting fine (I can see http://localhost:9000/projects) but for some reason the maven plugin fails to insert in the database. I used the following command to create the database: CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci; I am guessing this has something to do with the source files' encoding, but I am not sure what I have to configure to get it working. My source encoding is Shift_JIS (Japanese). I tried setting -Dfile.encoding=Shift_JIS in MAVEN_OPTS, but that didn't help. I also have this in my root pom, but it doesn't seem to make a difference: <properties> <project.build.sourceEncoding>Shift_JIS</project.build.sourceEncoding> </properties> Any pointers are much appreciated. An here is the full stack trace: [INFO] myapp webapp [class org.sonar.plugins.squid.SquidMavenCollector] executing [INFO] myapp webapp Starting audit... [INFO] myapp webapp Audit done. [INFO] myapp webapp [class org.sonar.plugins.core.SaveProfileMavenCollector] executing [INFO] myapp webapp [class org.sonar.plugins.core.sources.ImportJavaSourcesMavenCollector] executing [WARN] myapp webapp SQL Error: 1366, SQLState: HY000 [ERROR] myapp webapp Incorrect string value: '\xF0\x93\xB1\x93\xEF\xBF...' for column 'data' at row 1 [INFO] ------------------------------------------------------------------------ [ERROR] BUILD ERROR [INFO] ------------------------------------------------------------------------ [INFO] Can not execute Sonar Embedded error: org.hibernate.exception.GenericJDBCException: could not insert: [org.sonar.commons.resources.SnapshotSource] Incorrect string value: '\xF0\x93\xB1\x93\xEF\xBF...' for column 'data' at row 1 [INFO] ------------------------------------------------------------------------ [INFO] Trace org.apache.maven.lifecycle.LifecycleExecutionException: Can not execute Sonar at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:703) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeStandaloneGoal(DefaultLifecycleExecutor.java:553) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:523) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:371) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:268) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:181) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:356) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:137) at org.apache.maven.cli.MavenCli.main(MavenCli.java:356) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315) at org.codehaus.classworlds.Launcher.launch(Launcher.java:255) at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430) at org.codehaus.classworlds.Launcher.main(Launcher.java:375) Caused by: org.apache.maven.plugin.MojoExecutionException: Can not execute Sonar at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:87) at org.codehaus.mojo.sonar.Bootstraper.start(Bootstraper.java:65) at org.codehaus.mojo.sonar.SonarMojo.execute(SonarMojo.java:117) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483) at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:678) ... 16 more Caused by: javax.persistence.PersistenceException: org.hibernate.exception.GenericJDBCException: could not insert: [org.sonar.commons.resources.SnapshotSource] at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:630) at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:219) at org.sonar.commons.database.DatabaseSession.internalSave(DatabaseSession.java:116) at org.sonar.commons.database.DatabaseSession.save(DatabaseSession.java:93) at org.sonar.mojo.ProjectContextImpl.addSource(ProjectContextImpl.java:170) at org.sonar.plugins.api.maven.AbstractImportSourceMavenCollector.parseFiles(AbstractImportSourceMavenCollector.java:79) at org.sonar.plugins.api.maven.AbstractImportSourceMavenCollector.parseSourceDirs(AbstractImportSourceMavenCollector.java:64) at org.sonar.plugins.api.maven.AbstractImportSourceMavenCollector.collect(AbstractImportSourceMavenCollector.java:55) at org.sonar.mojo.InternalMojo.executeCollectors(InternalMojo.java:295) at org.sonar.mojo.InternalMojo.processModules(InternalMojo.java:177) at org.sonar.mojo.InternalMojo.execute(InternalMojo.java:156) at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:483) at org.codehaus.mojo.sonar.Bootstraper.executeMojo(Bootstraper.java:82) ... 20 more Caused by: org.hibernate.exception.GenericJDBCException: could not insert: [org.sonar.commons.resources.SnapshotSource] at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103) at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91) at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:40) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2163) at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2643) at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:51) at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279) at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:298) at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181) at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107) at org.hibernate.ejb.event.EJB3PersistEventListener.saveWithGeneratedId(EJB3PersistEventListener.java:49) at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87) at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38) at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592) at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596) at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:213) ... 31 more Caused by: java.sql.SQLException: Incorrect string value: '\xF0\x93\xB1\x93\xEF\xBF...' for column 'data' at row 1 at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:946) at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:2985) at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1631) at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:1723) at com.mysql.jdbc.Connection.execSQL(Connection.java:3283) at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1332) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1604) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1519) at com.mysql.jdbc.PreparedStatement.executeUpdate(PreparedStatement.java:1504) at org.hibernate.id.IdentityGenerator$GetGeneratedKeysDelegate.executeAndExtract(IdentityGenerator.java:73) at org.hibernate.id.insert.AbstractReturningDelegate.performInsert(AbstractReturningDelegate.java:33) ... 46 more [INFO] ------------------------------------------------------------------------ [INFO] Total time: 1 minute 15 seconds [INFO] Finished at: Mon Jun 29 15:15:35 JST 2009 [INFO] Final Memory: 32M/57M [INFO] ------------------------------------------------------------------------ Finished: FAILURE --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: error executing mvn sonar:sonar: 'Incorrect string value: '...' for column 'data' at row 1'Hello Nicolay,
As your source code is not UTF8 encoded, I guess you should specify the Shift_JIS character encoding when you create the Mysql schema. Could you give a try with the following command :
CREATE DATABASE sonar CHARACTER SET sjis COLLATE sjis_japanese_ci; Hope it helps Freddy
2009/6/29 Nikolay Elenkov <nick@...> Hello, |
|
|
Re: error executing mvn sonar:sonar: 'Incorrect string value: '...' for column 'data' at row 1'Freddy Mallet wrote:
> As your source code is > not UTF8 encoded, I guess you should specify the Shift_JIS character > encoding when you create the Mysql schema. > Could you give a try with the following command : > > CREATE DATABASE sonar CHARACTER SET sjis COLLATE sjis_japanese_ci; > Thanks. I tried it but I still get the same error? I am right to assume that what gets inserted into snapshot_sources#data is java source code? I haven't look at the source (no time right now...), but if the file encoding is specified properly (in pom.xml or with a system property), once it is read successfully, one should be able to save it again in UTF-8. BTW, is there a way to specify trace logging for ImportJavaSourceMavenCollector, so that I can at least track down what file the string that fails is coming from? --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: error executing mvn sonar:sonar: 'Incorrect string value: '...' for column 'data' at row 1'Hi,
Looking at the ImportJavaSourceMavenCollector indicates that this is an issue on our side. I've created a ticket to fix it asap : http://jira.codehaus.org/browse/SONAR-948. However providing a sample small helloworld maven project (1 pom, 1 unit test and 1 class) with Shift_JIS encoded sources would help. Fix the recording into db with correct charset will be easy but maybe not rendering this into the webapp. Regards 2009/6/30 Nikolay Elenkov <nick@...>
|
|
|
Re: error executing mvn sonar:sonar: 'Incorrect string value: '...' for column 'data' at row 1'Cedric Munger wrote:
> Looking at the ImportJavaSourceMavenCollector indicates that this is an > issue on our side. > I've created a ticket to fix it asap : > http://jira.codehaus.org/browse/SONAR-948. > However providing a sample small helloworld maven project (1 pom, 1 unit > test and 1 class) with Shift_JIS encoded sources would help. > Fix the recording into db with correct charset will be easy but maybe > not rendering this into the webapp. > Thanks. I will attach a simple project that reproduces the issue. In the mean time, is there some way to work around this? Like skip inserting the source in DB altogether? --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: error executing mvn sonar:sonar: 'Incorrect string value: '...' for column 'data' at row 1'Well in fact the platform encoding is used to read the source files, so launching the plugin with -Dfile.encoding= Shift_JIS "could" do the trick.
Let us know Regards
2009/6/30 Nikolay Elenkov <nick@...>
|
|
|
Re: error executing mvn sonar:sonar: 'Incorrect string value: '...' for column 'data' at row 1'Cedric Munger wrote:
> Well in fact the platform encoding is used to read the source files, so > launching the plugin with -Dfile./encoding/= Shift_JIS "could" do the trick. > Let us know That's what I tried first actually. But it doesn't help. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
|
|
Re: error executing mvn sonar:sonar: 'Incorrect string value: '...' for column 'data' at row 1'Ok good to have this info !
So providing a sample project will ensure that we can fix correctly the issue. Attach it to the jira ticket. Thanks a lot for your help :) Regards. 2009/6/30 Nikolay Elenkov <nick@...>
|
|
|
Re: error executing mvn sonar:sonar: 'Incorrect string value: '...' for column 'data' at row 1'Cedric Munger wrote:
> Ok good to have this info ! > So providing a sample project will ensure that we can fix correctly the > issue. > Attach it to the jira ticket. Thanks a lot for your help :) I have attached a sample project to the JIRA. The issue seems to be caused by a specific string in JavaDoc. The string is: 抽象クラスを導入 ('introduce an abstract class', so it tends to be used quite frequently in comments) So this is definitely an encoding problem, but might be caused by some library Sonar uses. --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email |
| Free embeddable forum powered by Nabble | Forum Help |