Importing projects from Mantis into JIRA

Hi

I'm evaluating JIRA and have just tried to import a single existing project from Mantis. The import fails almost immediately though, with the following exception:

2012-05-03 10:57:09,939 INFO - Import started by admin using com.atlassian.jira.plugins.importer.imports.mantis.MantisDataBean
2012-05-03 10:57:09,954 INFO - ------------------------------
2012-05-03 10:57:09,954 INFO - Importing: Users
2012-05-03 10:57:09,954 INFO - ------------------------------
2012-05-03 10:57:09,954 INFO - Only new items will be imported
2012-05-03 10:57:10,017 INFO - 11 users associated with import.

[note: I have omitted the usernames listed in the log]

2012-05-03 10:57:10,892 INFO - ------------------------------
2012-05-03 10:57:10,892 INFO - Finished Importing : Users
2012-05-03 10:57:10,892 INFO - ------------------------------
2012-05-03 10:57:10,892 INFO - 8 users successfully created.
2012-05-03 10:57:10,892 INFO - Retrieving projects...
2012-05-03 10:57:10,892 INFO - ------------------------------
2012-05-03 10:57:10,892 INFO - Importing: Issues
2012-05-03 10:57:10,892 INFO - ------------------------------
2012-05-03 10:57:10,892 INFO - Only new items will be imported
2012-05-03 10:57:10,907 INFO - ------------------------------
2012-05-03 10:57:10,907 INFO - Finished Importing : Issues
2012-05-03 10:57:10,907 INFO - ------------------------------
2012-05-03 10:57:10,907 ERROR - Unexpected failure occurred. Importer will stop immediately. Data maybe in an unstable state
com.atlassian.jira.plugins.importer.SQLRuntimeException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
at com.atlassian.jira.plugins.importer.web.JdbcConnection.queryDb(JdbcConnection.java:177)
at com.atlassian.jira.plugins.importer.web.JdbcConnection.queryDb(JdbcConnection.java:146)
at com.atlassian.jira.plugins.importer.imports.mantis.MantisDataBean.getTotalIssues(MantisDataBean.java:90)
at com.atlassian.jira.plugins.importer.imports.importer.impl.DefaultJiraDataImporter.doImport(DefaultJiraDataImporter.java:293)
at com.atlassian.jira.plugins.importer.imports.importer.impl.ImporterCallable.call(ImporterCallable.java:25)
at com.atlassian.jira.plugins.importer.imports.importer.impl.ImporterCallable.call(ImporterCallable.java:14)
at com.atlassian.jira.task.TaskManagerImpl$TaskCallableDecorator.call(TaskManagerImpl.java:359)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at com.atlassian.multitenant.impl.DefaultMultiTenantManager.runForTenant(DefaultMultiTenantManager.java:61)
at com.atlassian.multitenant.juc.MultiTenantExecutors$WrappedRunnable.run(MultiTenantExecutors.java:160)
at com.atlassian.jira.task.ForkedThreadExecutor$ForkedRunnableDecorator.run(ForkedThreadExecutor.java:249)
at java.lang.Thread.run(Thread.java:662)
Caused by: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 1
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
at com.mysql.jdbc.Util.handleNewInstance(Util.java:406)
at com.mysql.jdbc.Util.getInstance(Util.java:381)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:1030)
at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:956)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3558)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3490)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:1959)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2109)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2648)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:2077)
at com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2228)
at com.atlassian.jira.plugins.importer.web.JdbcConnection.queryDb(JdbcConnection.java:162)
... 15 more
2012-05-03 10:57:10,907 INFO - No issues need to be reindexed.

Both JIRA's database and Mantis' database are in the same MySQL instance (MySQL 5.5.18). We are using Mantis 1.2.8.

Please help.

6 answers

Hi Richard,

This looks like an issue that you should report to our support team so they can fully investigate it. Please head over to support.atlassian.com, sign up, and report this problem in the "JIRA" project.

When support figures out the issue, please take a moment to update this question so others may be able to find the solution.

-Simon

Hi Simon

Thanks for the suggestion. I actually had some really good help from one of your support team earlier in the day.

I actually figured it out just before I got his email though: on the import screen, it looked like the Mantis username / password was optional so without thinking about it too much, I didn't fill them in (I thought it would get everything it needed from the database, the username and password for which I *did* provide). But, it seems that it does need a Mantis username/password so it can do whatever it does with the url to Mantis properly.

So I tried again with those values entered (I used my Mantis admin user) and it worked. Actually, it worked really well, quite impressed :)

But if you guys would like a bit of hopefully constructive feedback it would be maybe to add a little bit of extra validation on that screen, or a more informative error message for when this goes wrong.

Like I said though, it's working really well now, just evaluating it for our place, and it seems really good.

Cheers!

I also noticed that the URL as I typed it appeared as the 'linkback' to the original issue in the imported issues. I entered 'localhost' because I was on the box at the time and I knew it would be able to connect. But I didn't realise that would end up in the issue as a link, which from a browser on another machine obviously wont work. So it might be useful to have a bit of a hint against that field e.g. "the value you enter for the Mantis URL will appear as a link in the issue so please enter a full URL that any machine on the network will be able to access, rather than just 'localhost'"

Hope that's helpful (I'm not trying to be a pain, honest!) :)

No problem Richard, thank you! Would you mind summarizing your feedback as a new issue on our official feature request tracker?

https://jira.atlassian.com/secure/Dashboard.jspa

Thanks!

-Simon

you can also try Task Adapter, it provides another way of migrating tasks from Mantis bug tracker to Jira. it's an external program where you can enter Mantis and Jira website URLs and it will use remote APIs provided by those systems. no SQL access or any plugin installation is required.

We had an issue with our version of mantis being very...very old, and customized. We also will need to migrate close to 100,000 issues.

So we actually wrote a simple php page (just modified the default report page from mantis) that filters the project/dates we are migtrating and generates a JSON payload.

YOu can use the JSON importer found in JIM, or for bonus points just have the php page post the json payload direct to JIRA's rest APIs.

This allows _full_ migration of attachments,watchers, comments, links, history, etc.

// how to setup filter and get initial list of bugs
$filter = filter_get_default();
$filter['_view_type']='advanced';

// Dates
$filter['start_year']=$start_year;
$filter['start_day']=$start_day; // yep, only integer
$filter['start_month']=$start_month;
$filter['end_year']=$end_year;
$filter['end_day']=$end_day; // dido
$filter['end_month']=$end_month;
$filter['do_filter_by_date']='on'; //IMPORTANT - to use dates, do_filter_by_date must = "on"
$filter['search']=$search;
$filter['show_category']=$category;
$filter['show_status']=$status;

	$result = filter_get_bug_rows( $t_page_number, $t_per_page, $t_page_count, $t_bug_count, $filter , $projectId);
	//$result = filter_get_bug_rows( $t_page_number, $t_per_page, $t_page_count, $t_bug_count );
	$row_count = sizeof( $result );

Then just loop through, printing the json payload depending on your target.

You'll need to make some additional queries to the "monitor","bug_notes", and other tables for non-core values, but all the basic plumbing is already there. Just copy and modify to your needs.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Sep 25, 2018 in Jira

Atlassian Research Workshop opportunity on Sep. 28th in Austin, TX

We're looking for participants for a workshop at Atlassian! We need Jira admins who have interesting custom workflows, issue views, or boards. Think you have a story to sha...

445 views 7 5
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you