我的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