users@glassfish.java.net

Re: Injection failure on second .war... what am I missing???

From: <glassfish_at_javadesktop.org>
Date: Fri, 16 Nov 2007 17:15:38 PST

Absolutely... I've included them at the bottom of this message. You'll notice I'm not using EJB res refs in any of them.

LogEJB is a local interface. There is also a reference in the 2nd war to a remote business interface of another ejb. Neither injections are working.

Glassfish seems to be ignoring the annotations entirely in the 2nd .war. Is there something one can accidentally do on a global level to make it so glassfish doesn't manage ContextListeners or Servlets, or not introspect them for injection???

Also, in other news, made sure that the annotated references in the second .war have the fully qualified pathname of the EJB business interfaces. Which is a deficiency in the code I already posted.

Thanks for having a look. I really appreciate the help!


Here is web.xml from the first .war
[code]
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
    <context-param>
            <description>Switch off caching. You can remove this parameter or comment it out when this app goes into production.</description>
            <param-name>jmaki-usecache</param-name>
            <param-value>false</param-value>
        </context-param>
    <context-param>
        <param-name>fileServerPath</param-name>
        <param-value>http://192.168.2.4:8080/FileServer</param-value>
    </context-param>
    <context-param>
                <param-name>StringTableLocation</param-name>
                <param-value>VCMarkWeb/control/StringTable</param-value>
            </context-param>
    <filter>
        <description>Requires a user to have an HTTP
session, otherwise user is directed
to login page.</description>
        <filter-name>LoginFilter</filter-name>
        <filter-class>VCMarkWeb.control.LoginFilter</filter-class>
        <init-param>
            <param-name>loginPage</param-name>
            <param-value>/Login</param-value>
        </init-param>
        <init-param>
            <param-name>denyToLogged</param-name>
            <param-value>/Login.jsp</param-value>
        </init-param>
        <init-param>
            <param-name>logoutFirstPage</param-name>
            <param-value>/LogoutFirst.jsp</param-value>
        </init-param>
        </filter>
    <filter>
        <description>Used with pages that submit a multipart/
formdata form (Typically a file-uploading
form)</description>
        <filter-name>Multipart/Form Filter</filter-name>
        <filter-class>VCMarkWeb.control.MPFFilter</filter-class>
        <init-param>
            <description>Maximum size of uploaded file in
KB</description>
            <param-name>maxFileSize</param-name>
            <param-value>1024</param-value>
        </init-param>
        </filter>
<!-- More filters... -->
    <filter-mapping>
        <filter-name>LoginFilter</filter-name>
        <url-pattern>/Welcome.jsp</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>FORWARD</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
        <dispatcher>ERROR</dispatcher>
        </filter-mapping>
    <filter-mapping>
        <filter-name>LoginFilter</filter-name>
        <url-pattern>/Login.jsp</url-pattern>
        <dispatcher>REQUEST</dispatcher>
        <dispatcher>INCLUDE</dispatcher>
        <dispatcher>ERROR</dispatcher>
    </filter-mapping>
<!-- Tons of filter mappings... -->
    <listener>
        <description>ServletContextListener</description>
        <listener-class>VCMarkWeb.Startup</listener-class>
    </listener>
    <listener>
        <description>ServletContextListener</description>
        <listener-class>VCMarkWeb.Shutdown</listener-class>
    </listener>
    <servlet>
        <description>Sickbad ajax voodoo</description>
        <servlet-name>ArcLite</servlet-name>
        <servlet-class>arclite.ArcLite</servlet-class>
        <init-param>
            <description>Directory holding arclite files</description>
            <param-name>filePath</param-name>
            <param-value>\somepath\arclite</param-value>
        </init-param>
        <init-param>
            <description>Fully qualified www url pointing to remote-accessible arclite resources</description>
            <param-name>resourcePath</param-name>
            <param-value>http://192.168.2.4:8080/resources/arclite</param-value>
        </init-param>
        <init-param>
            <description>Path pointing to the URL root of the
website installation.</description>
            <param-name>serverPath</param-name>
            <param-value>http://192.168.2.4:8080/</param-value>
        </init-param>
        <init-param>
            <param-name>cacheComponents</param-name>
            <param-value>true</param-value>
        </init-param>
        <load-on-startup>1</load-on-startup>
        </servlet>
    <servlet>
        <description>Requests login information from user</description>
        <servlet-name>Login.jsp</servlet-name>
        <jsp-file>/dynamic/Login.jsp</jsp-file>
        </servlet>
    <servlet>
        <description>Database-&gt;FileSystem conversion engine</description>
        <servlet-name>FileServer</servlet-name>
        <servlet-class>VCMarkWeb.control.FileServer</servlet-class>
        <init-param>
            <param-name>fileServerRoot</param-name>
            <param-value>FileServer/</param-value>
        </init-param>
        </servlet>
    <servlet>
        <servlet-name>Welcome.jsp</servlet-name>
        <jsp-file>/dynamic/Welcome.jsp</jsp-file>
        </servlet>
