473,461 Members | 1,947 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

mysql connectionpropertiestransform issue - help needed

Hi,

I have implemented com.mysql.jdbc.ConnectionPropertiesTransform class.

In the jdbc connection url, I have added

propertiesTransform=com.mysql.jdbc.ConnectionPrope rtiesTransformImpl

attribute.

I made jar of this implementation class file and i have placed this jar file inside webapps/ (application)/WEB-INF/lib. mysql-connector-java-5.0.4-bin.jar file is present inside \tomcat\common\lib.


I am getting following exception.

Unable to create the properties transform instance 'com.mysql.jdbc.ConnectionPropertiesTransformImpl' due to underlying exception java.lang.ClassNotFoundException: com.mysql.jdbc.ConnectionPropertiesTransformImpl


If I place mysql-connector-java-5.0.4-bin.jar inside webapps/ (application)/WEB-INF/lib, its working fine.


Any idea? Is it classpath/class loader issue?

Thanks in advance
Oct 22 '08 #1
3 1709
sukatoa
539 512MB
Hi,

I have implemented com.mysql.jdbc.ConnectionPropertiesTransform class.

In the jdbc connection url, I have added

propertiesTransform=com.mysql.jdbc.ConnectionPrope rtiesTransformImpl

attribute.

I made jar of this implementation class file and i have placed this jar file inside webapps/ (application)/WEB-INF/lib. mysql-connector-java-5.0.4-bin.jar file is present inside \tomcat\common\lib.


I am getting following exception.

Unable to create the properties transform instance 'com.mysql.jdbc.ConnectionPropertiesTransformImpl' due to underlying exception java.lang.ClassNotFoundException: com.mysql.jdbc.ConnectionPropertiesTransformImpl


If I place mysql-connector-java-5.0.4-bin.jar inside webapps/ (application)/WEB-INF/lib, its working fine.


Any idea? Is it classpath/class loader issue?

Thanks in advance
I think it is on the catalina.properties file, ( not sure )

compare the values of common.loader and server.loader variables,
what have you notice?

Im not sure and i cannot confirm it(since i have uninstalled already my tomcat)

but if you would like to try, have a back-up copy of catalina.properties

