我的Liferay portal 7 ga4正在wildfly 10上运行。我创建了一个Liferay MVC portlet并进行了部署。我试图连接到MySQL数据库,但得到这个错误:抛出java.lang.ClassNotFoundException:com.mysql.jdbc.DriverLiferay MVC Portlet java.lang.ClassNotFoundException
我通过进口的mysql-连接器的Java 42年5月1日 - bin.jar(右键单击项目>构建路径>配置构建路径>添加JAR文件。它继续在“引用的库”。
而这里的view.jsp的
try{
String connectionURL = "jdbc:mysql://localhost/employees";
Connection connection = null;
Statement statement = null;
ResultSet resultSet = null;
Class.forName("com.mysql.jdbc.Driver").newInstance();
connection = DriverManager.getConnection(connectionURL, "root", "");
statement = connection.createStatement();
if(!connection.isClosed()){
out.println("Successfully connected to MySQL server" + "<br/>");
}
} catch(Exception ex){
out.println("Unable to connect to database: "+ ex);
}
的代码可以有人请帮帮我 我?我对Liferay和Java完全陌生。
谢谢。
这似乎并没有被重复,这个问题似乎与gradle这个配置和OSGi环境。你能不能显示你的gradle配置? – Victor