Quantcast

MySql connector problems, Class name is wrong or classpath

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

MySql connector problems, Class name is wrong or classpath

glassfish-2
Hi,

I keep receiving a "Class name is wrong or classpath is not set" error when pinging from the admin gui,
even though I've placed mysql-connector-java-5.1.6-bin.jar in
glassfish/lib, glassfish/domain/domains1/lib and
glassfish/domain/domains1/lib/ext

Any ideas?

I'm using these resources:
<resources>
<jdbc-connection-pool
name="mysql"
datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
res-type="javax.sql.DataSource">
<property name="user" value="root"/>
<property name="password" value="password"/>
<property name="url" value="jdbc:mysql://localhost:3306/db"/>
</jdbc-connection-pool>
<jdbc-resource
enabled="true"
jndi-name="jdbc/db"
object-type="user"
pool-name="mysql"/>
</resources>

The exception:

[#|2009-02-04T16:39:35.305+0100|WARNING|sun-appserver9.1|javax.enterprise.resource.resourceadapter|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8080-1;Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource;_RequestID=d85d7551-9f1e-4b8d-9c0c-9c74ddda5d10;|RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource]|#]

[#|2009-02-04T16:39:35.321+0100|SEVERE|sun-appserver9.1|web.TimeReportServlet|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8080-1;_RequestID=d85d7551-9f1e-4b8d-9c0c-9c74ddda5d10;|exception caught
Local Exception Stack:
Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build SNAPSHOT (02/01/2008))): oracle.toplink.essentials.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
Error Code: 0
        at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:305)
        at oracle.toplink.essentials.jndi.JNDIConnector.connect(JNDIConnector.java:150)
        at oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:184)
        at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:582)
        at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:280)
        at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:229)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:93)
        at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:126)
[Message sent by forum member 'ptony' (ptony)]

http://forums.java.net/jive/thread.jspa?messageID=330098

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MySql connector problems, Class name is wrong or classpath

Sathyan Catari
Has the server been restarted after placing the jar file? How about the
ping from from admin GUI?

-Sathyan

[hidden email] wrote:

> Hi,
>
> I keep receiving a "Class name is wrong or classpath is not set" error when pinging from the admin gui,
> even though I've placed mysql-connector-java-5.1.6-bin.jar in
> glassfish/lib, glassfish/domain/domains1/lib and
> glassfish/domain/domains1/lib/ext
>
> Any ideas?
>
> I'm using these resources:
> <resources>
> <jdbc-connection-pool
> name="mysql"
> datasource-classname="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"
> res-type="javax.sql.DataSource">
> <property name="user" value="root"/>
> <property name="password" value="password"/>
> <property name="url" value="jdbc:mysql://localhost:3306/db"/>
> </jdbc-connection-pool>
> <jdbc-resource
> enabled="true"
> jndi-name="jdbc/db"
> object-type="user"
> pool-name="mysql"/>
> </resources>
>
> The exception:
>
> [#|2009-02-04T16:39:35.305+0100|WARNING|sun-appserver9.1|javax.enterprise.resource.resourceadapter|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8080-1;Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource;_RequestID=d85d7551-9f1e-4b8d-9c0c-9c74ddda5d10;|RAR5114 : Error allocating connection : [Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource]|#]
>
> [#|2009-02-04T16:39:35.321+0100|SEVERE|sun-appserver9.1|web.TimeReportServlet|_ThreadID=19;_ThreadName=httpSSLWorkerThread-8080-1;_RequestID=d85d7551-9f1e-4b8d-9c0c-9c74ddda5d10;|exception caught
> Local Exception Stack:
> Exception [TOPLINK-4002] (Oracle TopLink Essentials - 2.0.1 (Build SNAPSHOT (02/01/2008))): oracle.toplink.essentials.exceptions.DatabaseException
> Internal Exception: java.sql.SQLException: Error in allocating a connection. Cause: Class name is wrong or classpath is not set for : com.mysql.jdbc.jdbc2.optional.MysqlDataSource
> Error Code: 0
>         at oracle.toplink.essentials.exceptions.DatabaseException.sqlException(DatabaseException.java:305)
>         at oracle.toplink.essentials.jndi.JNDIConnector.connect(JNDIConnector.java:150)
>         at oracle.toplink.essentials.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:184)
>         at oracle.toplink.essentials.internal.sessions.DatabaseSessionImpl.loginAndDetectDatasource(DatabaseSessionImpl.java:582)
>         at oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider.login(EntityManagerFactoryProvider.java:280)
>         at oracle.toplink.essentials.internal.ejb.cmp3.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:229)
>         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:93)
>         at oracle.toplink.essentials.internal.ejb.cmp3.base.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:126)
> [Message sent by forum member 'ptony' (ptony)]
>
> http://forums.java.net/jive/thread.jspa?messageID=330098
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>  

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MySql connector problems, Class name is wrong or classpath

glassfish-2
Yes, several times.
Both the ping and the application return the same error.
[Message sent by forum member 'ptony' (ptony)]

http://forums.java.net/jive/thread.jspa?messageID=330121

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MySql connector problems, Class name is wrong or classpath

glassfish-2
Please check the contents of your jar and find if you have the com/mysql/jdbc/jdbc2/optional/MysqlDataSource.class in it. If not, then the jar was not downloaded properly.
[Message sent by forum member 'sm157516' (sm157516)]

http://forums.java.net/jive/thread.jspa?messageID=330231

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MySql connector problems, Class name is wrong or classpath

glassfish-2
Yes, it does have the classfile in it.

I'm using Ubuntu Server btw.
[Message sent by forum member 'ptony' (ptony)]

http://forums.java.net/jive/thread.jspa?messageID=330247

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MySql connector problems, Class name is wrong or classpath

glassfish-2
In reply to this post by glassfish-2
Fixed it by adding /usr/share/glassfish/lib/mysql-connector-java-5.1.6-bin.jar
to "System Classpath" in Configurations->JVM Settings->Path Settings
[Message sent by forum member 'ptony' (ptony)]

http://forums.java.net/jive/thread.jspa?messageID=330306

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: MySql connector problems, Class name is wrong or classpath

glassfish-2
Thanks so much ptony! I tried so many options, to no avail, but what you advised here really helped me out. The minor difference was that JVM settings were not under configurations tab, but under Application Server.
[Message sent by forum member 'java_obsessed' ]

http://forums.java.net/jive/thread.jspa?messageID=376551

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Loading...