Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Amazong MySQL configuration

  • 19-03-2014 2:02pm
    #1
    Registered Users, Registered Users 2 Posts: 8,324 ✭✭✭


    I've gotten a free amazon server set up for my college fyp. However, I'm have trouble getting the database connected to the application (The database is working, as I can connect via MySQL work bench, and transfer data to it, which I can then view in the mysql app in my ssh connect)

    I have the following in my context.xml file on a local machine, which works.

    <Resource name="jdbc/mtc" auth="Container" type="javax.sql.DataSource"
    maxActive="100" maxIdle="30" maxWait="10000" username="root"
    password="root" driverClassName="com.mysql.jdbc.Driver"
    url="jdbc:mysql://localhost:3306/mtc" />

    I have no idea what the url is for amazon, or how to find the URL from mysql. Any ideas?


Comments

  • Registered Users, Registered Users 2 Posts: 40,038 ✭✭✭✭Sparks


    Can't you see the EC2 instance's address in your EC2 console?


  • Registered Users, Registered Users 2 Posts: 8,324 ✭✭✭chrislad


    Sparks wrote: »
    Can't you see the EC2 instance's address in your EC2 console?

    I can connect to Tomcat on the EC2 already.



    I've attached my Tomcat error log.

    It looks like the dataSource isn't set up correctly, which is affecting other things.


  • Registered Users, Registered Users 2 Posts: 40,038 ✭✭✭✭Sparks


    Just quickly glancing at that (sorry, but I'm actually at work :D ) it doesn't look so much like a network config problem as a provisioning problem, that file's one long list of errors of stuff not being found right from the get-go. Are you sure the installation was done correctly?


  • Registered Users, Registered Users 2 Posts: 8,324 ✭✭✭chrislad


    It seems to be. I can access port 8080 on the Tomcat server at http://ec2-54-186-160-221.us-west-2.compute.amazonaws.com:8080/

    I can connect to the MySQL database through MySQL Workbench, and I can upload data to the database through that all. I confirmed by running queries through mysql on a ssh connection to the server.

    Tomcat has extracted the war file within the /webapps folder, and I'm seeing a monaleen-tennis folder within the tomcat7/webapps folder when I check the directory.

    Everything does work locally with no issues. The databases are both created from the same model also.

    This is the first error, and it seem to be starting from the dataSource not being set up right.

    Error creating bean with name 'exceptionTranslator' defined in class path resource [beans/dao-context.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in class path resource [beans/dao-context.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource': Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: Name [jdbc/mtc] is not bound in this Context. Unable to find [jdbc].


  • Closed Accounts Posts: 1,487 ✭✭✭Pov06


    Are you running any sort of firewall such as iptables?


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 1,311 ✭✭✭Procasinator


    Seems to be not able to find the dataSource configuration is not available to Tomcat. Where are you putting this configuration?


  • Registered Users, Registered Users 2 Posts: 8,324 ✭✭✭chrislad


    Seems to be not able to find the dataSource configuration is not available to Tomcat. Where are you putting this configuration?

    It's placed within the context.xml file, which is in the usr/share/tomcat7/conf folder.

    The only thing I can think of is that the sql connector jar is within the project dependencies. Should it be with the tomcat installation?


  • Registered Users, Registered Users 2 Posts: 8,324 ✭✭✭chrislad


    Pov06 wrote: »
    Are you running any sort of firewall such as iptables?

    Nope, no restrictions at all. Just trying to get it working first!


  • Registered Users, Registered Users 2 Posts: 1,311 ✭✭✭Procasinator


    chrislad wrote: »
    It's placed within the context.xml file, which is in the usr/share/tomcat7/conf folder.

    The only thing I can think of is that the sql connector jar is within the project dependencies. Should it be with the tomcat installation?

    http://tomcat.apache.org/tomcat-7.0-doc/jndi-datasource-examples-howto.html#MySQL_DBCP_Example

    The link goes through setting up for MySQL in Tomcat 7. It does mention that you should have the JDBC driver jar should be available from $CATALINA_HOME/lib.


  • Registered Users, Registered Users 2 Posts: 8,324 ✭✭✭chrislad


    I copied it in but same error.

    I'm looking at this line now
    WARNING: Failed to register in JMX: javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
    

    My DataSourceFactory is from org.apache.commons.dbcp.BasicDataSourceFactory.class, not org.apache.tomcat etc.


  • Advertisement
  • Registered Users, Registered Users 2 Posts: 8,324 ✭✭✭chrislad


    This is a snapshot of the jars in my project and what's in the lib in the /user/share/tomcat7 folder.

    I did remove commons-dbcp from my own project.


  • Registered Users, Registered Users 2 Posts: 1,311 ✭✭✭Procasinator


    chrislad wrote: »
    I copied it in but same error.

    I'm looking at this line now
    WARNING: Failed to register in JMX: javax.naming.NamingException: Could not create resource factory instance [Root exception is java.lang.ClassNotFoundException: org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory]
    

    My DataSourceFactory is from org.apache.commons.dbcp.BasicDataSourceFactory.class, not org.apache.tomcat etc.

    Maybe you are having a similar issue to this:
    http://stackoverflow.com/questions/14712308/ubuntu-tomcat7-java-lang-classnotfoundexception-org-apache-tomcat-dbcp-dbcp-bas


  • Registered Users, Registered Users 2 Posts: 8,324 ✭✭✭chrislad


    I got it working! I need to add this line to my definition in my context.xml file to override the default value, which I didn't have to do locally!

    factory="org.apache.commons.dbcp.BasicDataSourceFactory"


  • Registered Users, Registered Users 2 Posts: 8,324 ✭✭✭chrislad




Advertisement