[jboss-user] [JBoss/Spring Integration] - Re: Is it SpringLifecycleInterceptor or just me?

Arno Werr do-not-reply at jboss.com
Mon Jul 31 09:54:49 EDT 2006


Thank you Ales for your comments and suggestions.

I followed your advise and tried to update my JBoss 4.0.4 GA and run it with your Spring integration solution. 
Unfortunately, my experience in this endeavor is mainly negative.
Firstly, I tried to install on my existing JBoss [Zion] 4.0.4.GA (build: CVSTag=JBoss_4_0_4_GA date=200605151000) jboss-EJB-3.0_RC8-FD.
Downloaded jboss-EJB-3.0_RC8-FD.zip. Not good. The problem - according to accompanying INSTALL.html there should be client jars (fairly reasonable attitude):

  | 15. Copy jboss-ejb3-client.jar from the lib/ directory of the distribution to jboss-4.0.x/client
  | 17.  Copy hibernate-client.jar from the lib/ directory of the distribution to jboss-4.0.x/client
  | etc. 
  | 
Here's the content of the RC8-FD lib directory:

  | ./ejb3-entity-cache-service.xml
  | ./hibernate-entitymanager.jar
  | ./ejb3-interceptors-aop.xml
  | ./ejb3-persistence.jar
  | ./quartz-ra.rar
  | ./hibernate-annotations.jar
  | ./ejb3.deployer
  | ./ejb3.deployer/jboss-ejb3x.jar
  | ./ejb3.deployer/jboss-ejb3.jar
  | ./ejb3.deployer/META-INF
  | ./ejb3.deployer/META-INF/persistence.properties
  | ./ejb3.deployer/META-INF/jboss-service.xml
  | ./ejb3.deployer/jboss-annotations-ejb3.jar
  | ./quartz-all-1.5.2.jar
  | ./jboss-remoting.jar
  | ./hibernate3.jar
  | ./ejb3-clustered-sfsbcache-service.xml
  | ./jboss-aop-jdk50.deployer
  | ./jboss-aop-jdk50.deployer/trove.jar
  | ./jboss-aop-jdk50.deployer/base-aop.xml
  | ./jboss-aop-jdk50.deployer/META-INF
  | ./jboss-aop-jdk50.deployer/META-INF/jboss-service.xml
  | ./jboss-aop-jdk50.deployer/jboss-aop-jdk50.jar
  | ./jboss-aop-jdk50.deployer/jboss-aspect-library-jdk50.jar
  | 
Well, I do not see any client jar here... and without proper client jars my attempts to communicate with the server using standalone client are doomed. I need client and I need RMI.

Unable to install jboss-EJB-3.0_RC8-FD.zip (client jars problem) I decided to download the whole shebang hoping that this ejb update might be incorporated (wrong call!) with the newest version of the JBoss 4.0.4
http://umn.dl.sourceforge.net/sourceforge/jboss/jboss-4.0.4.GA-Patch1-installer.jar 

Installed ejb3 version domain all, installed your jboss-spring-jdk5.deployer and tried with my test application.
Yak! This patched server throws

  | 08:05:25,377 INFO  [[/web]] Loading Spring root WebApplicationContext
  | 08:05:25,597 INFO  [CollectionFactory] JDK 1.4+ collections available
  | 08:05:25,874 INFO  [XmlBeanDefinitionReader] Loading XML bean definitions from ServletContext resource [/WEB-INF/applicationContext.xml]
  | 08:05:26,427 INFO  [DefaultNamespaceHandlerResolver] Ignoring handler [org.springframework.jndi.config.JndiNamespaceHandler]: class not found
  | 08:05:26,492 INFO  [DefaultNamespaceHandlerResolver] Ignoring handler [org.springframework.web.servlet.config.MvcNamespaceHandler]: class not found
  | 08:05:26,623 INFO  [XmlWebApplicationContext] Bean factory for application context [Root WebApplicationContext]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [facade]; root of BeanFactory hierarchy
  | 08:05:26,727 INFO  [XmlWebApplicationContext] 1 beans defined in application context [Root WebApplicationContext]
  | 08:05:26,770 INFO  [XmlWebApplicationContext] Unable to locate MessageSource with name 'messageSource': using default [org.springframework.context.support.DelegatingMessageSource at 937e20]
  | 08:05:26,779 INFO  [XmlWebApplicationContext] Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster at e229be]
  | 08:05:26,824 INFO  [UiApplicationContextUtils] Unable to locate ThemeSource with name 'themeSource': using default [org.springframework.ui.context.support.ResourceBundleThemeSource at 10a063d]
  | 08:05:26,831 INFO  [DefaultListableBeanFactory] Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [facade]; root of BeanFactory hierarchy]
  | 08:05:27,179 ERROR [ContextLoader] Context initialization failed
  | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'facade' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: jspring not bound
  | javax.naming.NameNotFoundException: jspring not bound
  | 	at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
  | 	at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
  | 	at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
  | 	at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
  | 	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:625)
  | 	at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
  | 	at javax.naming.InitialContext.lookup(InitialContext.java:351)
  | 	at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:123)
  | 	at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:85)
  | 	at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:121)
  | 	at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:71)
  | 	at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:106)
  | 	at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:125)...
  | 
  | 08:05:27,197 ERROR [[/web]] Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
  | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'facade' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Invocation of init method failed; nested exception is javax.naming.NameNotFoundException: jspring not bound
  | javax.naming.NameNotFoundException: jspring not bound
  | 	at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
  | 	at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
  | 	at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
  | 	at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
  | 

