-
45. Re: Spring Component Auto Detection
marius.bogoevici Jun 25, 2009 8:23 AM (in response to zithuba)Mike,
Can you be a bit more specific and describe: what jars did you put in those locations and what problems did you encounter?
Thanks,
Marius -
46. Re: Spring Component Auto Detection
marius.bogoevici Jun 25, 2009 8:34 AM (in response to zithuba)"marius.bogoevici" wrote:
Can you be a bit more specific and describe: what jars did you put in those locations and what problems did you encounter?
Marius
Also, please note that in this case, replacing just the jboss-spring-int-vfs.jar will not help, you will need to use the new version of jboss-spring-int-deployers.jar too.
Best thing to do with latest: a "mvn package" and grab the libs zip from build/target/jboss-spring-int-1.0.0-SNAPSHOT-lib.zip. You can also find a packaged deployer, in jboss-spring.deployer.zip (unzip it in your deployers folder).
Marius -
47. Re: Spring Component Auto Detection
macktheknife73 Jun 25, 2009 10:02 AM (in response to zithuba)Well I'm having all sorts of problems :-)
My main problem at the moment (which I should open a seperate thread either here or on the spring forums) is dependency injection has stopped working for me.
What I had working in a single war was a data access object defined like so@Repository public class HibernateDomainObjectDao extends HibernateDaoSupport implements DomainObjectDao {
and a service class using it like@Service public class DomainObjectServiceImpl implements DomainObjectService { private DomainObjectDao domainObjectDao; private static Logger log = Logger.getLogger(DomainObjectServiceImpl.class); public DomainObjectServiceImpl() { log.error("CONSTRUCTED DomainObjectServiceImpl"); } @Resource public void setDomainObjectDao(DomainObjectDao domainObjectDao) { log.error("setDomainObjectDao"); this.domainObjectDao = domainObjectDao; }
So like I said ... all fine and working properly in standalone war. However when I moved all of classes into a seperate jar and deployed it as a jar+war in an ear suddenly it stopped working. I see everything created but the set is never called. So dependency injection isnt working ?
I know ... new thread ... but is it a Jboss issue or a spring issue ? -
48. Re: Spring Component Auto Detection
macktheknife73 Jun 25, 2009 10:20 AM (in response to zithuba)
If I don't include int-vfs and int-deployers in the war/lib directory (but I do have them in the spring.deployers directory) I get the following exception
15:16:26,116 INFO [TomcatDeployment] deploy, ctxPath=/common-mgt-fw-war, vfsUrl=common-mgt-fw.spring/common-mgt-fw.war
15:16:27,701 INFO [[/common-mgt-fw-war]] Initializing Spring root WebApplicationContext
15:16:27,702 INFO [STDOUT] 25-Jun-2009 15:16:27 INFO [ContextLoader] - <Root WebApplicationContext: initialization started>
15:16:27,804 INFO [STDOUT] 25-Jun-2009 15:16:27 ERROR [ContextLoader] - <Context initialization failed>
org.springframework.context.ApplicationContextException: Custom context class [org.jboss.spring.factory.VFSXmlWebApplicationContext] is not of type [org.springframework.web.context.ConfigurableWebApplicationContext]
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:245)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3910)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4393)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeployInternal(TomcatDeployment.java:367)
at org.jboss.web.tomcat.service.deployers.TomcatDeployment.performDeploy(TomcatDeployment.java:146)
at org.jboss.web.deployers.AbstractWarDeployment.start(AbstractWarDeployment.java:460)
at org.jboss.web.deployers.WebModule.startModule(WebModule.java:118)
at org.jboss.web.deployers.WebModule.start(WebModule.java:96)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
at org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
at org.jboss.system.microcontainer.ServiceProxy.invoke(ServiceProxy.java:206)
at $Proxy36.start(Unknown Source) -
49. Re: Spring Component Auto Detection
alesj Jun 25, 2009 10:28 AM (in response to zithuba)It looks like you're also including spring.jar in your .war?
-
50. Re: Spring Component Auto Detection
marius.bogoevici Jun 25, 2009 10:57 AM (in response to zithuba)Thanks for the update.
The problem seems to be that spring-web.jar is included in both the web app and the deployer, where it does not really belong. Try removing the spring-web.jar from the deployer and give it another try.
I'll fix the build not to it.
Generally speaking, try to make sure that you have the spring jars included only in one place (shared libs, deployer, war) and they're visible enough to the component that you want to use them (e.g. if you don't use the deployer, you can put them in the war, if you use the deployer put them in the deployer or shared, etc). The reason why we include a minimal set of jars in the distribution is that this is what you would need to get things running out of the box, if the only thing you need to do is provide an xml to do the bean wiring, but you can use different other setups, as per above, to match your needs.
Marius -
51. Re: Spring Component Auto Detection
macktheknife73 Jun 25, 2009 12:09 PM (in response to zithuba)
Thanks alot guys ... duplicate jars was the answer to ALL my problems.
I was porting a sample app that was working on tomcat so I suppose its my own fault. But my dependency injection problem was cleaned up (by removing the hibernate jar) as well.
Thanks again. That was driving me CRAZZZZYYYY !!!! :-) -
52. Re: Spring Component Auto Detection
macktheknife73 Jun 25, 2009 1:48 PM (in response to zithuba)
Ok still have a (small) problem with these spring jars, when I access the jsp, the war isn't picking up the spring tag libraries from the spring.jar (spring-2.5.6.jar) thats contained in the deployer directory, if I remove the tag definition everything is fine, I don't particularly need spring tags but its disconcerting that the war isn't picking it up. Could this be another clashing jar issue ?
org.apache.jasper.JasperException: The absolute uri: http://www.springframework.org/tags cannot be resolved in either web.xml or the jar files deployed with this application
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:51)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:409)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:116)
org.apache.jasper.compiler.TagLibraryInfoImpl.generateTLDLocation(TagLibraryInfoImpl.java:313)
org.apache.jasper.compiler.TagLibraryInfoImpl.(TagLibraryInfoImpl.java:148)
org.apache.jasper.compiler.Parser.parseTaglibDirective(Parser.java:429)
org.apache.jasper.compiler.Parser.parseDirective(Parser.java:491)
org.apache.jasper.compiler.Parser.parseElements(Parser.java:1441)
org.apache.jasper.compiler.Parser.parse(Parser.java:137)
org.apache.jasper.compiler.ParserController.doParse(ParserController.java:238)
org.apache.jasper.compiler.ParserController.parse(ParserController.java:103)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:171)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:333)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:313)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:300)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:585)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:236)
org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:257)
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1183)
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:902)
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807)
org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571)
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501)
javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96) -
53. Re: Spring Component Auto Detection
alesj Jun 25, 2009 5:30 PM (in response to zithuba)I think you can somehow link these tlds/tags by declaring them in web.xml.
But I might be wrong since it's been ages when I last did www ui. :-) -
54. Re: Spring Component Auto Detection
marius.bogoevici Jun 25, 2009 5:57 PM (in response to zithuba)Mike,
You need spring-mvc.jar on the classpath (contents of which are not included in spring.jar) if you want to reference the spring taglibs.
Are you sure that you added that particular jar to the deployer?
Marius -
55. Re: Spring Component Auto Detection
macktheknife73 Jun 26, 2009 7:32 AM (in response to zithuba)
This is the contents of my deployers directory
$ ls
META-INF spring-context-support-2.5.6.jar
jboss-spring-int-deployers.jar spring-core-2.5.6.jar
jboss-spring-int-vfs.jar spring-orm-2.5.6.jar
jboss-spring.jar spring-tx-2.5.6.jar
spring-2.5.6.jar spring-web-2.5.6.jar
spring-beans-2.5.6.jar spring-webmvc-2.5.6.jar
spring-context-2.5.6.jar
my ear contents (I'm still trying to pear this down)
$ ls
META-INF jta-1.1.jar
aopalliance-1.0.jar junit-3.8.1.jar
asm-3.1.jar log4j-1.2.14.jar
asm-commons-3.1.jar maven-archiver-2.2.jar
asm-tree-3.1.jar maven-artifact-2.0.4.jar
asm-util-3.1.jar maven-artifact-manager-2.0.4.jar
aspectjrt-1.6.1.jar maven-ear-plugin-2.3.1.jar
aspectjweaver-1.6.1.jar maven-model-2.0.4.jar
cglib-nodep-2.1_3.jar maven-plugin-api-2.0.4.jar
classworlds-1.1-alpha-2.jar maven-profile-2.0.4.jar
common-mgt-fw.jar maven-project-2.0.4.jar
common-mgt-fw.war maven-repository-metadata-2.0.4.jar
commons-collections-3.2.1.jar maven-settings-2.0.4.jar
commons-dbcp-1.2.2.jar mysql-connector-java-5.1.6.jar
commons-logging-1.1.1.jar plexus-archiver-1.0-alpha-7.jar
commons-pool-1.4.jar plexus-container-default-1.0-alpha-9.jar
hessian-3.1.5.jar plexus-utils-1.2.jar
jdom-1.1.jar quartz-1.6.1.jar
jsr250-api-1.0.jar standard-1.1.2.jar
jstl-1.1.2.jar wagon-provider-api-1.0-alpha-6.jar -
56. Re: Spring Component Auto Detection
macktheknife73 Jun 26, 2009 7:37 AM (in response to zithuba)thats hard to read ... better
$ ls
META-INF
jboss-spring-int-deployers.jar
jboss-spring-int-vfs.jar
jboss-spring.jar
spring-2.5.6.jar
spring-beans-2.5.6.jar
spring-context-2.5.6.jar
spring-context-support-2.5.6.jar
spring-core-2.5.6.jar
spring-orm-2.5.6.jar
spring-tx-2.5.6.jar
spring-web-2.5.6.jar
spring-webmvc-2.5.6.jar
$ ls
META-INF
aopalliance-1.0.jar
asm-3.1.jar
asm-commons-3.1.jar
asm-tree-3.1.jar
asm-util-3.1.jar
aspectjrt-1.6.1.jar
aspectjweaver-1.6.1.jar
cglib-nodep-2.1_3.jar
classworlds-1.1-alpha-2.jar
common-mgt-fw.jar
common-mgt-fw.war
commons-collections-3.2.1.jar
commons-dbcp-1.2.2.jar
commons-logging-1.1.1.jar
commons-pool-1.4.jar
hessian-3.1.5.jar
jdom-1.1.jar
jsr250-api-1.0.jar
jstl-1.1.2.jar
jta-1.1.jar
junit-3.8.1.jar
log4j-1.2.14.jar
maven-archiver-2.2.jar
maven-artifact-2.0.4.jar
maven-artifact-manager-2.0.4.jar
maven-ear-plugin-2.3.1.jar
maven-model-2.0.4.jar
maven-plugin-api-2.0.4.jar
maven-profile-2.0.4.jar
maven-project-2.0.4.jar
maven-repository-metadata-2.0.4.jar
maven-settings-2.0.4.jar
mysql-connector-java-5.1.6.jar
plexus-archiver-1.0-alpha-7.jar
plexus-container-default-1.0-alpha-9.jar
plexus-utils-1.2.jar
quartz-1.6.1.jar
standard-1.1.2.jar
wagon-provider-api-1.0-alpha-6.jar -
57. Re: Spring Component Auto Detection
marius.bogoevici Aug 14, 2009 9:45 AM (in response to zithuba)For anyone following the discussion on this forum, I've made a few changes to the project structure, moving the context classes in the vfs module and leaving the deployers to deal with deployment only.
A few hints:
1. context class is org.jboss.spring.vfs.context.VFSXmlWebApplicationContext
2. you only need to include jboss-spring-int-vfs.jar in your application
3. the stable branch for the project is to be found at http://anonsvn.jboss.org/repos/jbossas/projects/spring-int/branches/1_0/ -
58. Re: Spring Component Auto Detection
nbhatia Nov 23, 2009 11:21 PM (in response to zithuba)Ales,
Is the code for spring-int (specifically org.jboss.spring.vfs) still maintained at https://anonsvn.jboss.org/repos/jbossas/projects/spring-int? Is the jar now available in JBoss AS 5.1.0 or part of some maven repository?
Thanks.
Naresh -
59. Re: Spring Component Auto Detection
marius.bogoevici Nov 24, 2009 12:23 AM (in response to zithuba)Naresh,
The project is now hosted under https://www.jboss.org/snowdrop. Here you will find the downloads and the documentation for it. I need to update the stickies of the forum.
the svn location is: https://anonsvn.jboss.org/repos/jbossas/projects/snowdrop/
(1.0.0 is based on the 1_0 branch, current trunk is the future 1.1)
It is available in maven in the JBoss Maven repository as:
org.jboss.snowdrop
snowdrop-vfs
1.0.0.GA
(the other modules are snowdrop-cluster, snowdrop-deployers, snowdrop-facade and snowdrop-weaving)
Hope that helps,
Marius
PS: Good reminder for me to update the stickies on the top of the forum ;)