Struts 2 Modules

2 views
Skip to first unread message

jordi

unread,
Jul 24, 2008, 3:50:31 AM7/24/08
to google...@googlegroups.com
howdy!

is there any way to install more than just one Module inside struts2 via xml or properties?

if i type two modules separated by comma, the usual way with properties, i got this trace:

Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: com.eventuo.guice.HibernateModule, com.eventuo.guice.LoggerModule
    at com.google.inject.struts2.GuiceObjectFactory.setModule(GuiceObjectFactory.java:65)
    ... 67 more
Caused by: java.lang.ClassNotFoundException: com.eventuo.guice.HibernateModule, com.eventuo.guice.LoggerModule
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.google.inject.struts2.GuiceObjectFactory.setModule(GuiceObjectFactory.java:61)
    ... 67 more


jordi


Haolin

unread,
Jul 24, 2008, 4:03:11 AM7/24/08
to google...@googlegroups.com
jordi 写道:
Hi, jordi
I think you can separate different modules and install them to one
module which could called "WebModule" as you like.
Then for your application, you can install the "WebModule" to the
ApplicationModule.
I think it will work.

--

Thanks!

Mobile: +086-15864011231
EMail&gtalk:sahar...@gmail.com
EMail&yahoo:jia_h...@yahoo.com
Skype:saharabear


Haulyn Runner Jason

jordi

unread,
Jul 24, 2008, 4:06:43 AM7/24/08
to google...@googlegroups.com
yeah that's the way i have it right now.. i just was curious ;P

thanks anyway Haolin!

Haolin

unread,
Jul 24, 2008, 4:12:40 AM7/24/08
to google...@googlegroups.com
jordi 写道:
> <mailto:EMail%26gtalk%3Asaha...@gmail.com>
> EMail&yahoo:jia_h...@yahoo.com
> <mailto:EMail%26yahoo%3Ajia_...@yahoo.com>
> Skype:saharabear
>
>
> Haulyn Runner Jason
>
>
>
>
>
> >
You are welcome :)

--

Thanks!

Mobile: +086-15864011231
EMail&gtalk:sahar...@gmail.com
EMail&yahoo:jia_h...@yahoo.com
Skype:saharabear


贾昊林(Haulyn Runner Jason)

Brian Pontarelli

unread,
Jul 24, 2008, 9:33:04 AM7/24/08
to google...@googlegroups.com
You can have a Module that loads other modules if you want to use the
Guice ObjectFactory. I found it was simpler to write my own
ObjectFactory that not only allowed multiple Modules but also made the
Injector available to the rest of the application.

Or, you can try out JCatapult, which is similar to Struts, but has its
own MVC (in addition to a bunch of other stuff). JCatapult is built
from the start to work with Guice and the entire framework is
instantiated and managed by Guice. We actually do a discovery process
to find Modules. You place Modules in a package named *guice* and
JCatpault will discover them (i.e. com.example.guice.MyModule). Works
nicely.

-bp

Reply all
Reply to author
Forward
0 new messages