Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!

Hernan Amaya

Greenhorn
+ Follow
since Jul 01, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Hernan Amaya

Thank you very much for your contribution, I needed to add recaptcha to my spring, struts2, webapp, login form, and this post saved me time and effort. Greetings.
11 years ago
I have a problem with Tiles 2.2, Struts 2 and Spring. This is the tiles configuration I'm using, I don't know whether it is correct or not because there isn't any clear explanation or example on how to configure tiles 2.2, besides it is different when you configure tiles 2.2 with Spring or even with Struts 2. Anyway this is the code:








And this are some beans I have added but I'm confused because as I'm using Struts 2 as MVC and not Spring MVC I don't know whether it these beans are necessary or not...



I get the following exception as I try to access to a struts 2 action:

Struts Problem Report

Struts has detected an unhandled exception:
Messages:
File: org/apache/tiles/definition/dao/CachingLocaleUrlDefinitionDAO.java
Line number: 246
Stacktraces
java.lang.NullPointerException

org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(CachingLocaleUrlDefinitionDAO.java:246)
org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(ResolvingLocaleUrlDefinitionDAO.java:65)
org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadParentDefinitions(ResolvingLocaleUrlDefinitionDAO.java:58)
org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(CachingLocaleUrlDefinitionDAO.java:239)
org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(ResolvingLocaleUrlDefinitionDAO.java:65)
org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadParentDefinitions(ResolvingLocaleUrlDefinitionDAO.java:58)
org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(CachingLocaleUrlDefinitionDAO.java:239)
org.apache.tiles.definition.dao.ResolvingLocaleUrlDefinitionDAO.loadDefinitionsFromURLs(ResolvingLocaleUrlDefinitionDAO.java:65)
org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.loadDefinitions(CachingLocaleUrlDefinitionDAO.java:222)
org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.checkAndloadDefinitions(CachingLocaleUrlDefinitionDAO.java:204)
org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinitions(CachingLocaleUrlDefinitionDAO.java:154)
org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:123)
org.apache.tiles.definition.dao.CachingLocaleUrlDefinitionDAO.getDefinition(CachingLocaleUrlDefinitionDAO.java:54)
org.apache.tiles.definition.UnresolvingLocaleDefinitionsFactory.getDefinition(UnresolvingLocaleDefinitionsFactory.java:105)
org.apache.tiles.impl.BasicTilesContainer.getDefinition(BasicTilesContainer.java:364)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:618)
org.apache.tiles.impl.BasicTilesContainer.render(BasicTilesContainer.java:321)
org.apache.struts2.views.tiles.TilesResult.doExecute(TilesResult.java:105)
org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:362)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:266)
org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:52)
org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:488)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:395)
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
java.lang.Thread.run(Thread.java:619)


11 years ago
Though I have activated log4j I still can't determine what line or mapping has each error for example as I have configured default-access=method for each attribute in a class it says in the last exception I've gotten that there is a mapping that can't find its corresponding method to access the property to find this error I have to test each bean to see its methods or switch to property access, as you can see it would be better if I were told the exact mapping or line or *.hbm.xml where the error is. Is this possible?
11 years ago
I'm using Eclipse IDE and setting a breakpoint and debugging java code is straight forward, I didn't know how to see errors at Hibernate level, I have activated Log4j as a debug alternative and I have a better perspective now. Thanks.
11 years ago
It was that indeed! I checked every many-to-one mapping and I found the error. Nevertheless, I have found other errors. How do I do to set a breakpoint to have a better understanding of each error, or how do I enable logging? Thank you.
11 years ago
I get the following exception


SEVERE: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/ro-data.xml]: Invocation of init method failed; nested exception is java.lang.NullPointerException
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1412)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:546)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:872)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:423)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3934)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4429)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:722)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:583)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.NullPointerException
at org.hibernate.mapping.ManyToOne.createPropertyRefConstraints(ManyToOne.java:70)
at org.hibernate.cfg.HbmBinder$ManyToOneSecondPass.doSecondPass(HbmBinder.java:2733)
at org.hibernate.cfg.Configuration.secondPassCompile(Configuration.java:1163)
at org.hibernate.cfg.Configuration.buildMappings(Configuration.java:1148)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.buildSessionFactory(LocalSessionFactoryBean.java:717)
at org.springframework.orm.hibernate3.AbstractSessionFactoryBean.afterPropertiesSet(AbstractSessionFactoryBean.java:211)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1469)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
... 27 more





Here is ro-data.xml

11 years ago
Hi there I need to create a struts 2 UI component, particularly, I need to create a tripleselect UI component that is to say, I need a dropdown box to select a country then another to select a state and the last one to select a city... I'm using freemarker as a view technology but I would like to create this custom tag for using it also with JSP. As far as I know I have to extend org.apache.struts2.components.DoubleListUIBean, with a class called for example TripleListUIBean and then extend this last one with a class for example called TripleSelect. Besides I have to extend org.apache.struts2.views.jsp.ui.AbstractDoubleListTag with for example AbstractTripleListTag and then extend this one with for example TripleListTag as this tag is similar to the doubleselect tag I'm based on the logic of the super classes to develop the subclasses, in the case of freemarker I imagine I have to extend org.apache.struts2.views.freemarker.tags.DoubleSelectModel... Then I have to create a Theme on the folder WebContent for example /WebContent/template/myTheme/ and add a file theme.properties that must have this line inside: parent=simple and then add a file named tripleselect.ftl, there I have to do the magic but as far as I know is very similar to the doubleselect.ftl so I take advantage of that. I was forgetting I also have to add this line in struts.properties: struts.ui.theme=myTheme. I have read somewhere that I have to create a TDL file for the JSP tag but I'm not sure about this. After that I'm supposed to use the tag in the following way in freemarker:



Is everything I have written right? I am missing any step? Can you give me any advise I may need to solve this problem? Thanks in advance.
11 years ago