Classic bad behavior of an application server towards Spring. Server loads web part of the app first and after that - is trying to load EJBs.
I tried to rectify this. My usual declaration in applicationContext.xml
for local facade looks like this.

  |        <bean
  | 		id="facade"
  | 		class="&JndiObjectFactoryBean;">
  | 		<property
  | 			name="jndiName"
  | 			value="&facadeJndi;" />
  | 	</bean>
  | 
I tried to to force the factory bean to generate a proxy object to stand in for the real JNDI object and disabled lookupOnStartup. New version:
       
  |         <bean
  | 		id="facade"
  | 		class="&JndiObjectFactoryBean;">
  | 		<property
  | 			name="jndiName"
  | 			value="&facadeJndi;" />
  | 		<property
  | 			name="lookupOnStartup"
  | 			value="false" />
  | 		<property
  | 			name="proxyInterface"
  | 			value="&facadeLocal;" />
  | 	</bean>
  | 
Rebuild, reran. Nada! The same exception. For me it's no show, so I decided to revert back to my old, original JBoss 4.0.4 which does not recognize SpringLifecycleInterceptor but works well with my version of the same thing extending SpringPassivationInterceptor. This my original installation works good with Spring - first it loads EJBs and only then - web layer. 
Yet not all that good.
On my web layer I have two very simple jsps with JSTL - index.jsp and home.jsp.
index - 

  | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  | <c:redirect url="/home.htm"/>
  | 
home.jsp has the following very simple JSTL statements:

  | <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
  | ...
  | <ul>
  | 	<c:forEach items="${specials}" var="special">
  | 		<li>${special.departFrom.name} - ${special.arriveAt.name} from ${special.cost}</li>
  | 	</c:forEach>
  | </ul>
  | 
The problem is with jsp generation JBoss 4.0.4 on my machine generates index.jsp correctly transforming jstl into something like this

  | _jspx_th_c_redirect_0.setPageContext(_jspx_page_context);
  |     _jspx_th_c_redirect_0.setParent(null);
  |     _jspx_th_c_redirect_0.setUrl("/home.htm");
  |     int _jspx_eval_c_redirect_0 = _jspx_th_c_redirect_0.doStartTag();
  |     if (_jspx_th_c_redirect_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
  |       _jspx_tagPool_c_redirect_url_nobody.reuse(_jspx_th_c_redirect_0);
  |       return true;
  |     }
  |     _jspx_tagPool_c_redirect_url_nobody.reuse(_jspx_th_c_redirect_0);
  |     return false;
  | 
But in case with home.jsp it fails to process forEach.
 
  | do {
  |           out.write("\n");
  |           out.write("\t\t<li>");
  |           out.write("${special.departFrom.name}");
  |           out.write(' ');
  |           out.write('-');
  |           out.write(' ');
  |           out.write("${special.arriveAt.name}");
  |           out.write(" from\n");
  |           out.write("\t\t$");
  |           out.write("${special.cost}");
  |           out.write("</li>\n");
  |           out.write("\t");
  |           int evalDoAfterBody = _jspx_th_c_forEach_0.doAfterBody();
  |           if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN)
  | and on generated html I am getting
  | <ul>		<li>${special.departFrom.name} - ${special.arriveAt.name} from	${special.cost}</li>
  | 	
  | </ul>
  | 
Tried the same pages on JBoss 4.0.2 and Sun AS 8 - no problem - pages properly generated.
I noticed that in your sample application you don't use JSTL. Why is that? Is this because 
JBoss 4.0.4x way of handling of JSTL statements kinda 'patchy'? It's also strange that 4.0.4 does not have usual web-console - only jmx, at least on my installations. Well, strange, strange... 
So, for now I have a disfunctional web layer (controllers working fine though) and properly working facade, service, dao, EJB3 persistence on my old JBoss 4.0.4 - not patched.

Any ideas are highly appreciated ;)

Cheers,
Arno


 

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3961871#3961871

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3961871



More information about the jboss-user mailing list