-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 
Author Message
 Post subject: Can a .par file be used in Tomcat?
PostPosted: Thu Aug 18, 2005 11:57 am 
Pro
Pro

Joined: Fri Nov 19, 2004 5:52 pm
Posts: 232
Location: Chicago, IL
I'm having a few issues getting .par files to work inside Tomcat 5.5.9. I'm wondering what the recommended way of packaging up annotated classes is for use with Tomcat. I found that if I put them in a .par file, I receive a NoClassDefFoundError. Note, I'm putting the .par file in my WEB-INF/lib directory along with the main .jar file for my application. I'm guessing that this is because Tomcat only knows to look in files with a .jar extension. Note, if I test my .par with a standalone application and just include the .par in my classpath everything works fine. The class listed below is a class annotated with @Entity which is in my .par.

Code:
javax.faces.el.EvaluationException: java.lang.NoClassDefFoundError: edu/uchicago/at/alt/persistence/entity/Application

I can get it to work if I simply put all the files including the META-INF/persistence.xml file in my main .jar file. However, I still receive an exception like the following (but it works).

Code:
WARNING: Unable to find file (ignored): opt/jakarta-tomcat-5.5.9-dev/webapps/alt/WEB-INF/lib/alt.jar
java.util.zip.ZipException: No such file or directory
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at org.hibernate.ejb.packaging.ZippedJarVisitor.doProcessElements(ZippedJarVisitor.java:29)
        at org.hibernate.ejb.packaging.JarVisitor.getClassNames(JarVisitor.java:79)
        at org.hibernate.ejb.HibernatePersistence.addMetadataFromVisitor(HibernatePersistence.java:216)
        at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:185)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
        at edu.uchicago.at.alt.persistence.EntityManagerManager.getEntityManagerFactory(EntityManagerManager.java:89)

Hibernate version: hibernate-3.1beta1, hibernate-entitymanager-3.1beta2

Has anyone else ran into this or know what I might be doing wrong?


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 19, 2005 4:36 am 
Newbie

Joined: Sat Aug 13, 2005 4:48 am
Posts: 5
Location: Pakistan
I think it should be a jar file. and you can add classes using Annotation Factory. There is no par deployer in tomcat. You will have to to create a session factory manually. We are using spring's session factory and adding annotated classes one by one.

There wont be any injection. Tomcat is not a full fledged J2EE server.

_________________
Custom Software and Custom Website Design
Dont forget to rate


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 19, 2005 9:05 am 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
Rename it .jar, it should work the same way. If not, let me know.

khurram, there is no need for par deployer, since EJB3 persistence works in Java SE and "deploy" the persistence archives.

Quote:
We are using spring's session factory and adding annotated classes one by one.

That sucks :-)

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 19, 2005 10:03 am 
Pro
Pro

Joined: Fri Nov 19, 2004 5:52 pm
Posts: 232
Location: Chicago, IL
When I rename the archive from alt.par to alt-persistence.jar, I receive the following exception. It works, but, I get the exception in my logs. Note, the file listed in the exception doesn't have a leading '/', if it did, it looks like it would have found the file. i.e. it looks like it's trying to use a absolute path as a relative path maybe (unless the root directory is the CWD, but, that shouldn't be the case)?

Code:
Aug 19, 2005 8:54:01 AM edu.uchicago.at.alt.persistence.EntityManagerManager getEntityManager
INFO: Creating entity manager
Aug 19, 2005 8:54:01 AM edu.uchicago.at.alt.persistence.EntityManagerManager getEntityManagerFactory
INFO: Creating entity manager factory
Aug 19, 2005 8:54:01 AM org.hibernate.ejb.packaging.ZippedJarVisitor doProcessElements
WARNING: Unable to find file (ignored): opt/jakarta-tomcat-5.5.9-dev/webapps/alt/WEB-INF/lib/alt-persistence.jar
java.util.zip.ZipException: No such file or directory
        at java.util.zip.ZipFile.open(Native Method)
        at java.util.zip.ZipFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at java.util.jar.JarFile.<init>(Unknown Source)
        at org.hibernate.ejb.packaging.ZippedJarVisitor.doProcessElements(ZippedJarVisitor.java:29)
        at org.hibernate.ejb.packaging.JarVisitor.getClassNames(JarVisitor.java:79)
        at org.hibernate.ejb.HibernatePersistence.addMetadataFromVisitor(HibernatePersistence.java:216)
        at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:185)
        at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:37)
        at edu.uchicago.at.alt.persistence.EntityManagerManager.getEntityManagerFactory(EntityManagerManager.java:89)
        at edu.uchicago.at.alt.persistence.EntityManagerManager.getEntityManager(EntityManagerManager.java:77)
        at edu.uchicago.at.alt.application.ApplicationHandler.<init>(ApplicationHandler.java:50)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at java.lang.Class.newInstance0(Unknown Source)
        at java.lang.Class.newInstance(Unknown Source)
        at java.beans.Beans.instantiate(Unknown Source)
        at java.beans.Beans.instantiate(Unknown Source)
        at com.sun.faces.config.ManagedBeanFactory.newInstance(ManagedBeanFactory.java:203)
        at com.sun.faces.application.ApplicationAssociate.createAndMaybeStoreManagedBeans(ApplicationAssociate.java:256)


Top
 Profile  
 
 Post subject:
PostPosted: Fri Aug 19, 2005 1:21 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
OK, open a bug, I'll look at that.

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 5:22 pm 
Hibernate Team
Hibernate Team

Joined: Sun Sep 14, 2003 3:54 am
Posts: 7256
Location: Paris, France
I've fixed the problem

_________________
Emmanuel


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 23, 2005 6:16 pm 
Pro
Pro

Joined: Fri Nov 19, 2004 5:52 pm
Posts: 232
Location: Chicago, IL
Cool, thanks! I'll give it a try again when the next beta comes out...


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 7 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.