add this at the end of server.loader --> ,${catalina.home}/common/lib/*.jar

eg.

server.loader=${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar,${catalina.home}/common/lib/*.jar

save, restart your Tomcat Server and observe,

If you still cannot use the jar files inside the common/lib, replace the modified one with the unmodified(back-up) catalina.properties and stay on the WEB-INF/lib/ folder...... :)

regards,
sukatoa
Oct 23 '08 #2
I think it is on the catalina.properties file, ( not sure )

compare the values of common.loader and server.loader variables,
what have you notice?

Im not sure and i cannot confirm it(since i have uninstalled already my tomcat)

but if you would like to try, have a back-up copy of catalina.properties

add this at the end of server.loader --> ,${catalina.home}/common/lib/*.jar

eg.

server.loader=${catalina.home}/server/classes,${catalina.home}/server/lib/*.jar,${catalina.home}/common/lib/*.jar

save, restart your Tomcat Server and observe,

If you still cannot use the jar files inside the common/lib, replace the modified one with the unmodified(back-up) catalina.properties and stay on the WEB-INF/lib/ folder...... :)

regards,
sukatoa

Thank you very much..

Let me explain my issue clearly..

Actually, i need to login to database using application user login name and password. So after user has logged in , i need to get username and password and make the database connection using that..

So i am using ConnectionPropertiesTransform and changing the database connection parameters.

Right now, I have two jar files.

1) mysql-connector
2) my application custom jar.

If i place my jar inside web-inf/lib , i am getting noclassdeffound exception.

If i have placed my jar inside common/lib, since i am using spring framework outside web application, SecurityContextHolder /Authentication objects are coming null. So i am not able to retrieve user details..

If i place mysql jar inside web-inf/lib, jndi connection to database is not establishing.

I have played with catalina.properties. it does not solve my problem. After changing common-loader, i am not getting no class definition found error. But Securitycontext holder /Authentication objects are coming null..


So please suggest me if there is any solution for this?
Oct 23 '08 #3
sukatoa
539 512MB
Thank you very much..

Let me explain my issue clearly..

Actually, i need to login to database using application user login name and password. So after user has logged in , i need to get username and password and make the database connection using that..

So i am using ConnectionPropertiesTransform and changing the database connection parameters.

Right now, I have two jar files.

1) mysql-connector
2) my application custom jar.

If i place my jar inside web-inf/lib , i am getting noclassdeffound exception.

If i have placed my jar inside common/lib, since i am using spring framework outside web application, SecurityContextHolder /Authentication objects are coming null. So i am not able to retrieve user details..

If i place mysql jar inside web-inf/lib, jndi connection to database is not establishing.

I have played with catalina.properties. it does not solve my problem. After changing common-loader, i am not getting no class definition found error. But Securitycontext holder /Authentication objects are coming null..


So please suggest me if there is any solution for this?
( i haven't use spring framework before )
If i were to implement that, since the requirement ( username and password ) that will be used as a username/password for the database to connect,

im going to create a bean that manage database connection( pooling using naming-factory-dbcp.jar )
with a constructor parameter URL, DriverLocation, Schema, Username and Password,
( DriverManager needs URL(jdbc:mysql://localhost/ ), username and password)

Following the setter/getter methods for the constructor parameter to be able to make it a dynamic connection switching....

Every time the username and password changes, close the current connection instance and reconnect it using the new username and password together with all other parameters initialized.

Having its own simplified executeQuery and executeUpdate methods and a closeConnection method that will invoked only after executeQuery method ( since the ResultSet returned must be used first in any desired transaction before closing a connection )

And i will be used it as my Database connection manager.

I also haven't use the com.mysql.jdbc.ConnectionPropertiesTransform class,
but i think the goal is the same, please do correct me if im wrong,

I believe that all programmer/developer defined jar files are recommended to put them in WEB/INF/lib directory, since the content of a WAR file that will be used for deployment are the ROOT/["USER"] directory under myapps folder.....

i hope that it will make sense to you,

regards,
sukatoa
Oct 24 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Mike Chirico | last post by:
Interesting Things to Know about MySQL Mike Chirico (mchirico@users.sourceforge.net) Copyright (GPU Free Documentation License) 2004 Last Updated: Mon Jun 7 10:37:28 EDT 2004 The latest...
3
by: Nick | last post by:
hi, all I have a red hat 9 and looks like it had mysql 3.2.54 installed before, but, actually not, i can not find the install folder and I can not uninstall it. So I am trying to install/upgrade...
2
by: Sam White | last post by:
I have set up a MySQL db on one server, IIS 6.0 on another. Using Frontpage I created some forms to input data. On a test page I made, I have 4 fields. First is the ID which is autonumber (I leave...
33
by: Joshua D. Drake | last post by:
Hello, I think the below just about says it all: http://www.commandprompt.com/images/mammoth_versus_dolphin_500.jpg Sincerely, Joshua Drake
175
by: Sai Hertz And Control Systems | last post by:
Dear all, Their was a huge rore about MySQL recently for something in java functions now theirs one more http://www.mysql.com/doc/en/News-5.0.x.html Does this concern anyone. What I...
1
by: Good Man | last post by:
Hi there I've noticed some very weird things happening with my current MySQL setup on my XP Laptop, a development machine. For a while, I have been trying to get the MySQL cache to work....
15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
0
by: Sam Flywheel | last post by:
Hello, all: I am pleased to announce that the MySQL Journal is moving forward. During the past two weeks, I've been discussing the journal with MySQL AB, and the plan that's been devised...
15
by: Cirene | last post by:
I'm trying to convince my client that MySQL server is not the way to go for his project. Here are some reasons why... - If you use the MySQL Connector you are bound to GPL (unless you want to pay...
1
by: samathak | last post by:
Hi, I have implemented com.mysql.jdbc.ConnectionPropertiesTransform class. In the jdbc connection url, I have added propertiesTransform=com.mysql.jdbc.ConnectionPropertiesTransformImpl ...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.