I have been trying to connect a smartgwt client app to a MySQL server.
I have already created server side implementation 'MySQLConection'
and client side synchronous and asynchrous interface.
I created a RPC object in my entry point class but every time I try to launch it I am getting
Line 13: No source code is available for type java.lang.ClassNotFoundException; did you forget to inherit a required module?
Line 13: No source code is available for type java.sql.SQLException; did you forget to inherit a required module?
at line 13 i have
ArrayList onLoad() throws ClassNotFoundException, SQLException, IOException;
I have already added tag in *.gwt.xml file and also include the jar files
Here is my Connection code
public Connection MySQLConnection() {
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
return null;
}
Connection connection = null;
try {
connection = (Connection) DriverManager.getConnection(url, user, pass);
} catch (SQLException e) {
e.printStackTrace();
return null;
}
return connection;
}
Here is my *gwt.xml code
<module rename-to='Abc'>
<inherits name="com.google.gwt.user.User" />
<inherits name="com.google.gwt.user.theme.standard.Standard" />
<inherits name="com.smartgwt.SmartGwt" />
<entry-point class="com.xyz.client.Abc" />
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<!-- <inherits name='com.google.gwt.user.theme.standard.Standard'/> -->
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<!-- <inherits name="com.smartgwt.SmartGwt"/> -->
<inherits name="com.smartgwt.SmartGwtNoTheme" />
<inherits name="com.smartclient.theme.enterpriseblue.EnterpriseBlue" />
<inherits name="com.smartclient.theme.enterpriseblue.EnterpriseBlueResources" />
<servlet class="com.xyz.server.MySQLConnection" path="/MySQLConnection" />
<source path='client' />
<source path='shared' />
</module>
I am calling the connection in entry class as follows
rpc = (DBConnectionAsync) GWT.create(DBConnection.class);
You're getting this problem because you must be writing some code that accesses ClassNotFoundException, SQLException, IOException
, in a class that is contained in the client folder.
Any class in this folder cannot access every Java class.
Your server side logic should be written in a class that is contained by server folder.
To understand the project structure of GWT, have a look at the following link:
To understand why you cannot use every class in client package, have a look at the following link: