问题
i have an glassfish server and i try to use a mysql database.
what i did:
- i installed glassfisch3
- i added galssfish3/bin to environment variables
- i installed a domain und glassfish3/glassfish/domains/domain1
- i added mysql-connector-java-5.1.25-bin.jar to glassfish3/glassfish/domains/domain1/lib
- i created a datasource in my glassfisch (Name: myDataSource, ClassName com.mysql.jdbc.jdbc2.optional.MysqlDataSource, Resource Type: javax.sql.DataSource)
- i Saved everything
When i now go to my new created datasource and press the ping button i get this Error:
Ping Connection Pool failed for movies. Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource Please check the server.log for more details.
So whats wrong with it? official glassfisch3 doc says i did right
回答1:
I guess, by creating a datasource you mean a connection pool. Do you start your Glassfish from a command line or from an IDE? I had the same problem with Glassfish 4 when I was starting it from Netbeans 7.3.1 (Linux), but when I start it by
./bin/asadmin start-domain
it can find the driver. I don't know what gets wrong when using Netbeans.
回答2:
You should probably try to move the mysql-connector-java-5.1.25-bin.jar also to glassfish3/glassfish/lib. This is the global directory for libraries.
来源:https://stackoverflow.com/questions/16593060/glassfisch-mysql-ping-error