jas preet

Ranch Hand
+ Follow
since Mar 31, 2010
jas likes ...
Eclipse IDE Tomcat Server Java
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 jas preet

The problem was in the servlet xml file. I used


and it worked fine. in forward.jsp i am sending request as home.do
So home.do executes my method


and from there it takes it to my login page with the message being printed.

Thank you for all your help.
7 years ago



HomeController.java


forward.jsp



xxxxx-servlet.xml



The problem is it says home.jsp not found. But in HomeController.java in ModelAndView I am redirecting it to login. It should redirect to login.jsp. If I am wrong anywhere please let me know. Any help will be appreciated.
7 years ago
For all you out there it is working now. I had a problem with my libraries. I was including the catalina and servlet jars that was causing the problem. I removed all of these and it deployed on Tomcat 7 .

Thanks
8 years ago
Can you please let me know what is the problem in my web.xml. When I try to deploy my application i get the below stacktrace

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4"
xmlns="http://java.sun.com/xml/ns/j2ee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

<servlet>
<servlet-name>ComponentProcessServlet</servlet-name>
<servlet-class>
com.manage.process.ComponentProcessServlet
</servlet-class>
<init-param>
<param-name>app-properties</param-name>
<param-value>TestEnv.properties</param-value>
</init-param>
<init-param>
<param-name>inet_project_id</param-name>
<param-value>TestEnv</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>upload</servlet-name>
<servlet-class>
com.manage.process.FileUploadServlet
</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>ComponentProcessServlet</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>upload</servlet-name>
<url-pattern>/upload</url-pattern>
</servlet-mapping>

<!--
<security-constraint>
<web-resource-collection>
<web-resource-name>Automatic SLL Forwarding</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>
CONFIDENTIAL
</transport-guarantee>
</user-data-constraint>
</security-constraint>
-->

<session-config id="TestEnv">
<session-timeout>240</session-timeout>
</session-config>

<welcome-file-list>
<welcome-file>ManageIndex.jsp</welcome-file>
</welcome-file-list>

<!--
<resource-env-ref>
<description>
Object factory for MyBean instances.
</description>
<resource-env-ref-name>
jdbc/lawyersinsurancedb
</resource-env-ref-name>
<resource-env-ref-type>
javax.sql.DataSource
</resource-env-ref-type>
<res-auth>Container</res-auth>
</resource-env-ref>
-->



<resource-ref id="resource1">
<description>DB Connection</description>
<res-ref-name>jdbc/lawyersinsurancedb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>


</web-app>


and below is the error that I get when I deploy my application.

parse error while creating jndi resource .. If you can please help me.

8 years ago
Hi,
I am trying for days to validate my form using validation framework of struts, I am not able to figure out the problem. I have seen many posts. Did as they say. But all in vain. Not able to validate. Please help me figure out the problem in my code.
I have a login form that needs to be validated. I am new to struts. So this is just a test program.


login.jsp




LoginAction.java



LoginAction-validation.xml



struts.xml



Any help will be appreciated. No error message is displayed.
9 years ago
I have a large xml response that i need to parse but i am unable to it.



The one marked as bold is where i get the compile time error.
Unable to resolve please help.

Note : The same response when i paste in a XML file and try to parse it. It is done successfully.
But i need to parse the response that i get from the url.
The response is a xml string that i am trying to parse now.
9 years ago
Thanks Paul .. It worked . .I had to commit and close the connection .
Hi,
I have a code that runs perfect, but the inserted values does not show up in ms access database table.
I connected to the ms access database -- > connection done.
Then i executed the query - - > query executed successfully done.
But the inserted data is not been shown up. Please help. I have been trying this for long.

Here is my simple code.
If your project mainly concern with ajax request then i would suggest you to use jsp. They will be easy to handle.
9 years ago
I not able to validate simple form using JSR-303 implementation. I am not getting any exception, i think the problem is the framework is not invoking the @Valid annotation in the controller. I have been searching a lot.
I need to validate my login form. I have added the required jars in the classpath. Could not figure out the prblem.

Below is my servlet-xml file.


Login class



Controller



login.jsp



When i do not enter anything for email the validation is not trigerred.
10 years ago
From where to download the library. Can you please provide me with the link from where the library can be downloaded. Also hibernate 4 .. i googled it but could only find hibernate4gwt . .
10 years ago
I am trying to validate my form using JSR-303 validation which has annotations validation. But i do not know where i am stuck in.. I included the jar files. And everything else that is needed. If anyone can help me on this. or can provide me some value information so that i can go ahead with the validation implementation in my project

below is the list of jars that are all available in my classpath

