0

First time asking a question on here, long time use of finding answers through here on google! I've started a coding challenge for a company. I completed the challenge and have it functioning to their requirements. All it needs now is to be hosted on AWS. I hosted it to AWS, but it seems AWS can't use or find my cfg.xml files. I've read endlessly and watched youtube tutorials and cant seem to find my answer.

I've set up an RDS and a table that mirrors my table that I can host locally through tomcat. But it seems I have to do something to route hibernate to the database now.

HTTP Status 500 – Internal Server Error Type Exception Report

Message Request processing failed; nested exception is org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [hibernate.cfg.xml]

Is the error I get when the page tries to access the DB from AWS, as mentioned it works fine when I launch it through eclipse. I imagine I have to do something with the hibernate.cfg.xml file just not sure how to adapt it for AWS. Help would be appreciated! Thanks

    <?xml version='1.0' encoding='utf-8'?>

<session-factory>


    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/schema</property>
    <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.username">un</property>
    <property name="hibernate.connection.password">pw</property>
            <property name="show_sql">true</property>

    <mapping class="com.dto.RegisteredUserDto"></mapping>
    <mapping resource="RegisteredUserDto.hbm.xml"></mapping>


</session-factory>

Joe G
  • 1
  • 1

2 Answers2

0

If you are using Maven to build your project, place the hibernate.cfg.xml file under src/main/resources.

refer this regarding location of hibernate.cfg.xml

Location of hibernate.cfg.xml in project?

Alien
  • 15,141
  • 6
  • 37
  • 57
0

Solved it. Not sure if there was a typo. But I made a new instance in AWS with a new RDS. I created the table again under this connection in mysql. I updated my hibernate file with the new url. Updated my AWS. And it worked fine.

Joe G
  • 1
  • 1