Bram Smeets Blog

 

Blog on Spring and DWR. AJAX with Spring made easy!

SpringOne - DWR & Spring presentation

Filed under: Ajax, Java, Spring — Bram Smeets at 2:44 pm on Monday, June 19, 2006

Last week I attended/spoke at SpringOne.

I think it was a well-organized, very interesting conference and I met a lot of interesting people.
Hopefully SpringOne will turn out to be an annual event for those of us interested in using Spring.

Attached to this post you can find the presentation I did on using DWR in conjunction with Spring.

SpringOne - DWR & Spring presentation

I have also added the sample application I used for my demo. Please note that it is just a sample application and it uses Spring-2.0-M3 and the version of DWR is one that is taken from the HEAD of the CVS. You can download the sample application using the link below.

SpringOne - Sample application

19 Comments »

Comment by Jani Kaarnalehto

June 20, 2006 @ 11:06 am

Hey Bram,

I agree that SpringOne was a well-organized, very interesting conference.

Thanks for your presentation and talks afterwards.

-Jani, One of the Finns

Comment by Mert Caliskan

June 21, 2006 @ 8:33 pm

thanx for uploading content..actually i missed your presentation..arrived at 12.30 pm locale..couldn’t get a visa right on time from belgium embassy..(maybe they are against java :) )…cheers..

Comment by Nicolas Peeters

July 4, 2006 @ 11:34 am

Hi Bram,

I’m very enthusiastic to give this application a try. Is the application you posted deployable as-is (as a war)? Or shall I import it first in a IDE? What do you recommend?

Thanks a lot!

Nicolas

Comment by Bram Smeets

July 4, 2006 @ 1:07 pm

You should import it into your IDE or create a build script to build it, I don’t think I added one.
It should be fairly trivial to run it from your IDE.

Greetings,
Bram

Comment by Steffen Fritzsche

July 5, 2006 @ 10:55 am

Hi Bram,

i’ve tried to do an own example app based on your slides and your posted code. I always get an exception while loading, because the xml schema file is not available under http://www.directwebremoting.org/schema/spring/spring-dwr.xsd

Is this the correct url? This is also the first time i use the spring xml syntax. I recognized that in the spring jar the xsd’s are deployed. Can I do this with the spring-dwr too?

Greetings,
Steffen

Comment by Bram Smeets

July 5, 2006 @ 11:04 am

That’s true, but it will be as soon as we get the next milestone out.

However, there are two things to consider:

1) Spring needs to be able to resolve your schema, this is done by Spring and the XML parser and should be handled by the DWR jar file. The JAR file should contain a META-INF folder containing the Spring namespace definitions. The reaso why the schema is retrieved from the JAR and not from a website, is that an application should also run when no connectivity is available.

2) Your IDE needs to know about the schema in order to do autocompletion. While the schema is not yet online, you can best retrieve the schema from the JAR file and put it on your file system somewhere. And then link you IDE to that file.

Hope this will help,
Bram

Comment by Steffen Fritzsche

July 5, 2006 @ 3:13 pm

Thanks a lot. I used the M2.6 jar from http://dwr.dev.java.net and the deploy worked. But now i added a dwr:remote declaration and the spring context breaks again with the following error.


14:55:57,673 ERROR [ContextLoader] Context initialization failed
java.lang.AbstractMethodError: org.directwebremoting.spring.DwrNamespaceHandler$RemoteBeanDefinitionDecorator.decorate(Lorg/w3c/dom/Node;Lorg/springfr
amework/beans/factory/config/BeanDefinitionHolder;Lorg/springframework/beans/factory/xml/ParserContext;)Lorg/springframework/beans/factory/config/Bean
DefinitionHolder;
at org.springframework.beans.factory.xml.NamespaceHandlerSupport.decorate(NamespaceHandlerSupport.java:70)

Any ideas?

Greetings,
Steffen

Comment by Bram Smeets

July 5, 2006 @ 4:15 pm

This is probably due to the fact that you are using a previous Spring version. You should use the 2.0-M5 version (which is in the download).
Between version 2.0-M4 and M5 we changed the implementation of the decorator interface.

Bram

Comment by Steffen Fritzsche

July 5, 2006 @ 4:43 pm

There must be another reason. I used the spring rc1. But even with the M5 I have the same error.

Steffen

Comment by Nicolas Peeters

July 5, 2006 @ 5:09 pm

Actually, I have been struggling with this as well (same XSD problem as Steffen).

I’ve almost migrated it to Maven 2, but it gave me issues. Especially since the Maven 2 pom are not yet uploaded in ibiblio.

If anyone manages to get a war (or an ant script), I’m quite interested to get it.

Cheers

Comment by Jettro Coenradie

August 2, 2006 @ 11:24 pm

Hai Bram,
I created an easy sample with maven/dwr/script.aculo.us. For this sample I used the autocomplete.js from your javaone sample. Is it oke if I post the sample code including your code on my website? www.gridshore.nl

Thanks for your code, it works like a charm.
Jettro

Comment by Bram Smeets

August 14, 2006 @ 11:12 am

Sure, go ahead.

Thanks for your kind words.

Comment by Ranil

October 2, 2006 @ 3:37 pm

hi

can anyone tell me how to define spring application context in dwr.xml

Comment by Marcello Leonardi

October 16, 2006 @ 5:10 pm

Hi

In the sample Application which shows the integration between Spring and DWR in the META-INF directory the files named “spring.schemas” and “spring.schemas” are placed to define the namespace and the namespace handler.
When I get the newest dwr.jar from then the two files are not there.

I have the problem that the spring container could not work with the DWR namespace. Has someone else the same problem. Or is the meaning that I have finialize the dwr.jar for spring myself?

Thank you for any input.

regards

ML

Comment by Marcello Leonardi

October 16, 2006 @ 5:14 pm

I intend
files named “spring.schemas” and “spring.handlers”

Comment by Alex Narinsky

November 23, 2006 @ 2:47 am

Hello,

I used both the newest Eclipse and NetBeans but I cannot run the example. Eclipse does not give any messages. NetBeans (and built war file on tomcat 5.5.17) give the following errors:

Nov 22, 2006 4:13:12 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(C:\apache-tomcat-5.5.17\webapps\springone\WEB-INF\lib\j2ee-interfaces-1.3.1.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Nov 22, 2006 4:13:14 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Nov 22, 2006 4:13:14 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/springone] startup failed due to previous errors

If I remove j2ee- interfaces-1.3.1.jar then the INFO disappears but I still see the Error in listenerStart

Comment by Alex Narinsky

November 23, 2006 @ 3:01 am

In addition one can get the created war at
http://www.jboston.net/dwr/springone.war
Thank you
Alex

Comment by Massimo

January 19, 2007 @ 1:42 pm

12:41:43,859 ERROR [ContextLoader] Context initialization failed
org.springframework.beans.factory.BeanDefinitionStoreException: Line 9 in XML do
cument from ServletContext resource [/WEB-INF/context/ajax-layer.xml] is invalid
; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The
matching wildcard is strict, but no declaration can be found for element ‘dwr:c
onfiguration’.
Caused by:
org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is
strict, but no declaration can be found for element ‘dwr:configuration’.

Comment by jaratus

October 15, 2007 @ 4:44 am

That’s good.
Thanks for u r example source.

RSS feed for comments on this post. TrackBack URI

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>