antlr-2.7.6.jar
asm.jar
cglib-2.2.jar
cglib-nodep-2.2.jar
cglib.jar
commons-beanutils-1.7.0.jar
commons-collections-3.1.jar
commons-dbcp-all-1.3.jar
commons-digester-1.8.jar
commons-logging.jar
dom4j-1.6.1.jar
ejb3-persistence.jar
hibernate-annotations.jar
hibernate-ejb3-persistence.jar
hibernate-jpa-2.0-api-1.0.1.Final.jar
hibernate3.jar
javaee.jar
javassist-3.12.0.GA.jar
joda-time-1.6.jar
jsoup-1.5.2.jar
jstl-1.2.jar
jta-1.1.jar
log4j-1.2.16.jar
mysql-connector-java-5.1.17-bin.jar
org.springframework.aop-3.0.5.RELEASE.jar
org.springframework.asm-3.0.5.RELEASE.jar
org.springframework.aspects-3.0.5.RELEASE.jar
org.springframework.beans-3.0.5.RELEASE.jar
org.springframework.context-3.0.5.RELEASE.jar
org.springframework.context.support-3.0.5.RELEASE.jar
org.springframework.core-3.0.5.RELEASE.jar
org.springframework.expression-3.0.5.RELEASE.jar
org.springframework.instrument-3.0.5.RELEASE.jar
org.springframework.instrument.tomcat-3.0.5.RELEASE.jar
org.springframework.jdbc-3.0.5.RELEASE.jar
org.springframework.jms-3.0.5.RELEASE.jar
org.springframework.orm-3.0.5.RELEASE.jar
org.springframework.oxm-3.0.5.RELEASE.jar
org.springframework.test-3.0.5.RELEASE.jar
org.springframework.transaction-3.0.5.RELEASE.jar
org.springframework.web-3.0.5.RELEASE.jar
org.springframework.web.portlet-3.0.5.RELEASE.jar
org.springframework.web.servlet-3.0.5.RELEASE.jar
org.springframework.web.struts-3.0.5.RELEASE.jar
servlet-api-2.3.jar
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar
spring-modules-validation-0.8.jar
spring-webmvc-2.5.6.jar
spring.jar
tiles-api-2.2.2.jar
tiles-core-2.2.2.jar
tiles-jsp-2.2.2.jar
tiles-servlet-2.2.2.jar
tiles-template-2.2.2.jar
validation-api-1.0.0.GA.jar



dispatcher-servlet.xml


Login.java



HomeController.java



Below is the stacktrace
Nov 10, 2011 5:23:51 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre6\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:/Program Files/Java/jre6/bin/client;C:/Program Files/Java/jre6/bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files\QuickTime\QTSystem\;C:\Program Files\Java\jdk1.5.0_09\bin;C:\Program Files\MySQL\MySQL Server 5.0\bin;D:\AntBuildingTool\ant\bin;;.
Nov 10, 2011 5:23:51 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:UploadFileExample' did not find a matching property.
Nov 10, 2011 5:23:51 PM org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.j2ee.server:Practise' did not find a matching property.
Nov 10, 2011 5:23:51 PM org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
Nov 10, 2011 5:23:51 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 991 ms
Nov 10, 2011 5:23:52 PM org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
Nov 10, 2011 5:23:52 PM org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.29
Nov 10, 2011 5:23:52 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(D:\Jaspreet Singh\eclipseGanymade\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\Practise\WEB-INF\lib\javaee.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
Nov 10, 2011 5:23:52 PM org.apache.catalina.loader.WebappClassLoader validateJarFile
INFO: validateJarFile(D:\Jaspreet Singh\eclipseGanymade\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\Practise\WEB-INF\lib\servlet-api-2.3.jar) - jar not loaded. See Servlet Spec 2.3, section 9.7.2. Offending class: javax/servlet/Servlet.class
log4j:WARN No appenders could be found for logger (org.springframework.web.filter.CharacterEncodingFilter).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Nov 10, 2011 5:23:53 PM org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring FrameworkServlet 'timetracker'
Nov 10, 2011 5:23:58 PM org.apache.catalina.core.ApplicationContext log
SEVERE: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'validator' defined in ServletContext resource [/WEB-INF/timetracker-servlet.xml]: Invocation of init method failed; nested exception is javax.validation.ValidationException: Unable to find a default provider
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1420)
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:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4350)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4659)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: javax.validation.ValidationException: Unable to find a default provider
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:183)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
... 32 more
Nov 10, 2011 5:23:58 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /Practise threw load() exception
javax.validation.ValidationException: Unable to find a default provider
at javax.validation.Validation$GenericBootstrapImpl.configure(Validation.java:264)
at org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet(LocalValidatorFactoryBean.java:183)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1417)
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:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:442)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:458)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:339)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:306)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)
at javax.servlet.GenericServlet.init(GenericServlet.java:212)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4350)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4659)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Nov 10, 2011 5:23:58 PM org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
Nov 10, 2011 5:23:58 PM org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
Nov 10, 2011 5:23:58 PM org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/87 config=null
Nov 10, 2011 5:23:58 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 6330 ms

10 years ago
I am not using any Transactions for queries. I think i searched some of the content on web and i saw that transactions
have been used. Do i need to use them as to use transactions driven hibernate ?
10 years ago
Here is what I tried to do now. Please have a look. I commented the hibernateTemplate bean



and In DAO i now used




and below is the error stackTrace that i get

SEVERE: Servlet.service() for servlet timetracker threw exception
org.hibernate.HibernateException: No Hibernate Session bound to thread, and configuration does not allow creation of non-transactional one here
at org.springframework.orm.hibernate3.SpringSessionContext.currentSession(SpringSessionContext.java:63)
at org.hibernate.impl.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:542)
at com.practice.dao.ContactDAOImpl.listContact(ContactDAOImpl.java:28)
at com.practice.services.ContactServiceImpl.listContact(ContactServiceImpl.java:32)
at com.practice.controller.ContactController.listContacts(ContactController.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.web.bind.annotation.support.HandlerMethodInvoker.invokeHandlerMethod(HandlerMethodInvoker.java:176)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.invokeHandlerMethod(AnnotationMethodHandlerAdapter.java:426)
at org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter.handle(AnnotationMethodHandlerAdapter.java:414)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:857)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
at java.lang.Thread.run(Unknown Source)

10 years ago