Alexey Ulyanov [http://community.jboss.org/people/re3lex] created the discussion

"Ear with jar and war with pure spring: how to configure?"

To view the discussion, visit: http://community.jboss.org/message/583390#583390

--------------------------------------------------------------
Hi guys!

At first thanks to snowdrop team for this useful deployer!

I have two modules within ear: MyProject.jar and MyProject.war.
MyProject.jar contains some spring services, hibernate domains and dao modules.
MyProject.war contains some REST resources and MVC spring components to have 
web access to services which are placed in MyProject.jar.

I don't use any EJB beans and to deploy MyProject.jar I use JbossSpring 
deployer 3.3 (as I use Spring 3.0.x)

So when I run jboss I see in the log that MyProject.jar is loaded twice: one 
time once JbossSpring deployer is deploying MyProject.jar and second time once 
MyProject.war is deployed by WarDeployer (I'm not sure who deploys war).

Looks like this happens because WarDeployer loads war not in the same scope 
that JbossSpring deployer loads jar

Can you please point me on to mistakes in my jboss&spring configuration?


Here is configuration for each module:
> MyProject.ear
>                     +MyProject.jar
>                      |                   +META-INF
>                      |                                 +com //compiled 
> classes are there
>                      |                                 +core-spring.xml
>                      |                                 +core-app-context.xml 
> //part of spring's services config and annotation scanning
>                      |                                 +core-db-context.xml 
> //part of spring's db config
>                      |
>                     +MyProject.war
>                                         +META-INF
>                                         +WEB-INF
>                                                        +classes //compiled 
> classes are there
>                                                        +web.xml
>                                                        +web-app-context.xml 
> //some security configuration and all mvc-related stuff
> 

core-spring.xml:


> <beans>
>    <bean id="core.spring.context" 
> class="org.springframework.context.support.ClassPathXmlApplicationContext">
>     <constructor-arg>
>       <list>
>         <value>classpath*:/META-INF/*-app-config.xml</value>
>       </list>
>     </constructor-arg>
>    </bean>
> </beans>

web.xml (here is only neccessary part of file):
> <web-app id="WebApp_ID" version="2.4" xmlns=" http://java.sun.com/xml/ns/j2ee 
> http://java.sun.com/xml/ns/j2ee";
>          xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance 
> http://www.w3.org/2001/XMLSchema-instance";
>          xsi:schemaLocation=" http://java.sun.com/xml/ns/j2ee 
> http://java.sun.com/xml/ns/j2ee  
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd 
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>
> 
>   <display-name>MyProject</display-name>
> 
>     <context-param>
>         <param-name>parentContextKey</param-name>
>         <param-value>core.spring.context</param-value>
>     </context-param>
>     <context-param>
>         <param-name>locatorFactorySelector</param-name>
>         <param-value>classpath*:/META-INF/core-spring.xml</param-value>
>     </context-param>
> 
>     <context-param>
>         <param-name>contextConfigLocation</param-name>
>         <param-value>classpath*:/WEB-INF/*-app-context.xml</param-value>
>     </context-param>
>   <listener>
>     
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
>   </listener>   
>  ... 
>   <servlet>
>       <servlet-name>ScoreCard</servlet-name>
>       
> <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
>       <init-param>
>           <param-name>contextConfigLocation</param-name>
>           <param-value>classpath*:/WEB-INF/*-app-config.xml</param-value>
>       </init-param>
>   </servlet>
>   <servlet-mapping>
>     <servlet-name>ScoreCard</servlet-name>
>     <url-pattern>*.action</url-pattern>
>   </servlet-mapping>
> ... 
> </web-app>
--------------------------------------------------------------

Reply to this message by going to Community
[http://community.jboss.org/message/583390#583390]

Start a new discussion in Snowdrop at Community
[http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2082]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to