Skip navigation
Currently Being Moderated

Custom authentication with BlazeDS on Tomcat

Nov 4, 2010 4:45 AM

Hello!

 

I did the following:

 

You need to perform the following configuration steps to use custom authentication with
BlazeDS on Tomcat:

 

1. Put flex-tomcat-common.jar in tomcat/lib/blazeds.
2. Place flex-tomcat-server.jar in tomcat/lib/blazeds.
3. Edit the catalina.properties file which can be found in the tomcat/conf directory. Find the common.loader property and add the following path to the end of the list: ${catalina.home}/lib/blazeds/*.jar
4. Add <Valve className="flex.messaging.security.TomcatValve"/> tag to the Context Descriptors.
5. Restart Tomcat.

 

You will now be authenticated against the current Tomcat realm. Usually, for this authentication the user information is in conf/tomcat-users.xml. See the Tomcat documentation for more information on realms. See the Flex documentation for more information on BlazeDS custom authentication.

 

---

 

When I started Tomcat 7 from Eclipse I got the stacktrace below.

 

Seems to be a version clash.

Any tips?

 

Regards,

Stefan

 

---

 

java.lang.VerifyError: class flex.messaging.security.TomcatValve overrides final method start.()V
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14 1)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRu le.java:140)
    at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1 282)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startEle ment(AbstractSAXParser.java:501)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser. emptyElement(AbstractXMLDocumentParser.java:179)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp l.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp l$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(X MLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp l.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X ML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X ML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser. java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Ab stractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.p arse(SAXParserImpl.java:522)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1543)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:529)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:567)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:262)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:417)
java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl. java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces sorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:262)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:417)
Caused by: java.lang.VerifyError: class flex.messaging.security.TomcatValve overrides final method start.()V
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:632)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:616)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:14 1)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:248)
    at org.apache.tomcat.util.digester.ObjectCreateRule.begin(ObjectCreateRu le.java:140)
    at org.apache.tomcat.util.digester.Digester.startElement(Digester.java:1 282)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startEle ment(AbstractSAXParser.java:501)
    at com.sun.org.apache.xerces.internal.parsers.AbstractXMLDocumentParser. emptyElement(AbstractXMLDocumentParser.java:179)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp l.scanStartElement(XMLDocumentFragmentScannerImpl.java:1343)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp l$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:2755)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(X MLDocumentScannerImpl.java:648)
    at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImp l.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X ML11Configuration.java:808)
    at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(X ML11Configuration.java:737)
    at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser. java:119)
    at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Ab stractSAXParser.java:1205)
    at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.p arse(SAXParserImpl.java:522)
    at org.apache.tomcat.util.digester.Digester.parse(Digester.java:1543)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:529)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:567)
    ... 6 more

 
Replies
  • Currently Being Moderated
    Jan 5, 2011 9:07 PM   in reply to yankee2003

    After recently coming across this exact same error following the Tomcat setup steps described on the site at the following link:

     

    http://livedocs.adobe.com/blazeds/1/blazeds_devguide/help.html?content =services_security_5.html

     

    I have yet to make it past this error.  Any luck on your end or input from anyone at Adobe?

     

    Thanks,

    Wembley76

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 23, 2011 5:28 AM   in reply to Wembley76-Mbzl9l

    Hello,

     

    Just came accross the same error! Migrated from BlazeDS 3 to BlazeDS 4, after reading this post http://forums.adobe.com/thread/777748 but that does not fix the problem.

    Apparently Tomcat 7 deals with Valves differently. I'm going to dig on that side ...

     

    If anybody has an update on this, I'm interested !!!

     

    Thanks,

    Olivier

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 23, 2011 6:00 AM   in reply to ogerou_screenname

    Yes, there are issues for supporting Tomcat 7 because of security framework and API change.

    We have fixed it but the release is not out yet.

    You can search the BlazeDS bug database to find out the issue.

    "Tomcat 7, Login"

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 6, 2011 6:18 AM   in reply to yankee2003

    I'm actually having an issue with Tomcat 6 and authentication.  I cannot start the server because it doesnt find the class TomcatValve (java.lang.ClassNotFoundException). on Windows, Eclipse Ganymede

     

    I dont know where to look anymore, my config is the following:

    catalina.properties

    common.loader=${catalina.base}/lib,${catalina.base}/lib/*.jar,${catali na.home}/lib,${catalina.home}/lib/*.jar,${catalina.home}/lib/blazeds/* .jar

     

    server.xml

    <Context docBase="Project" path="/Project" reloadable="true" source="org.eclipse.jst.j2ee.server: Project ">
    <Valve className="flex.messaging.security.TomcatValve"/>
    </Context>
    The jar files( flex-tomcat-common.jar, flex-tomcat-server.jar  ) are in Project\WebContent\WEB-INF\lib\blazeds

     

    I tried cleaning, restarting publishing etc. but the tomcat doesnt seem to recognize the files.

     

    Does anybody has an idea what i didnt see?

    Thanks in advance!

    Matt

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 6, 2011 7:19 AM   in reply to FlexMatt

    you need to find tomcat related security jar files under blazds/resource/security and put into the Tomcat server classpath

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 6, 2011 8:02 AM   in reply to Don Hu

    thanks for the hint, though, which are these relevant files? flex-tomcat-common.jar, flex-tomcat-server.jar ? Or more are more jars neccessary for authentication? these two are in the classpath (web-inf/lib) folder.

     

    Which folder do you mean by  blazds/resource/security? In the BlazeDS 4.0.0.14931 turnkey archive there are jars in resources/security/tomcat

      flex-tomcat-common.jar, flex-tomcat-server.jar, flex-tomcat-server-4150.jar . I copied those into my web.inf/lib folder, but still same error.

     

    Thanks,

    Matt

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 6, 2011 8:28 AM   in reply to FlexMatt

    put them into server classpath, not in the web app lib.

     
    |
    Mark as:
  • Currently Being Moderated
    Jun 7, 2011 1:45 AM   in reply to Don Hu

    after some copying and re-registering a new server config in Eclipse it finally worked. I copied the files into the $catalina_home/lib folder. I actually thought, it should work, when I copy these files into the respective wepapp. Well, I'll give it another try later on maybe

     

    Thanks again for the help, and sorry for interrupting the discussion about the Tomcat 7 issue!

     

    Matt

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 19, 2012 12:45 AM   in reply to yankee2003

    Hello.

     

    You're using wrong version of Tomcat Valve for Tomcat7.

    You need Tomcat7Valve from flex-tomcat-server-708.jar

     

    If you're building BlazeDS from trunk then check also ant build scripts in opt. There is condition based on environment variable:

    <target name="build.for.tomcat7" if="env.JAVA16_HOME">

     

    If you want to build it with Java7 then remove that condition.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 23, 2013 12:33 AM   in reply to Juraj Michálek

    Hi Juraj,

     

    Thank you for the valuable input.

    Could you please let me know from where to download flex-tomcat-server-708.jar ? I did search in google but failed to locate it.

    Also are there any maven repository for BlazeDS?

     

    Appreciate your response.

     

    Note: I am trying to use flex 4.0,BlazeDS 3.0 with tomcat 7.0.23.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points