View Full Version : Problem in deploying Contacts in BEA WLS 8.1
Savrak
Dec 3rd, 2004, 08:37 AM
Hi,
First of all, thank you for theses great pieces of work, I mean: Spring and Acegi Security. I have been trying and promoting the use of Spring and Acegi Security for new J2EE developments in my company.
I have played around with Acegi Contacts app on Tomcat ( 5.0.28 ), changing authentication provider, etc: it works fine.
On BEA WebLogic 8.1, I so far have not succeeded in deploying the original Contacts app. I have come accross several problems, including:
- I had to update to Spring 1.1.2 to avoid an exception related to htmlEscape from TransformTag in Spring Taglib.
- The beans declared in [contacts-servlet.xml] that reference 'contactManager' wouldn't be loaded correctly. The error message from the server is something like this "Can't resolve reference to bean 'contactManager' while setting property 'contactManager'".
See (1) for further details.
- As a temporary solution, I move all of the beans related to 'contactManager' from [contacts-servlet.xml] to [applicationContext.xml]. The deployment process goes one step further. However I now have "Could not load user defined filter: net.sf.acegisecurity.util.FilterToBeanProxy."
See (2) for further details.
Have I missed something?
Thank you in advance for your help.
Cheers,
-- Savrak
PS:
Code / message excerpts:
(1)
####<3 déc. 2004 14.21. h CET> <Error> <HTTP> <T008766> <serverWorkshop> <main> <<WLS Kernel>> <> <BEA-101216> <Servlet: "contacts" failed to preload on startup in Web application: "contacts".
javax.servlet.ServletException: Error creating bean with name 'publicIndexController' defined in resource [/WEB-INF/contacts-servlet.xml] of ServletContext: Can't resolve reference to bean 'contactManager' while setting property 'contactManager'; nested exception is org.springframework.beans.factory.NoSuchBeanDefini tionException: No bean named 'contactManager' is defined: org.springframework.beans.factory.support.DefaultL istableBeanFactory defining beans [publicIndexController,secureIndexController,secur eDeleteController,urlMapping,addValidator,secureAd dForm,viewResolver]; Root of BeanFactory hierarchy
at weblogic.servlet.internal.ServletStubImpl.createSe rvlet(ServletStubImpl.java:884)
at weblogic.servlet.internal.ServletStubImpl.createIn stances(ServletStubImpl.java:848)
...
(2)
####<3 déc. 2004 14.50. h CET> <Error> <HTTP> <T008766> <serverWorkshop> <main> <<WLS Kernel>> <> <BEA-101165> <Could not load user defined filter: net.sf.acegisecurity.util.FilterToBeanProxy.
java.lang.IllegalStateException: No WebApplicationContext found: no ContextLoaderListener registered?
at org.springframework.web.context.support.WebApplica tionContextUtils.getRequiredWebApplicationContext( WebApplicationContextUtils.java:83)
at net.sf.acegisecurity.util.FilterToBeanProxy.getCon text(FilterToBeanProxy.java:158)
at net.sf.acegisecurity.util.FilterToBeanProxy.init(F ilterToBeanProxy.java:98)
at weblogic.servlet.internal.WebAppServletContext$Fil terInitAction.run(WebAppServletContext.java:6379)
at weblogic.security.acl.internal.AuthenticatedSubjec t.doAs(AuthenticatedSubject.java:317)
Ben Alex
Dec 3rd, 2004, 02:57 PM
Could you post your web.xml? Also, Contacts has been significantly refactored in the last month, so you might like to try it from CVS.
Savrak
Dec 6th, 2004, 02:34 AM
Here is the [web.xml] (I have removed the caucho servlet).
In the mean time, I'll give a try to Contacts from CVS.
-- Savrak
[web.xml]
<?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'>
<!--
- Contacts web application
- $Id: web.xml,v 1.9 2004/08/03 07:18:33 benalex Exp $
- File will be copied into WAR's WEB-INF directory if NOT using container adapter
-->
<web-app>
<display-name>Contacts Sample Application</display-name>
<description>
Example of an application secured using Acegi Security System for Spring.
</description>
<!--
- Location of the XML file that defines the root application context
- Applied by ContextLoaderListener.
-->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<filter>
<filter-name>Acegi Channel Processing Filter</filter-name>
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>net.sf.acegisecurity.securechannel.ChannelProcessi ngFilter</param-value>
</init-param>
</filter>
<filter>
<filter-name>Acegi Authentication Processing Filter</filter-name>
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>net.sf.acegisecurity.ui.webapp.AuthenticationProce ssingFilter</param-value>
</init-param>
</filter>
<filter>
<filter-name>Acegi HTTP BASIC Authorization Filter</filter-name>
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>net.sf.acegisecurity.ui.basicauth.BasicProcessingF ilter</param-value>
</init-param>
</filter>
<filter>
<filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>net.sf.acegisecurity.ui.AutoIntegrationFilter</param-value>
</init-param>
</filter>
<filter>
<filter-name>Acegi HTTP Request Security Filter</filter-name>
<filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
<init-param>
<param-name>targetClass</param-name>
<param-value>net.sf.acegisecurity.intercept.web.SecurityEnforce mentFilter</param-value>
</init-param>
</filter>
<!-- Remove the comments from the following <filter-mapping> if you'd
like to ensure secure URLs are only available over HTTPS -->
<!--
<filter-mapping>
<filter-name>Acegi Channel Processing Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
-->
<filter-mapping>
<filter-name>Acegi Authentication Processing Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Acegi HTTP BASIC Authorization Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<filter-mapping>
<filter-name>Acegi HTTP Request Security Filter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!--
- Loads the root application context of this web app at startup,
- by default from "/WEB-INF/applicationContext.xml".
- Use WebApplicationContextUtils.getWebApplicationContex t(servletContext)
- to access it anywhere in the web application, outside of the framework.
-->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListe ner</listener-class>
</listener>
<!--
- Servlet that dispatches request to registered handlers (Controller implementations).
- Has its own application context, by default defined in "{servlet-name}-servlet.xml",
- i.e. "contacts-servlet.xml".
-
- A web app can contain any number of such servlets.
- Note that this web app does not have a shared root application context,
- therefore the DispatcherServlet contexts do not have a common parent.
-->
<servlet>
<servlet-name>contacts</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<!--
- Maps the contacts dispatcher to /*.
-
-->
<servlet-mapping>
<servlet-name>contacts</servlet-name>
<url-pattern>*.htm</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<taglib>
<taglib-uri>/spring</taglib-uri>
<taglib-location>/WEB-INF/spring.tld</taglib-location>
</taglib>
</web-app>
Ben Alex
Dec 6th, 2004, 04:23 PM
A strange issue. Do you have any Spring or Acegi Security JARs in a different server classloader? Also try out the CVS version, as it should work and I'd prefer to debug the newer release if possible.
Savrak
Dec 7th, 2004, 04:19 AM
- I checked the CLASSPATH, but it seems to be OK. I include the output from BEA (1) at the end of this message.
- I tried to connect yesterday and today to the CVS using one of these commands:
D:\bin\TortoiseCVS>cvs -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/acegisecurity login
D:\bin\TortoiseCVS>cvs -d:pserver:anonymous@cvs-pserver.sourceforge.net:80/cvsroot/acegisecurity login
D:\bin\TortoiseCVS>cvs -d:pserver:anonymous@cvs-pserver.sourceforge.net:443/cvsroot/acegisecurity login
All of them failed.
Would it be possible you put the latest version of Acegi in a ZIP for download on the web site?
Thanks.
-- Savrak
PS: (1)
Using java memory arguments: -Xms256m -Xmx256m -XX:CompileThreshold=8000 -XX:Per
mSize=32m -XX:MaxPermSize=128m
WLS Production Mode=
=== Debugging ===
This window is necessary for debugging code using WebLogic Workshop
.
.
CLASSPATH=D:\bin\bea\WEBLOG~1\server\lib\weblogic_ knex_patch.jar;D:\bin\bea\WEBL
OG~1\common\lib\log4j.jar;D:\bin\bea\WEBLOG~1\serv er\lib\debugging.jar;D:\bin\be
a\WEBLOG~1\server\lib\knex.jar;D:\bin\bea\WEBLOG~1 \javelin\lib\javelin.jar;D:\bi
n\bea\WEBLOG~1\server\lib\wlw-lang.jar;D:\bin\bea\JDK141~1\lib\tools.jar;D:\bin\
bea\WEBLOG~1\server\lib\weblogic_sp.jar;D:\bin\bea \WEBLOG~1\server\lib\weblogic.
jar;D:\bin\bea\WEBLOG~1\server\lib\ojdbc14.jar;D:\ bin\bea\WEBLOG~1\server\lib\an
t\ant.jar;D:\bin\bea\JDK141~1\jre\lib\rt.jar;;D:\b in\bea\WEBLOG~1\common\eval\po
intbase\lib\pbserver44.jar;D:\bin\bea\WEBLOG~1\com mon\eval\pointbase\lib\pbclien
t44.jar;D:\bin\bea\WEBLOG~1\server\lib\webservicec lient.jar;D:\bin\bea\WEBLOG~1\
server\lib\webserviceclient+ssl.jar;D:\bin\bea\WEB LOG~1\server\lib\xbean.jar;D:\
bin\bea\WEBLOG~1\server\lib\wlxbean.jar;D:\bin\bea \WEBLOG~1\server\lib\xqrl.jar;
D:\bin\bea\WEBLOG~1\server\lib\netui\netui-compiler.jar;D:\bin\bea\WEBLOG~1\serv
er\lib\wli.jar;D:\bin\bea\WEBLOG~1\server\lib\fop. jar;D:\bin\bea\WEBLOG~1\integr
ation\adapters\sample\lib\sample-eis.jar;
.
PATH=D:\bin\bea\WEBLOG~1\server\bin;D:\bin\bea\WEB LOG~1\server\bin;D:\bin\bea\JD
K141~1\jre\bin;D:\bin\bea\JDK141~1\bin;D:\bin\j2sd k1.4.2_05\bin;C:\WINDOWS\syste
m32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\ATI Technologies\ATI
Control Panel;C:\Program Files\Attachmate\E!E2K\;H:\Notes\Data;C:\Program Files\Fi
chiers communs\Roxio Shared\DLLShared;D:\bin\bea\WEBLOG~1\server\bin\oc i920_8
.
************************************************** *
* To start WebLogic Server, use a username and *
* password assigned to an admin-level user. For *
* server administration, use the WebLogic Server *
* console at http:\\hostname:port\console *
************************************************** *
starting weblogic with Java version:
java version "1.4.1_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_05-b01)
Java HotSpot(TM) Client VM (build 1.4.1_05-b01, mixed mode)
Starting WLS with line:
D:\bin\bea\JDK141~1\bin\java -client -Xdebug -Xnoagent -Xrunjdwp:transport=dt_so
cket,address=8453,server=y,suspend=n -Djava.compiler=NONE -Xms256m -Xmx256m -XX
:CompileThreshold=8000 -XX:PermSize=32m -XX:MaxPermSize=128m -Xverify:none -ea
-da:com.bea... -da:javelin... -da:weblogic... -Dplatform.home=D:\bin\bea\WEBLOG
~1 -Dwls.home=D:\bin\bea\WEBLOG~1\server -Dwli.home=D:\bin\bea\WEBLOG~1\integrat
ion -Dlog4j.configuration=file:D:\bin\bea\WEBLOG~1\comm on\lib\workshopLogCfg.xm
l -Dweblogic.management.discover=true -Dweblogic.security.SSL.ignoreHostnameVer
ify=false -Dwlw.iterativeDev=true -Dwlw.testConsole=true -Dwlw.logErrorsToConsol
e=true -Dweblogic.Name=serverWorkshop -Dweblogic.ProductionModeEnabled= -Djava.s
ecurity.policy=D:\bin\bea\WEBLOG~1\server\lib\webl ogic.policy weblogic.Server
<7 dÚc. 2004 09.23. h CET> <Info> <WebLogicServer> <BEA-000377> <Starting WebLog
ic Server with Java HotSpot(TM) Client VM Version 1.4.1_05-b01 from Sun Microsys
tems Inc.>
<7 dÚc. 2004 09.23. h CET> <Info> <Configuration Management> <BEA-150016> <This
server is being started as the administration server.>
...
Ben Alex
Dec 7th, 2004, 06:43 PM
Did any of those classpath locations contain a spring*.jar or acegi*.jar? That might explain the error a little more.
Re SourceForge, their CVS servers are widely known to have problems. They're doing an upgrade at present. There is no ZIP download available, only the full CVS tarball which isn't useful directly.
I plan on releasing 0.7.0 very soon, so if you can wait for that, it might be easiest.
The root cause of your problem is not an Acegi Security error. The exception is coming from FilterToBeanProxy which simply uses WebApplicationContextUtils.getRequiredWebApplicati onContext(). The WebApplicationContextUtils needs to find the application context, which it usually can because of your <listener> registration in web.xml.
Perhaps try using ContextLoaderServlet (see Spring documentation) instead of ContextLoaderListener. Also see http://forum.springframework.org/showthread.php?t=11034&highlight=contextloaderservlet and http://forum.springframework.org/showthread.php?t=11032&highlight=contextloaderservlet and http://forum.springframework.org/showthread.php?t=10933&highlight=contextloaderservlet.
Savrak
Dec 9th, 2004, 11:54 AM
I have contacted BEA support and I have some good news:
- Contacts 0.6.1 indeed does not work with BEA WebLogic 8.1 SP2
- but does work (as is) with BEA WebLogic 8.1 SP3
.... gees...
It seems WebLogic 8.1 SP2 does not handle correctly the use of both Filters and Spring's Listener (or ContextLoaderServlet which I also tested).
Thanks for your help and sorry for the inconvenience.
Eager to try out Acegi 0.7 + LDAP stuff.
Ben Alex
Dec 9th, 2004, 01:51 PM
Excellent! Thanks for letting us know it is a known issue what that particular version. Hope you find the project suits your needs now you can run it.
twoencore
Dec 6th, 2005, 09:40 PM
what did you have to do to get it working in WebLogic 8.1 SP2????
i can't upgrade to SP3 right now..
thanks
Ben Alex
Dec 7th, 2005, 12:09 PM
With SP2, you must use ContextLoaderServlet.
Powered by vBulletin® Version 4.2.1 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.