Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to add postgresql to OpenShift Spring app?
    primarykey
    data
    text
    <p>I have created the <strong>Spring</strong> quick-start app on <strong>OpenShift</strong> and it was working all fine showing a web page for user registration, except it doesn't remember the new members after restart. I was thinking, that it's because I don't have a true database. So I added a <strong><em>postgresql-9.2</em></strong> cartridge. So my question is how to accurately configure <strong><em>postgresql</em></strong> to <strong>OpenSift Spring</strong> application, so that this web server can store the data that persist after restart.</p> <h2><strong>First problem</strong></h2> <p>I created the OpenShift project in Eclipse, but the <code>pom.xml</code> doesn't have the <strong><em>postgresql</em></strong> items. That meas, I couldn't see <strong><em>postgresql</em></strong> dependencies in the Maven dependencies. I believe that in other applications I created such as <strong><em>JBoss EAP 6</em></strong> I can find the Maven dependencies if I add the cartridges. What is the correct way to add <em>postgresql</em> to the project?</p> <h2><strong>Second problem</strong></h2> <p>There is a README.md file which says </p> <blockquote> <p>Edit <code>src/main/resources/META-INF/persistence.xml</code> to use the appropriate datasource (java:jboss/datasources/MysqlDS or java:jboss/datasources/PostgreSQLDS):</p> <pre><code>&lt;jta-data-source&gt;java:jboss/datasources/MysqlDS&lt;/jta-data-source&gt; </code></pre> </blockquote> <p>So I did. But I think this README is missing something. I build the project and see <code>jboss-deployment-structure.xml</code> has error. The content is </p> <pre><code>&lt;jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.0"&gt; &lt;deployment&gt; &lt;dependencies&gt; &lt;module name="com.h2database.h2"/&gt; &lt;module name="org.codehaus.jackson.jackson-core-asl"/&gt; &lt;module name="org.codehaus.jackson.jackson-mapper-asl"/&gt; &lt;module name="org.slf4j"/&gt; &lt;/dependencies&gt; &lt;/deployment&gt; &lt;/jboss-deployment-structure&gt; </code></pre> <p>I was thinking the problem is that the database h2 is now removed from the <code>persistence.xml</code>, but I don't know how to add the corresponding postgresql module here. I am a completely newbie on Spring/OpenShift/Postgresql, so can anyone help me on this?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload