-
1. Re: com.mysql.jdbc.Driver is not found.
ctomc Jun 6, 2012 9:49 AM (in response to samwun9988)and where is your driver?
-
2. Re: com.mysql.jdbc.Driver is not found.
samwun9988 Jun 7, 2012 1:53 AM (in response to ctomc)Hi thank you for your reply.
Here is where I installed mysql driver:
find . -name "mysql*"
./modules/com/mysql
./modules/com/mysql/main/mysql-connector-java-5.1.15.jar
./modules/com/mysql/main/mysql-connector-java-5.1.15.jar.index
./standalone/tmp/vfs/temp12f1608b639591bf/spring-hibernate-mysql.war-ae1470f21011bb7a/WEB-INF/lib/mysql-connector-java-5.1.14.jar
./standalone/tmp/vfs/deployment52686ab5ad56ccec/mysql-connector-java-5.1.14.jar-e78d9b932564537f
./standalone/tmp/vfs/deployment52686ab5ad56ccec/mysql-connector-java-5.1.14.jar-e78d9b932564537f/mysql-connector-java-5.1.14.jar
Thanks
Sam
-
3. Re: com.mysql.jdbc.Driver is not found.
ctomc Jun 7, 2012 7:51 AM (in response to samwun9988)Hi,
why don't you create datasource and then just lookup it up in jndi.
this case you do not need to use mysql jdbc driver directly in your code.
if you still wan't to use jdbc driver in your code you need to add dependancy to it in MANIFEST.MF or jboss-deployment-structure.xml
for more info how to do this, please read https://docs.jboss.org/author/display/AS71/Class+Loading+in+AS7
--
tomaz
-
4. Re: com.mysql.jdbc.Driver is not found.
samwun9988 Jun 8, 2012 1:57 AM (in response to ctomc)Hi thanks for the suggestion.
I have got the driver resolved.
Now I encountered another error:
error :java.lang.IllegalStateException
the above error is caused by the following statement in my jsp file:
OutputStream os = response.getOutputStream();
os.write(bytearray,0,size);
os.flush();
Full jsp code is:
<%@page import="java.sql.*,java.io.*"%>
<%
byte[] bytearray = null;
try{
InputStream sImage;
Class.forName("com.mysql.jdbc.Driver");
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/houseware","root","xxx");
Statement st=con.createStatement();
ResultSet rs=st.executeQuery("SELECT image_data FROM category_images WHERE category_id=4957");
out.println(" -- before rs.last() --");
if(rs.last()) {
bytearray = new byte[1048576];
int size=0;
sImage = rs.getBinaryStream(1);
response.reset();
response.setContentType("image/jpeg");
out.println("--- before while() --- ");
while((size=sImage.read(bytearray))!= -1 ) {
out.println("-- in while() --");
OutputStream os = response.getOutputStream();
os.write(bytearray,0,size);
os.flush();
}
}
con.close();
}
catch(Exception ex){
out.println("bytearray:"+bytearray.length);
out.println("error :"+ex);
}
%>
Thanks
Samuel
-
5. Re: com.mysql.jdbc.Driver is not found.
mikemil Jun 11, 2012 5:24 PM (in response to ctomc)Take a look here https://community.jboss.org/wiki/DataSourceConfigurationInAS7
I was able to drop the MySQL 5.1.20 into my 7.1.1.Final standalone\deployments folder and get it working - because it has the META-INF\services\java.sql.Driver file included.