I am not quite clear - if that's the case, then project A and project
B aren't standalone projects.
In other words, how many WAR files will you be deploying to Tomcat (or
your container)?
Cheers,
Alex
On 17 Dec 2007, at 19:18, Mike Wille wrote:
I just realized that I have left something out. My end goal was to
generate one combined web app from project A and B using the jar/war
overlay feature. Does that change anything?
Thanks!
-Mike
Alexander Coles wrote:
I think so. I am offering this as a purely suggestion - the system
I am currently working on -- with two WARs/web apps - is
constrained by exactly what you mentioned: Tomcat is the deployment
environment for the enterprise, so I don't have the full J2EE stack
available to me.
Instead I've just developed two monolithic applications, that share
JAR'ed-up code in the core module. But there's no sharing of a
applicationContext at run app. Ostensibly they're entirely separate
with separate SessionFactories, etc.
Let us know how it works out!
Alex
On 17 Dec 2007, at 18:49, Mike Wille wrote:
Yes, project A is also a stand alone project. It has both Core
and Web modules.
Thanks for the links. I will take a look. At first glance, it
seems that this creates an EAR file and would then require
something more then Jetty or Tomcat.
Thanks!
-Mike
Alexander Coles wrote:
Is Project A also a stand alone project, or does it just provide
infrastructure support?
If I am understanding your requirement rightly, you could create
a shared parent application context:
http://blog.interface21.com/main/2007/06/11/using-a-shared-parent-application-context-in-a-multi-war-spring-application/
http://springtips.blogspot.com/2007/06/using-shared-parent-application-context.html
Alex
On 17 Dec 2007, at 18:16, Mike Wille wrote:
Hi All,
I'm looking for advice on setting up multiple projects. I've
been using the Spring MVC Modular archetype with appfuse and it
works great.
Now I was thinking about trying it out on a larger scale. I'm
setting up a second project (multi module) that depends on the
first. Everything worked out great until I went to add new
model objects to my second project. I can't get the new DAOs
and model to work in the Core module of the second project. I
am using Hibernate and I'm getting any one of a number of errors
(depending on how I adjust the spring config). So I'm looking
for the recommended way to set something like this up.
Let me describe what I have done and the errors I am receiving.
I have two projects: Project A and Project B. Project A
provides infrastructure support. Project B provides application
specific features. Project B depends on Project A.
1. It appears that I cannot leverage the hibernate session
factory or data source from Project A. When I do not specify a
SessionFactory in Project B, my DAOs fail to be created in the
spring context with a failed dependency on bean named
sessionFactory. I guess this isn't a problem really, just
something I needed to be aware of.
2. After adding a session factory and data source to Project B,
my annotated hibernate entities created in Project B are not
found. By not found, I mean my unit tests fail when attempting
to call DAO methods. The exeception is:
org.hibernate.MappingException: Unknown entity:
company.app.model.Entity
My hibernate.cfg.xml file in Project B (both main and test
directories) *does* list the entity and I even added it to
persistence.xml just for the heck of it. So it appears to me
that the Project B SessionFactory is loading the
hibernate.cfg.xml from Project A. I assume this because of the
property: configLocation that is set to
"classpath:hibernate.cfg.xml". I tried changing that setting to
just "hibernate.cfg.xml" in the interests of just getting the
tests to work. No luck there. I then went back to project A
and tried renaming hibernate.cfg.xml to something like projecta-
hibernate.cfg.xml and then updated the SessionFactory for
Project A to point to that. When I do that, I get an exception
on build: "No hibernate.cfg.xml configuration provided.
Annotated classes/packages is only configurable via
hibernate.cfg.xml"
I thought that maybe I could suppress Project A's
hibernate.cfg.xml and so I added Project A's entities to Project
B's hibernate.cfg.xml, but in the end I couldn't figure out a
way to suppress Project A.
While I knew it wouldn't work, I even tried adding Project B's
entity declarations to Project A's hibernate.cfg.xml to try and
get Project B to work. That caused Project A's build to fail,
of course.
I've tried adding an entry to Project B's spring context for a
HibernateExtensionPostProcessor that includes Project B's
entities. But that gives me a different exception:
org.springframework.beans.factory.BeanCreationException: Error
creating bean with name 'sessionFactory' defined in class path
resource [applicationContext-dao.xml]: Invocation of init method
failed; nested exception is org.hibernate.HibernateException:
cannot simultaneously fetch multiple bags
So now I'm completely lost. Is there anybody out there that can
offer any help or advice? Has anyone tried to do what I am doing?
Thanks a bajillion for any help!
-Mike
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]