LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 05-24-2011, 11:50 AM   #1
nbcohen
Member
 
Registered: Mar 2003
Location: Northern Virginia
Distribution: RH Enterprise, Fedora
Posts: 96

Rep: Reputation: 17
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
 
Old 05-24-2011, 01:32 PM   #2
mpapet
Member
 
Registered: Nov 2003
Location: Los Angeles
Distribution: debian
Posts: 548

Rep: Reputation: 72
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.
 
Old 05-24-2011, 03:26 PM   #3
nbcohen
Member
 
Registered: Mar 2003
Location: Northern Virginia
Distribution: RH Enterprise, Fedora
Posts: 96

Original Poster
Rep: Reputation: 17
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
 
Old 05-24-2011, 04:42 PM   #4
mpapet
Member
 
Registered: Nov 2003
Location: Los Angeles
Distribution: debian
Posts: 548

Rep: Reputation: 72
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Haproxy ,memcached ,mysql strange problem Eazy-Snatch Linux - Server 1 05-14-2008 02:54 AM
Very Strange MySQL Problem...works fine on small box, terrible on big box DukeLeto Linux - Software 2 01-01-2007 08:14 AM
Strange problem with PHP5/MySQL update function gabebster Programming 9 04-06-2006 11:48 PM
Strange problem - mysql not working through ssh tunnel ganz_friedrich Linux - Software 0 03-31-2006 08:45 AM
strange, strange alsa problem: sound is grainy/pixellated? fenderman11111 Linux - Software 1 11-01-2004 05:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 08:21 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration