-2

I Hey guys i applied for job and they gave me create app to acquire basic skills they can work with but i have problem i have to use java 12 J2EE8 and wildfly 16.0.0 server but i cant run any examples on wildfly

I downloaded eclipse and in eclipse jboss then i added wildfly server, and then i followed this http://www.thejavageek.com/2015/12/16/jax-rs-hello-world-example-with-wildfly/ and i checked Generate web.xml deployment descriptor (firt time i did it without but it didnt work and i looked in comments) error upon going to localhost

1 Answers1

0

Wildfly in it basic form can only support code that doesn't imply an access to a given database but when you add this fonctionnaly to your code, you have to configure your server to fullfil that fonctionnality.
These are the different steps and demonstrations on how to do so :

  • Add a managment user to your wildfly server by running the add-user script into the bin directory of wildfly.
  • Add a driver
  • Then you can add datasource either in your browser or directly in code.

Here is a youtube tutorial on how to do the two last operations. And then you can easily configure your persistence.xml file as it is detailed here :

<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd ">
  <persistence-unit name="NOT_REQUIRED_IF_YOU_ONLY_USE_ONE" transaction-type="JTA">
    <jta-data-source>NAME_OF_YOUR_DATASOURCE</jta-data-source>
    <properties>
        <property name="hibernate.hbm2ddl.auto" value="update"/>
    </properties>
  </persistence-unit>
</persistence>

Hope it will help

Big Zed
  • 417
  • 5
  • 11