1

I am using Maven to filter (among other things) my web.xml as follows:

In web.xml:

> <filter-mapping>
>     <filter-name>CAS Authentication Filter</filter-name>
>     <url-pattern>
>         ${cas.filter.pattern}
>     </url-pattern>   </filter-mapping>

in pom.xml:

<profile>
    <id>test</id>
    <properties>
        <cas.filter.pattern>/blank/*</cas.filter.pattern>
    </properties>
</profile>

....

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.4</version>
    <configuration>
        <configuration>
                              <filteringDeploymentDescriptors>true</filteringDeploymentDescriptors>
        </configuration>
                <webResources>
                    <resource>
                        <filtering>true</filtering>
                        <directory>src/main/webapp</directory>
                        <includes>
                            <include>**/META-INF/context.xml</include>
                        </includes>
                    </resource>
                    <resource>
                        <filtering>true</filtering>
                        <directory>src/main/resources</directory>
                        <includes>
                            <include>web.xml</include>
                        </includes>
                    </resource>
                </webResources>
                <webXml>src/main/resources/web.xml</webXml>
            </configuration>
        </plugin>

When I build using command-line and deploy to standalone Tomcat version 7.0.0.28, it deploys fine and works.

However, when I deploy within Eclipse, I get a NamingException:

WARNING: Failed to retrieve JNDI naming context for container



[StandardEngine[Catalina].StandardHost[localhost].StandardContext[/XXXX]] so no cleanup was performed for that container
javax.naming.NamingException: No naming context bound to this class loader
    at org.apache.naming.ContextBindings.getClassLoader(ContextBindings.java:352)
    at org.apache.catalina.deploy.NamingResources.cleanUp(NamingResources.java:987)
    at org.apache.catalina.deploy.NamingResources.stopInternal(NamingResources.java:970)

I'm not sure how to fix this issue. I really need to be able to bypass certain filters when building/deploying certain profiles (ie, development) - and to turn them on when building/deploying for other environments. I have filtered properties in many other files that have been working successfully.

As a test, I hard-coded the url-pattern to be that defined in the filter properties list, and that works fine in Eclipse/Tomcat. However, if I leave it with the property name (as shown above), it fails.

Any ideas?

Nena
  • 681
  • 1
  • 10
  • 27
  • In case anyone has the same issue, there is a workaround available here: http://jira.codehaus.org/browse/MNGECLIPSE-602 which I am about to test right now – Nena Feb 18 '15 at 19:51
  • The above solution works but only partially. After putting the following line in my .component file, now I have an issue where my tomcat cannot locate the bean.xml or the faces-config.xml file. -- i've tried setting the locations for these files manually but it is not being picked up.... help anyone? – Nena Feb 18 '15 at 22:23

0 Answers0