Linux - Server This forum is for the discussion of Linux Software used in a server related context. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
05-24-2011, 11:50 AM
|
#1
|
Member
Registered: Mar 2003
Location: Northern Virginia
Distribution: RH Enterprise, Fedora
Posts: 96
Rep:
|
Strange problem with MySQL
Having a very strange problem with mysql. Here is the situation.
Developed a java program that reads and updates a database. Using Eclipse and Hibernate to build the system. Tested the program on my local development box and it works fine.
Copied the java jar file (and libraries) to a production machine. Installed the database on that system. Run the program and it hangs. It hangs the first time it tries to access the database in this code:
public EntityManager getEntityManager(){
if(emf == null){
if(dbProperties != null){
Logger.info("Override database properties...");
/*** The log statement above prints ****/
emf = Persistence.createEntityManagerFactory("mydb",dbProperties);
/*** This log stmt does not print - system hangs ***/
Logger.info("EMF Created");
}
else{
emf = Persistence.createEntityManagerFactory("VRSN_RRD_Entities");
}
}
em = emf.createEntityManager();
return(em);
}
I can access the database from the command line on the target system and it is available. Here is where it gets strange...
I copied the program to a different machine on the network. When I run the program, it works fine and updates the database on the correct (remote) machine. But it won't run locally. The username and password is set correctly in the database and as I said, I can access it locally using the command line. No indication of an error in the mysql log file.
In order to get it to run from the remote system, all I did was change the database url in the dbProperties parameter file.
I'm a bit desperate here - I could use some tips on what to look for, or what could be causing this problem... I have no idea what is going on...
thanks,
nbc
And an update.... I left my program hung and ran an errand, and when I came back, I found the following error on my screen. This is attempting to access the database locally. It took at least 10 minutes before this error showed up. Any suggestions would be welcome...
nbc
============= program output...
Start Database Update
BinRoot : /abc/def/bin
DataRoot: abc/def/data
DB Url : jdbc:mysql://1.2.3.4:3306/my_database_name
Get RecTypeArray
Override database properties...
Error parsing XML: XML InputStream(2) cvc-elt.1: Cannot find the declaration of element 'persistence'.
Exception in thread "main" javax.persistence.PersistenceException: invalid persistence.xml
at org.hibernate.ejb.packaging.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:72)
at org.hibernate.ejb.packaging.PersistenceXmlLoader.deploy(PersistenceXmlLoader.java:89)
at org.hibernate.ejb.Ejb3Configuration.configure(Ejb3Configuration.java:222)
at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:125)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:51)
at com.verisign.common.rrd.db.Ctl_DB_Base.getEntityManager(Ctl_DB_Base.java:109)
at com.verisign.common.rrd.db.Ctl_RecType.getAllRecType(Ctl_RecType.java:37)
at com.verisign.jart.Main.init(Main.java:46)
at com.verisign.jart.Main.main(Main.java:88)
Caused by: org.xml.sax.SAXParseException: cvc-elt.1: Cannot find the declaration of element 'persistence'.
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrap per.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.handleStartElement(XMLSchemaValidator. java:1915)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.startElement(XMLSchemaValidator.java:7 05)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScann erImpl.java:400)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook (XMLNSDocumentScannerImpl.java:626)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XM LDocumentFragmentScannerImpl.java:3103)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerI mpl.java:922)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java: 140)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragm entScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at org.hibernate.ejb.packaging.PersistenceXmlLoader.loadURL(PersistenceXmlLoader.java:70)
... 8 more
|
|
|
05-24-2011, 01:32 PM
|
#2
|
Member
Registered: Nov 2003
Location: Los Angeles
Distribution: debian
Posts: 548
Rep:
|
BinRoot : /abc/def/bin
DataRoot: abc/def/data
I'll take a shot in the dark.
shouldn't DataRoot start with a /?
Are all of the XML dependencies available on the problem machine?
Is JDBC configured correctly on the problem machine. I'd look here first.
|
|
|
05-24-2011, 03:26 PM
|
#3
|
Member
Registered: Mar 2003
Location: Northern Virginia
Distribution: RH Enterprise, Fedora
Posts: 96
Original Poster
Rep:
|
Strange Mysql problem
Hi - I think that was an editing typo - yes, dataRoot does start with a '/'. The target machine has a second database on it that is accessed by some other java programs using the same username and password as the one that fails. However, those programs were written some time ago using Netbeans, and this set of programs was built using Eclipse (I'm a brand new Eclipse user, although I have used Netbeans for more than a decade). Could be crossover between the 2 sets of java programs... I'm suspicious that there is a bad library path sneaking in somewhere, but I'm not sure where it would be or how to find it. The fact that it works locally on my development box, and remotely from my second production machine would indicate a bad library someplace, or perhaps a permission issue, although the xml parse error makes me lean towards the library...
Is there a way to dump my classpath, or trace which libraries are being called??
nbc
|
|
|
05-24-2011, 04:42 PM
|
#4
|
Member
Registered: Nov 2003
Location: Los Angeles
Distribution: debian
Posts: 548
Rep:
|
You describe the program as not even generating an event in mysql. That suggests it's not getting as far as accessing mysql.
Use google to search for: eclipse jdbc mysql
Verify your jdbc connector is configured right.
|
|
|
All times are GMT -5. The time now is 10:19 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|