Tomcat + Mysql - Unable to find java:comp -


I am trying to use Tomcat + MSQL to develop web applications and this is my configuration:

persistence.xml

  & lt; Persistence Unit Name = "Unit Mailing" Transaction Type = "RESOURCE_LOCAL" & gt; & Lt; Provider & gt; org.hibernate.jpa.HibernatePersistenceProvider & lt; / Provider & gt; & Lt; Non JTA-data-source & gt; java: comp / env / jdbc / unit mailing & lt; / Non-jta-data-source & gt; & Lt; Will be unlisted sections & gt; False & lt; / Will be unlisted sections & gt; & Lt; Shared-cache-mode & gt; ENABLE_SELECTIVE & lt; / Share-cache-mode & gt; & Lt; Recognition Mode & gt; Nobody & lt; / Recognition Mode & gt; & Lt; Properties & gt; & Lt; Property Name = "javax.persistence.schema-generation.database.action" value = "none" /> & Lt; / Properties & gt; & Lt; / Persistence unit & gt;   

web.xml

  & lt; Resource-Rif & gt; & Lt; Details & gt; MySQL Data Source Example & lt; / Description & gt; & Lt; Race-referee-name & gt; JDBC / EntityMappings & lt; / Race-referee-name & gt; & Lt; Race Type & gt; Javax.sql.DataSource & lt; / Race Type & gt; & Lt; Race writing & gt; Container & lt; / Writing the race & gt; & Lt; / Resources Ref & gt;   

context.xml (under Tomcat / config)

  & lt; Resource name = "jdbc / entity mappings" auth = "container" type = "javax Sql.DataSource" maxActive = "50" maxIdle = "30" maxWait = "10000" user name = "XXX" password = "XXX" driverClassName = "Com.mysql.jdbc.Driver" url = "jdbc: mysql: // localhost: 3306 / EntityMappings" />   

My schema is unit mapping.

After running it, I found some errors:

  The name [java: comp / env / jdbc / entity mapping] is not bound in this context. Unable to locate [Java: comp]. Unable to view JNDI name [java: comp / env / jdbc / entitymappings]: javax.preistence.PersistenceException: Unable to create unit manager factory   

I have mysql under my Tomcat / Liberty The driver is named (Mysql-connector-java-5.1.30-bin.jar)

to Java Try removing: comp / env prefix from your persistence.xml:

  & lt; Non-jta-data-source & gt; Jdbc / entitymappings & lt; / Non-jta-data-source & gt;    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -