<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<body link="#355491" alink="#4262a1" vlink="#355491" style="background: #e2e2e2; margin: 0; padding: 20px;">
<div>
        <table cellpadding="0" bgcolor="#FFFFFF" border="0" cellspacing="0" style="border: 1px solid #dadada; margin-bottom: 30px; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                <tbody>
                        <tr>
                                <td>
                                        <table border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF" style="border: solid 2px #ccc; background: #dadada; width: 100%; -moz-border-radius: 6px; -webkit-border-radius: 6px;">
                                                <tbody>
                                                        <tr>
                                                                <td bgcolor="#000000" valign="middle" height="58px" style="border-bottom: 1px solid #ccc; padding: 20px; -moz-border-radius-topleft: 3px; -moz-border-radius-topright: 3px; -webkit-border-top-right-radius: 5px; -webkit-border-top-left-radius: 5px;">
                                                                        <h1 style="color: #333333; font: bold 22px Arial, Helvetica, sans-serif; margin: 0; display: block !important;">
                                                                        <!-- To have a header image/logo replace the name below with your img tag -->
                                                                        <!-- Email clients will render the images when the message is read so any image -->
                                                                        <!-- must be made available on a public server, so that all recipients can load the image. -->
                                                                        <a href="http://community.jboss.org/index.jspa" style="text-decoration: none; color: #E1E1E1">JBoss Community</a></h1>
                                                                </td>
                                                        </tr>
                                                        <tr>
                                                                <td bgcolor="#FFFFFF" style="font: normal 12px Arial, Helvetica, sans-serif; color:#333333; padding: 20px; -moz-border-radius-bottomleft: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 5px; -webkit-border-bottom-left-radius: 5px;"><h3 style="margin: 10px 0 5px; font-size: 17px; font-weight: normal;">
Ear with jar and war with pure spring: how to configure?
</h3>
<span style="margin-bottom: 10px;">
created by <a href="http://community.jboss.org/people/re3lex">Alexey Ulyanov</a> in <i>Snowdrop</i> - <a href="http://community.jboss.org/message/583390#583390">View the full discussion</a>
</span>
<hr style="margin: 20px 0; border: none; background-color: #dadada; height: 1px;">
<div class="jive-rendered-content"><p>Hi guys!</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>At first thanks to snowdrop team for this useful deployer!</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>I have two modules within ear: MyProject.jar and MyProject.war.</p><p>MyProject.jar contains some spring services, hibernate domains and dao modules.</p><p>MyProject.war contains some REST resources and MVC spring components to have web access to services which are placed in MyProject.jar.</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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)</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>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).</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Looks like this happens because WarDeployer loads war not in the same scope that JbossSpring deployer loads jar</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Can you please point me on to mistakes in my jboss&spring configuration?</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>Here is configuration for each module:</p><blockquote class="jive-quote"><p>MyProject.ear</p><p>                    +MyProject.jar</p><p>                     |                   +META-INF</p><p>                     |                                 +com //compiled classes are there</p><p>                     |                                 +core-spring.xml</p><p>                     |                                 +core-app-context.xml //part of spring's services config and annotation scanning</p><p>                     |                                 +core-db-context.xml //part of spring's db config</p><p>                     |</p><p>                    +MyProject.war</p><p>                                        +META-INF</p><p>                                        +WEB-INF</p><p>                                                       +classes //compiled classes are there</p><p>                                                       +web.xml</p><p>                                                       +web-app-context.xml //some security configuration and all mvc-related stuff</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>core-spring.xml:</p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><blockquote class="jive-quote"><p><beans></p><p>   <bean id="core.spring.context" class="org.springframework.context.support.ClassPathXmlApplicationContext"></p><p>    <constructor-arg></p><p>      <list></p><p>        <value>classpath*:/META-INF/*-app-config.xml</value></p><p>      </list></p><p>    </constructor-arg></p><p>   </bean></p><p></beans></p></blockquote><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>web.xml (here is only neccessary part of file):</p><blockquote class="jive-quote"><p><span><web-app id="WebApp_ID" version="2.4" xmlns="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/j2ee" target="_blank">http://java.sun.com/xml/ns/j2ee</a><span>"</span></p><p><span>         xmlns:xsi="</span><a class="jive-link-external-small" href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a><span>"</span></p><p><span>         xsi:schemaLocation="</span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/j2ee" target="_blank">http://java.sun.com/xml/ns/j2ee</a><span> </span><a class="jive-link-external-small" href="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" target="_blank">http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd</a><span>"></span></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>  <display-name>MyProject</display-name></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    <context-param></p><p>        <param-name>parentContextKey</param-name></p><p>        <param-value>core.spring.context</param-value></p><p>    </context-param></p><p>    <context-param></p><p>        <param-name>locatorFactorySelector</param-name></p><p>        <param-value>classpath*:/META-INF/core-spring.xml</param-value></p><p>    </context-param></p><p style="min-height: 8pt; height: 8pt; padding: 0px;"> </p><p>    <context-param></p><p>        <param-name>contextConfigLocation</param-name></p><p>        <param-value>classpath*:/WEB-INF/*-app-context.xml</param-value></p><p>    </context-param></p><p>  <listener></p><p>    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class></p><p>  </listener>   </p><p> ... </p><p>  <servlet></p><p>      <servlet-name>ScoreCard</servlet-name></p><p>      <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class></p><p>      <init-param></p><p>          <param-name>contextConfigLocation</param-name></p><p>          <param-value>classpath*:/WEB-INF/*-app-config.xml</param-value></p><p>      </init-param></p><p>  </servlet></p><p>  <servlet-mapping></p><p>    <servlet-name>ScoreCard</servlet-name></p><p>    <url-pattern>*.action</url-pattern></p><p>  </servlet-mapping></p><p>... </p><p></web-app></p></blockquote></div>
<div style="background-color: #f4f4f4; padding: 10px; margin-top: 20px;">
<p style="margin: 0;">Reply to this message by <a href="http://community.jboss.org/message/583390#583390">going to Community</a></p>
        <p style="margin: 0;">Start a new discussion in Snowdrop at <a href="http://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2082">Community</a></p>
</div></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>