Re: Help with Spring JDBC
Low hanging fruit comment: virtually 100% of the time I get a NPE when using spring, it's because I'm instantiating objects with new instead of letting the app context get the object for me (either explicitly or via injection). On Wed, Mar 30, 2011 at 2:12 PM, alxer alxer.mi...@gmail.com wrote: Hello, I am developing a web application with EclipseIDE and I am using the Struts2 and Spring3 frameworks. I am trying to configure the web application acces to my MySQL database. I am inexperienced with the configuration of these frameworks so I would like someone to give me a help, I'm sure it is not very complicate but I can't find what I am doing wrong. I have configured the web.xml with the listeners ContextLoaderListener and RequestContextListener and also set the contextConfigLocation (applicationContext.xml). In the applicationContext.xml: - I have set the dataSource bean (driverClassName, url, username and password). - Defined one applicationDAO bean class (it extends SimpleJdbcDaoSupport) with a property that references the dataSource bean. - And another bean that represents the main action with a property that references the applicationDAO bean. In the applicationDAO implementation I have implement some methods that acces the MySQL database, but I have not defined any dataSource object and either any dataSource settler because I'm pretty sure that it inherits the dataSource settler method from SimpleJdbcDaoSupport (I am extending this class). In the main action I have defined an object that represents the applicationDAO and also its settler. The problem is that when I debug the application, in the point of the main action that I have to use the applicationDAO object methods, it is null, so I get a NullPointerException. I don't know what I am missing to configure to be able to use the applicationDAO methods from the main action. I would be very very grateful to get some help. If you want I can post the code of these files. Thank you very much, alxer -- View this message in context: http://struts.1045723.n5.nabble.com/Help-with-Spring-JDBC-tp4272010p4272010.html Sent from the Struts - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Connection Pooling with Struts
E.g -. http://commons.apache.org/dbcp/ On Tue, Dec 7, 2010 at 4:27 PM, Dave Newton davelnew...@gmail.com wrote: A connection pooling library? On Tue, Dec 7, 2010 at 4:25 PM, Anjib Mulepati anji...@hotmail.com wrote: Ok now I get confuse. I was thinking simple JDBC can't (or complex to ) handle connection pooling. So framework make work easy. If framework is not used what are other alternatives to handle connection pooling beside JDBC itself? Anjib On 12/7/2010 4:20 PM, Arthur Neves wrote: Nop, You dont need using a framework... if you pick one just will make your life easier! If you`re starting a new project I`d get one framework, however if the project it`s already ready, just keep doing in the same way! On Tue, Dec 7, 2010 at 3:36 PM, Anjib Mulepatianji...@hotmail.com wrote: I was thinking for Hibernate. So only way for struts is use one of these framework? Anjib On 12/7/2010 3:26 PM, Johannes Geppert wrote: in java you have the choose which way is the best for your project to handle databases. there exists several frameworks for this job like hibernate, myBatis, spring jdbc tempalate, ... . google for it and look which framework is the best for your project. Johannes anjibman wrote: I have to do DB connection (Oracle 10g) in my application developed in Struts 1.3.8. Currently I am implementing JDBC. As far I understand this is not a good technique for real project. So I am hoping someone could suggest me how to do DB handling efficiently? Thanks Anjib - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - --- web: http://www.jgeppert.com twitter: http://twitter.com/jogep - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: Connection Pooling with Struts
Then you should be asking on the appropriate list. http://www.catb.org/~esr/faqs/smart-questions.html#forum On Tue, Dec 7, 2010 at 6:15 PM, Anjib anji...@hotmail.com wrote: Dude I am asking about ORM tool not Struts framework itself. Please see the reply from Johannes. Thanks Anjib On 12/7/2010 5:19 PM, stanl...@gmail.com wrote: Dude, I can't sit quietly any longer! How you connect to a database has NOTHING WHATSOEVER to do with the Struts/2 Framework. I would advise you to keep the two separated in your mind. Much like you wouldn't look to a Database connection to serve a web page, neither should you look to Struts/2 as a Database connection. On Tue, Dec 7, 2010 at 3:36 PM, Anjib Mulepatianji...@hotmail.com wrote: So I can use this DBCP Componenet instead of framework? Anjib E.g -. http://commons.apache.org/dbcp/ On Tue, Dec 7, 2010 at 4:27 PM, Dave Newtondavelnew...@gmail.com wrote: A connection pooling library? On Tue, Dec 7, 2010 at 4:25 PM, Anjib Mulepatianji...@hotmail.com wrote: Ok now I get confuse. I was thinking simple JDBC can't (or complex to ) handle connection pooling. So framework make work easy. If framework is not used what are other alternatives to handle connection pooling beside JDBC itself? Anjib On 12/7/2010 4:20 PM, Arthur Neves wrote: Nop, You dont need using a framework... if you pick one just will make your life easier! If you`re starting a new project I`d get one framework, however if the project it`s already ready, just keep doing in the same way! On Tue, Dec 7, 2010 at 3:36 PM, Anjib Mulepatianji...@hotmail.com wrote: I was thinking for Hibernate. So only way for struts is use one of these framework? Anjib On 12/7/2010 3:26 PM, Johannes Geppert wrote: in java you have the choose which way is the best for your project to handle databases. there exists several frameworks for this job like hibernate, myBatis, spring jdbc tempalate, ... . google for it and look which framework is the best for your project. Johannes anjibman wrote: I have to do DB connection (Oracle 10g) in my application developed in Struts 1.3.8. Currently I am implementing JDBC. As far I understand this is not a good technique for real project. So I am hoping someone could suggest me how to do DB handling efficiently? Thanks Anjib - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - --- web: http://www.jgeppert.com twitter: http://twitter.com/jogep - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org
Re: java.lang.NoClassDefFoundError: org/apache/struts2/util/ObjectFactoryDestroyable
Greetings, Reading the jira issue below, it seems that the developers believe this to be a Tomcat classloader issue. I know little (read: nothing) about classloaders, but a few observations I have using Google-fu: 1) Classloaders in Tomcat are twitchy, and you may be stuck with this behavior. Unless of course you want to master Tomcat classloaders. 2) Servlet.jar missing or in 2 places can cause issues. 3) Struts core jar file in 2 places can cause issues. This looks like this is happening during a cleanup op (i.e., after you have re-deployed) so maybe it's trying to use a class it *thinks* it has but which has already been removed? I'm curious - any reason why you are not deploying using a war file? It might be interesting to see what happens if you deploy it that way. -Ty On Mon, May 17, 2010 at 3:16 PM, Emi Lu em...@encs.concordia.ca wrote: The most similar question I could find is: https://issues.apache.org/jira/browse/WW-2921 But did not find any solutions? Someone knows the solution? Thanks a lot! -- Lu Ying On 05/17/2010 02:50 PM, Emi Lu wrote: Hi Rebecca, Martin, Could you be having something going crazy with your build scripts or something where the struts core jar isn't getting put in the right spot? check to see if struts2-core-version.jar is located in YourWebApp/WEB-INF/lib Yes. it is there. Tomcat 6.0, jdk1.6, ant-1.6.2. If I restart tomcat, the error is gone. The error is shown only when I re-install source codes and did not reload tomcat. Some possible places that I should pay special attention? I am using ant 1.6.2. Could this cause some potential problems? How come restart tomcat, errors are gone? Thanks a lot! -- Lu Ying - Original Message From: Emi Luem...@encs.concordia.ca To: user@struts.apache.org Sent: Mon, May 17, 2010 10:48:38 AM Subject: java.lang.NoClassDefFoundError: org/apache/struts2/util/ObjectFactoryDestroyable Good morning List, Using struts2.1.8.1, when I reinstall my application, I always got the following errors java.lang.NoClassDefFoundError: org/apache/struts2/util/ObjectFactoryDestroyable But in struts.jar does contain this class. Could someone help and tell me what cause the problem? Thanks a lot -- Lu Ying SEVERE: Exception invoking periodic operation: java.lang.NoClassDefFoundError: org/apache/struts2/util/ObjectFactoryDestroyable at org.apache.struts2.dispatcher.Dispatcher.cleanup(Dispatcher.java:265) at org.apache.struts2.dispatcher.FilterDispatcher.destroy(FilterDispatcher.java:233) at org.apache.catalina.core.ApplicationFilterConfig.release(ApplicationFilterConfig.java:357) at org.apache.catalina.core.StandardContext.filterStop(StandardContext.java:3873) at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4605) at org.apache.catalina.core.StandardContext.reload(StandardContext.java:3222) at org.apache.catalina.loader.WebappLoader.backgroundProcess(WebappLoader.java:403) at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1309) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610) at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590) at java.lang.Thread.run(Thread.java:619) - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org - To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org