Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
5.1.0
-
None
-
None
Description
Using MySQL 5.5, JDK 7, Ubuntu 12.04, JBoss Enterprise Application Platform 6.1.0.Final (http://www.jboss.org/jbossas/downloads/) and Roller trunk. I've installed Roller trunk following the updated instructions in the trunk install guide:
http://svn.apache.org/viewvc/roller/trunk/weblogger-docs/installguide/
As far as I can tell, datasource and JavaMail configured correctly. Problem is that the JBoss' JPA implementation seems pickier than the OpenJPA used by Tomcat. Deploying the JBoss Roller WAR gives this error:
Internal Server Error
{
"outcome" => "failed",
"failure-description" => {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"roller.war#RollerPU\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"roller.war#RollerPU\": javax.persistence.PersistenceException: [PersistenceUnit: RollerPU] Unable to build EntityManagerFactory
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: RollerPU] Unable to build EntityManagerFactory
Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on org.apache.roller.weblogger.pojos.AutoPing.pingTarget references an unknown entity: org.apache.roller.weblogger.pojos.PingTarget"}},
"rolled-back" => true
}
To fix this, I need to:
1.) Add PingTarget as a class to persistence.xml (http://svn.apache.org/viewvc/roller/trunk/weblogger-business/src/main/resources/META-INF/persistence.xml?view=markup)
<class>org.apache.roller.weblogger.pojos.PingTarget</class>
2.) In PingTarget (http://svn.apache.org/viewvc/roller/trunk/weblogger-business/src/main/java/org/apache/roller/weblogger/pojos/PingTarget.java?view=markup), addannotation @javax.persistence.Entity to class and annotation @javax.persistence.Id to PingTarget.getId().
That seems to fix it, because when I run it again JBoss complains about the next class lacking a <class> definition:
Internal Server Error
{
"outcome" => "failed",
"failure-description" => {"JBAS014671: Failed services" => {"jboss.persistenceunit.\"roller-5.1.0-SNAPSHOT-jboss.war#RollerPU\"" => "org.jboss.msc.service.StartException in service jboss.persistenceunit.\"roller-5.1.0-SNAPSHOT-jboss.war#RollerPU\": javax.persistence.PersistenceException: [PersistenceUnit: RollerPU] Unable to build EntityManagerFactory
Caused by: javax.persistence.PersistenceException: [PersistenceUnit: RollerPU] Unable to build EntityManagerFactory
Caused by: org.hibernate.AnnotationException: @OneToOne or @ManyToOne on org.apache.roller.weblogger.pojos.AutoPing.website references an unknown entity: org.apache.roller.weblogger.pojos.Weblog"}},
"rolled-back" => true
}
Problem is there's about 20 other classes lacking a <class> definition in persistence.xml – unsure if I really should be adding them all in, and if I did so, if I'd end up breaking the JPA as running on Tomcat and GlassFish as a result.