Error when saving a link

I have these two tables:gantt_tasks and gantt_links, I succeed to add tasks to the first table but I had this error if I try to add a link.

java.lang.ClassCastException: com.dhtmlx.connector.JSONOptionsConnector cannot be cast to com.dhtmlx.connector.OptionsConnector

Here my page html and my servlet Conector :

index.html

[code]

        gantt.config.xml_date = "%Y-%m-%d %H:%i";
        gantt.config.scale_unit = "day";
        gantt.config.duration_unit = "day";
        gantt.config.date_scale = "%d";
        gantt.init("idGantt");
        gantt.load("Conector");
        var dp = new  dataProcessor("Conector");
        dp.init(gantt);
</script>
[/code]

Conector.java

[code]public class Conector extends ThreadSafeConnectorServlet {

@Override
protected void configure(HttpServletRequest req, HttpServletResponse res) {
Connection conn = null;
try {
Class.forName(“com.mysql.jdbc.Driver”).newInstance();
conn = DriverManager.getConnection(“jdbc:mysql://localhost:3306/test”, “root”, “”);
} catch (Throwable e) {
e.printStackTrace();
}

JSONGanttConnector gantt = new JSONGanttConnector(conn, DBType.MySQL);
gantt.servlet(req, res);

gantt.mix("open", "1");

gantt.enable_order(“sortorder”);
gantt.render_links(“gantt_links”, “id”, “source,target,type”);

gantt.render_table(“gantt_tasks”, “id”, “start_date,duration,text,progress,sortorder,parent”);

}
}[/code]

Help please, thanks.

Please try to use the updated connecto.jar (attached)
If the issue still occurs, please share the full stack trace of the error.
connector.27.3.zip (190 KB)

Thanks, it work’s very well

Hi Stanislav, I want to display only on the gantt a task and his children for example I have this structure of table (task.png) and I want to display the project 1 and child 1, I tried this attempt but it didn’t work and I didn’t have any error in the console.Thanks.

[code] @Override
protected void configure(HttpServletRequest req, HttpServletResponse res) {
Connection conn = null;
try {
Class.forName(“com.mysql.jdbc.Driver”).newInstance();
conn = DriverManager.getConnection(“jdbc:mysql://localhost:3306/parc”, “root”, “”);
} catch (Throwable e) {
e.printStackTrace();
}

    JSONGanttConnector gantt = new JSONGanttConnector(conn, DBType.MySQL);
    gantt.servlet(req, res);
    gantt.mix("open", "1");

gantt.enable_order(“sortorder”);
gantt.render_links(“gantt_links”, “id”, “source,target,type”);
gantt.render_sql(“select * from task where id=1 and id=2”,“id”, “start_date,duration,text,progress,sortorder,parent”);[/code]

That is an updated version of the pinned one (viewtopic.php?f=15&t=32995) but it doesn’t come with source code so I can’t recompile it to use java6. Any solution?

In this thread viewtopic.php?f=15&t=37572 there is another jar with source code. I think you should pin that version.