facebook

[Closed] Hibernate Not Generating Classes

  1. MyEclipse Archived
  2.  > 
  3. Database Tools (DB Explorer, Hibernate, etc.)
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #243079 Reply

    Ken Nelson
    Member

    I have ran into an odd problem. All of the sudden when I try to Create Hibernate Mapping from the DB Browser, no classes are generated and there is no error message. I am really not sure what the issue is. Has anyone run into a similar issue?

    #243080 Reply

    Ken Nelson
    Member

    It turns out that I had created a java project that relied on the commons and log4 jar files. I had to run them from the command line, which required me to place them in the lib\etc dir of the jre. Once I removed them, I was able to map again. I guess I had placed a different version of the files in the directory.

    #243095 Reply

    Riyad Kalla
    Member

    This is a sneaky problem, whenever you put JARs in your JRE’s /etc dir beware. You never know what libraries the software you rely on uses, in this case, our Hibernate plugins likely were conflicting and silently failing against those versions of log4j.

    #243131 Reply

    Ken Nelson
    Member

    Thanks rkalla,

    I have seen that this issue is not mine alone. Do you guys have a recommendation for how you package and run a default class from a jar. One that relies on other classes in other jars?

    I see three options

    1) Unjar the dependant jars and package them in your jar. This may violate some license agreement and is generally a bad practice.
    2) Place the jar’s in the lib\etc of the JRE. We have seen the issue here. So another not so good idea.
    3) I did find this http://www-128.ibm.com/developerworks/java/library/j-onejar/ which sounds interesting but I think you would have to include the class in every application. Not that I actually write a lot of applications – I work more on web apps.

    #243140 Reply

    Riyad Kalla
    Member

    Do you guys have a recommendation for how you package and run a default class from a jar. One that relies on other classes in other jars?

    All sizable projects that I am aware of use a deployment technology like WebStart (this gets my personal vote) or a startup script (any IDE, App server etc,.) that sets up the classpath with the necessary JARs on it and calls the main class.

    Is this not something you would want to do? I believe there is a way, as long as the JARs are all in the same dir, to make your class-path entries in your MANIFEST.MF file add all of them to the classpath when the main class executes. But this isn’t a great solution or one I have tried.

    #243145 Reply

    Ken Nelson
    Member

    Actually no. What I want to do is run this from cron. I have tried various methods of including the support jar’s with no success. I included the supporting jar’s in my jar – didn’t work. I ran with classpath set to point to the supporting jars – didn’t work. I spent WAY to much time on it trying various combinations of the above – never found anything that woeked.

    #243146 Reply

    Riyad Kalla
    Member

    Actually no. What I want to do is run this from cron. I have tried various methods of including the support jar’s with no success.

    java -cp lib\a.jar:lib\b.jar:lib\c.jar com.sanclem.Main

    Why doesn’t that work from the cron job? We run quite a few Java-based services in our cron jobs all in this manner, seems to work fine. Is there a specific problem you are running into?

    I ran with classpath set to point to the supporting jars – didn’t work.

    Don’t mess around trying to get a CLASSPATH environment variable right, waste of time, lots of headaches.

    I spent WAY to much time on it trying various combinations of the above – never found anything that woeked.

    The more time you spend one something, is the simpler the solution… so hopefully that’s good news 🙂

    #243147 Reply

    Ken Nelson
    Member

    @support-rkalla wrote:

    java -cp lib\a.jar:lib\b.jar:lib\c.jar com.sanclem.Main

    That told me that a class (org.commons.net.FTPClient or something like that) I was using did not exist. The class was in a.jar (Actually it was in commons-net-???.jar) for example.

    @support-rkalla wrote:

    The more time you spend one something, is the simpler the solution… so hopefully that’s good news 🙂

    Isn’t that always the case 😀

    #243149 Reply

    Riyad Kalla
    Member

    That told me that a class (org.commons.net.FTPClient or something like that) I was using did not exist. The class was in a.jar (Actually it was in commons-net-???.jar) for example.

    Send me a PM with all the dependent JARs, the name of the main JAR and the name of the main class.

    Just to clarify, everything is in normal JARs right? If you are executing your code outside of a JAR, but have dependent JARs you need to add to the path let me know that too.

Viewing 9 posts - 1 through 9 (of 9 total)
Reply To: [Closed] Hibernate Not Generating Classes

You must be logged in to post in the forum log in