ec2+tomcat+mysql Access Denied!
I'm running tomcat6 and mysql5 on a single ec2 instance and i cannot cannot from the outside world.
My context.xml on tomcat in ec2...
<bean id="dataSource" class="com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource">
<property name="url" value="jdbc:mysql://ec2-xx-xx-xxx-178.compute1.amazonaws.com:3306/data_dbo" />
<property name="user" value="a_user" />
<property name="password" value="a_password" />
</bean>
Client context.xml
<bean id="myService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
<property name="serviceUrl" value="http://ec2-xx-xx-xxx-xxx.compute-1.amazonaws.com:8080/MyService-services/remoting/thingServiceExporter"/>
<property name="serviceInterface" value="com.things.services.MyService"/>
</bean>
Error on clinet...
Caused by: java.sql.SQLException: Access denied for user ''@'domU-xx-xx-xx-xx-xx-DB.compute-1.internal' (using password: NO)开发者_如何学编程
I've setup privileges for my user but it doesn't seem to be using the user i setup in my tomcat datasource. I say this because of the error on the client (Access denied for user ''@) no user, no password. Do i need to setup something between tomcat and mysql on ec2 because it seems to be using the internal dns to access MySql?
Let me know if i can provide any other information!
I found the issue. My persistance.xml had the following code...
<properties>
<property name="hibernate.connection.username" value=""/>
<property name="hibernate.connection.driver_class" value=""/>
<property name="hibernate.connection.password" value=""/>
<property name="hibernate.connection.url" value=""/>
</properties>
Not sure how that got in there! The settings in the persistance.xml must override the settings in my Spring context file.
精彩评论