Problems JAVA runtime

Good Morning!

I’ve been working with dhtmlx professional for a while, but have always used the php connectors. Unfortunately I have to do a project now with the Java connectors. I do not have much experience in java, but your examples are self-explanatory. My problem is simply that I can compile the project fine (it’s just an adapted version of your sample for a grid connector), but when I try to run it I get the dreaded:
java.lang.NoClassDefFoundError: com/dhtmlx/connector/ConnectorServlet

This is my classpath environment variable

CLASSPATH=C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib;C:\Program Files\Java\jre7\lib;C:\Program Files\Apache Software Foundation\Tomcat 7.0\lib\servlet-api.jar;C:\Program Files\Apache Software Foundation\Tomcat 7.0\dhtmlx;C:\Program Files\Apache Software Foundation\Tomcat 7.0\dhtmlx\codebase\connector.jar

It appears fine for compiling, but fails at runtime.
ANY help would be heighy appreciated!!!

When you are deploying it to the production server, be sure that connector.jar is placed in the lib folder of web server. ( based on your toolkit - it can be made automatically, but maybe not )

Thanks Stan…
I’ve now imported the samples, and adjusted the oracle_xx example to allow for my database:

This is the code now:

import java.sql.Connection;
import java.sql.DriverManager;

import com.dhtmlx.connector.*;

public class grid_xx_sample_oracle_connector extends ConnectorServlet {

@Override
protected void configure() {
	Connection conn=null;
	try {
		Class.forName ("oracle.jdbc.OracleDriver").newInstance ();
		
		String oraUrl = "jdbc:oracle:thin:@//192.168.0.9:1521/orcl";
		String oraUid ="APP_ELEZIONI_UFFICIALE";
		String oraPwd ="APP_ELEZIONI_UFFICIALE";
		conn = DriverManager.getConnection(oraUrl, oraUid, oraPwd);
	} catch (Throwable e) {
		e.printStackTrace();
	}
	
	GridConnector c = new GridConnector(conn, DBType.Oracle);
	c.dynamic_loading(100);
	((DBDataWrapper)c.sql).sequence("PRV_SEQ.nextVal");
	c.render_table("PROVINCIE","PRV_ID","SIGLA,NOME,CODICE_ISTAT");

}

}

I have tested the above connect string in a simple java Oracle app and it works fine.
When I run the above page in the browser (just to get the xml dump to check the connector) I get:

java.lang.NullPointerException
com.dhtmlx.connector.OracleDBDataWrapper.getStatement(OracleDBDataWrapper.java:32)
com.dhtmlx.connector.DBDataWrapper.query(DBDataWrapper.java:361)
com.dhtmlx.connector.DBDataWrapper.select(DBDataWrapper.java:214)
com.dhtmlx.connector.BaseConnector.get_resource(BaseConnector.java:447)
com.dhtmlx.connector.BaseConnector.render(BaseConnector.java:427)
com.dhtmlx.connector.BaseConnector.render_table(BaseConnector.java:242)
com.dhtmlx.connector.BaseConnector.render_table(BaseConnector.java:210)
grid_xx_sample_oracle_connector.configure(grid_xx_sample_oracle_connector.java:21)
com.dhtmlx.connector.ConnectorServlet.doGet(ConnectorServlet.java:29)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

What’s going wrong with the code?
Any help would be appriciated, as I convinced my last customer to pay the pro version (with php connectors), and now this new customer wants everything on Java, but he won’t buy DHTMLX unless he sees it working first!

I decided to try with mysql
I imported all the wars into eclipse
I created the sample db as requested (importing dump.sql)
I changed DataBaseConnection.java accordingly

It still doesn’t work. To get a decent error report, I ran the connector class by navigating to:

localhost:8080/samples/grid/01_b … nnector.do

and got:
java.lang.NullPointerException
com.dhtmlx.connector.DBDataWrapper.getStatement(DBDataWrapper.java:346)
com.dhtmlx.connector.DBDataWrapper.query(DBDataWrapper.java:361)
com.dhtmlx.connector.DBDataWrapper.select(DBDataWrapper.java:214)
com.dhtmlx.connector.BaseConnector.get_resource(BaseConnector.java:447)
com.dhtmlx.connector.BaseConnector.render(BaseConnector.java:427)
com.dhtmlx.connector.BaseConnector.render_table(BaseConnector.java:242)
com.dhtmlx.connector.BaseConnector.render_table(BaseConnector.java:210)
grid_01_basic_connector.configure(grid_01_basic_connector.java:13)
com.dhtmlx.connector.ConnectorServlet.doGet(ConnectorServlet.java:29)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)

Try to enable logging
docs.dhtmlx.com/doku.php?id=dhtm … ava:errors

Error will store actual text of SQL code which was executed - you can try to run them directly against DB.

Try to set breakpoint on the next line
GridConnector c = new GridConnector(conn, DBType.Oracle);
and check is conn a valid object ? If you have not included oracle jdbc driver in the build paths, it will be empty and will result in later execution failing.