<!--A bunch more servlets & init params -->
    <servlet-mapping>
        <servlet-name>ArcLite</servlet-name>
        <url-pattern>/ArcLite</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Login.jsp</servlet-name>
        <url-pattern>/Login.jsp</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>FileServer</servlet-name>
        <url-pattern>/FileServer/*</url-pattern>
    </servlet-mapping>
    <servlet-mapping>
        <servlet-name>Welcome.jsp</servlet-name>
        <url-pattern>/Welcome.jsp</url-pattern>
    </servlet-mapping>
<!-- more mappings for all of the servlets...-->
    <session-config>
        <session-timeout>30</session-timeout>
    </session-config>
    <welcome-file-list>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>index.html</welcome-file>
        </welcome-file-list>
    <security-constraint>
        <display-name>No Direct Access</display-name>
        <web-resource-collection>
            <web-resource-name>Login</web-resource-name>
            <description/>
            <url-pattern>/Login</url-pattern>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            <http-method>HEAD</http-method>
            <http-method>PUT</http-method>
            <http-method>OPTIONS</http-method>
            <http-method>TRACE</http-method>
            <http-method>DELETE</http-method>
        </web-resource-collection>
<!-- more resource collections... -->
        <auth-constraint>
            <description/>
            <role-name>No Direct Access</role-name>
            </auth-constraint>
        </security-constraint>
    <security-constraint>
        <display-name>GuestConstraint</display-name>
        <web-resource-collection>
            <web-resource-name>Guest</web-resource-name>
            <description/>
            <url-pattern>/*</url-pattern>
            <http-method>GET</http-method>
            <http-method>POST</http-method>
            <http-method>HEAD</http-method>
            <http-method>PUT</http-method>
            <http-method>OPTIONS</http-method>
            <http-method>TRACE</http-method>
            <http-method>DELETE</http-method>
        </web-resource-collection>
        <auth-constraint>
            <description/>
            <role-name>Guest</role-name>
            </auth-constraint>
        </security-constraint>
    <login-config>
        <auth-method>BASIC</auth-method>
        <realm-name>file</realm-name>
        </login-config>
    <security-role>
        <description>This role should not be assigned, and is used to prevent direct
access to server resources.</description>
        <role-name>No Direct Access</role-name>
    </security-role>
        
    <security-role>
        <description/>
        <role-name>Guest</role-name>
    </security-role>
    <env-entry>
        <env-entry-name>SystemID</env-entry-name>
        <env-entry-type>java.lang.String</env-entry-type>
        <env-entry-value>Alpha</env-entry-value>
    </env-entry>
    </web-app>
[/code]


Here is the web.xml from the new .war

[code]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
    <display-name>JForum - Powering Communities</display-name>
    <description>Open Source Java Forum Software</description>
    
    <!-- Clickstream -->
    <filter>
        <filter-name>clickstream-jforum</filter-name>
        <filter-class>net.jforum.util.legacy.clickstream.ClickstreamFilter</filter-class>
    </filter>
    
    <filter-mapping>
        <filter-name>clickstream-jforum</filter-name>
        <url-pattern>*.page</url-pattern>
    </filter-mapping>
    
    <!-- JForum Controller -->
    <listener>
        <listener-class>net.jforum.ForumSessionListener</listener-class>
    </listener>
    <listener>
        <listener-class>VCMarkWeb.sso.JForumInit</listener-class>
    </listener>
    <servlet>
        <servlet-name>jforum</servlet-name>
        <servlet-class>net.jforum.JForum</servlet-class>
        
        <init-param>
            <param-name>development</param-name>
            <param-value>true</param-value>
        </init-param>
    </servlet>
    
    <!-- Installer -->
    <servlet>
        <servlet-name>install</servlet-name>
        <servlet-class>net.jforum.InstallServlet</servlet-class>
        
        <init-param>
            <param-name>development</param-name>
            <param-value>true</param-value>
        </init-param>
    </servlet>
    
    <!-- Mapping -->
    <servlet-mapping>
        <servlet-name>install</servlet-name>
        <url-pattern>/install/install.page</url-pattern>
    </servlet-mapping>
    
    <servlet-mapping>
        <servlet-name>jforum</servlet-name>
        <url-pattern>*.page</url-pattern>
    </servlet-mapping>
    
    <!-- SESSION -->
    <session-config>
        <session-timeout>10</session-timeout>
    </session-config>
                
    <env-entry>
        <env-entry-name>SystemID</env-entry-name>
        <env-entry-value>Alpha.jForum</env-entry-value>
        <env-entry-type>java.lang.String</env-entry-type>
    </env-entry>
</web-app>
[/code]

Also sun-web.xml from the working .war
[code]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app error-url="">
  <context-root>/_</context-root>
  <security-role-mapping>
    <role-name>Guest</role-name>
    <principal-name>VCMarkGuest</principal-name>
    <principal-name>Admin</principal-name>
  </security-role-mapping>
  <class-loader delegate="true"/>
  <jsp-config>
    <property name="classdebuginfo" value="true">
      <description>Enable debug info compilation in the generated servlet class</description>
    </property>
    <property name="mappedfile" value="true">
      <description>Maintain a one-to-one correspondence between static content and the generated servlet class' java code</description>
    </property>
  </jsp-config>
</sun-web-app>
[/code]

and from the non-working .war

[code]
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE sun-web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Application Server 9.0 Servlet 2.5//EN" "http://www.sun.com/software/appserver/dtds/sun-web-app_2_5-0.dtd">
<sun-web-app error-url="">
  <context-root>/jforum</context-root>
  <class-loader delegate="true"/>
  <jsp-config>
    <property name="classdebuginfo" value="true">
      <description>Enable debug info compilation in the generated servlet class</description>
    </property>
    <property name="mappedfile" value="true">
      <description>Maintain a one-to-one correspondence between static content and the generated servlet class' java code</description>
    </property>
  </jsp-config>
</sun-web-app>
[/code]
[Message sent by forum member 'dcaudell' (dcaudell)]

http://forums.java.net/jive/thread.jspa?messageID=245892