简体   繁体   中英

Glassfish wont fetch table from MySQL/Java DB

Alright so what I'm try to do is create a CRUD website application over netbeans IDE 7.3 to handle cases, you should be able to add case edit etc, but my problem is glassfish. What I keep on getting are Warning and I never manage to connect to the database. The Warning Shows


WARNING: Multiple [2] JMX MBeanServer instances exist, we will use the server at index [0] : [com.sun.enterprise.v3.admin.DynamicInterceptor@41878a17].
WARNING: JMX MBeanServer in use: [com.sun.enterprise.v3.admin.DynamicInterceptor@41878a17] from index [0]
WARNING: JMX MBeanServer in use: [com.sun.jmx.mbeanserver.JmxMBeanServer@4a56d1e3] from index [1]


I'm trying to connect the application to go over JDBC(Glassfish) then to Mysql and fetch the table named cases which contains information idcases etc. I've added the jar file which I'm supposed to do for the connection to mysql to be possible and it PING:s correctly without a problem. But when I run the application I never manage to get the data to show, it's like it does not connect to MySQL at all. I've tried to create a new database in Java DB to be able to access it over there, same table name and information ofc. But still it won't show anything and I still get the Warning. More that I've tried to do is install and Uinstall glassfish to see if it perhaps is an internal problem but it does not seem to be it. I've checked my coding to see if perhaps my SQL query is wrong, but checked on numerous sites and it looks legit. I've also tried to specifi the table in the code


@Entity(name = "Cases")

@Table(name = "Cases")

@NamedQueries({@NamedQuery(name="Cases.getAll",query="SELECT e FROM Cases e")})

public class Cases implements Serializable{


Neither does that help, and now I've come to a stop. I'm wondering is the Warning that I'm getting, has that something to do that the tables and data will not fetch and show?


Since the above information was not for much help I've added more information about the persistence.xml file


    <?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="CaseApplikationWebbPU" transaction-type="JTA"> 
<jta-data-source>jdbc/mydb</jta-data-source> 
<exclude-unlisted-classes>false</exclude-unlisted-classes> 

Alright so something is wrong with the persistence file, what I have done is I've gone simply to the Data Source and I've tried to connect it to the MySQL and JavaDB whom both have the same table, I simply did this choosing the right Data source, which is mydb. But I have not added anymore code to the persistence file so it does not contain anything more then the default

I'm also simply using “Persistence Provider” EclipseLink(JPA 2.0)(default)

Alright so this took me some time. I managed to get evreything working all I did was to delete glassfish and reinstall it to an older version and all the errors disapered. This SOLUTION helpt me and can maybe help others. I just installed an olderversion glassfish v3 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM