Arian Zand

Greenhorn
+ Follow
since May 28, 2012
Merit badge: grant badges
For More
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
1
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Arian Zand

Hey,

As some already know I creating Crud app
I already have Read,Delete and create but I get an error while updating data

When I click on a reservation(for a hotel) I get the values from my reservation, in my form i can edit the value and I like to update it to the DB

My controller for my edit


In my Dao I only have one parameter the reservation ID (Is this right?)



In my DaoImpl I update my data
, I dont know which function to use to update data , I used refresh... / Also tried Merge


If i click on update i get this error:
SEVERE: Servlet.service() for servlet appServlet threw exception
java.lang.IllegalStateException: Handler parameter annotations are exclusive choices - do not specify more than one such annotation on the same parameter: public java.lang.String eu.test.test4.controller.ReservationController.reservationEditUpdate(java.lang.Integer,eu.test.test4.model.Reservation,org.springframework.validation.BindingResult,org.springframework.ui.ModelMap)


EDIT

I dont know why but I have "0" as reservationId in my Post Method controller
Is there something wrong with my modelattribute ?
11 years ago
PROBLEM SOLVED
I forget adding my xlmns schema and location for my transaction manager
11 years ago

Mark Spritzler wrote:OK, so you are saying your Reservation parameter in your Controller POST method is being populated.

You see your printlns show in the console.

Now what about setting a break point? can you do debugging? The thing we have to check is to see if you have a Transaction. If you can set a break point in the first line of your controller method. Then look at the Controller's Dao reference. If in the debugger it says it is being Proxied, then you have a Proxy.

Basically the code looks fine, although I didn't take a fined tooth comb to it.

The other thing you should post is your configuration of your EntityManagerFactory, and also your TransactionManager configuration as well as your DataSource. Also you have <tx:annotation-driven/> in your config?

Mark



Hi Mark, Thanks for your reply

How can I set break points in java?
Sorry I'm a newbie in Java...

In My servlet-Context I config my Entity manager (I set my annotation driven in comment because otherwise i get an error of Element of attribute dont match I need to set a xmlns but i dont know which one:

11 years ago
Hi,
A few weeks ago I posted my problem I could not persist my records.
I still have this problem but I fixed some errors.

I have a Form with a few textboxes to make a reservation for a hotel.
It's need your name,firstame, arrival etc...

When I press on my save button it doesnt persist and i dont know why

I put some system.outprintlns to check my function does receive the parameters and it does ....

I worked on this way:

My Reservationcontroller



My ReservationDao



My controllerImplementation



My domain



My view



Thanks!
11 years ago

Ken Rimple wrote:What is your JPA configuration? Have you properly set up your transaction manager?

I would turn up the logging in javax.persistence, in org.springframework.orm and see what it tells you. Bottom line if the transaction manager isn't configured right it will not flush and therefore will not cause a push of the data.

I also don't see a @Transactional anywhere. What is your transaction configuration? Are you using the AOP driven one or <tx:annotation-driven/> in your XML?

Ken


Hey Ken,

My JPA do you mean my persistence.xml? (I search on the internet what the JPA was standing for i didnt know...)
If my jpa is my persistence.xml I dont know where to find this file...
And where do i need to set the annotation Transactional ?
12 years ago

Bill Gorder wrote:Well you have a dependency (spring-webmvc) that should pull in that class. So next step is to check your deploy directory on tomcat and make sure the spring-webmvc.jar is in there. You can see this link for more information about tomcat and deploying applications.

http://tomcat.apache.org/tomcat-7.0-doc/deployer-howto.html

I would start your search for the jar here:




You can also use a zip program to inspect your application jar that maven builds and places in your target directory and making sure that your dependencies are being packaged correctly in there.

P.S.

I notice you have an unused property at the bottom '<spring.version>3.0.0.RELEASE</spring.version> '

You should use this instead of supplying the version for every dependency then you only need to change it in one place. Also the latest version is 3.1.1-RELEASE

You could also try pulling in spring-web although you really should have what you need with the webmvc

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>




Problem Solved! I deleted my Tomcat server and it works now :-)
12 years ago

Bill Gorder wrote:You are getting a class not found error.

java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet

Do you have spring-mvc in your POM? How are you deploying this to Tomcat? Make sure the libs are getting properly deployed/bundled.



Hey Bill Gorder

Im new in Spring MVC/Java, How can i be sure that my libs are properly deploying?
So i have a few dependecies in my pom of Spring

12 years ago
Hi I have a Webapplication and yesterday everything was ok when I tried to run my project.
Today I wanted to run my project and get the error :HTTP Status 404 - Servlet appServlet is not available

I dont know how eclipse sunddely dont find my appServlet because i have nothing chanched in my web.xml or another file.

This is my error



29-mei-2012 16:56:56 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:\Win dows\system32;C:\Windows;C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program Files (x86)\Common Files\Microsoft Shared\Windows Live;C:\Windows\system32;C:\Windows;C:\Windows\Sys tem32\Wbem;C:\Windows\System32\WindowsPowerShell\v 1.0\;C:\Program Files (x86)\Windows Live\Shared;;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Prog ram Files (x86)\Microsoft SQL Server\100\DTS\Binn\;D:\Semester2\Webontwikkeling\ apache-maven-3.0.4-bin\apache-maven-3.0.4\bin;JAVA_HOME%\bin;C:\Program Files (x86)\VDownloader;C:\Program Files\TortoiseSVN\bin;.
29-mei-2012 16:56:56 org.apache.tomcat.util.digester.SetPropertiesRule begin
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:SpringMVCOefeningen' did not find a matching property.
29-mei-2012 16:56:57 org.apache.coyote.http11.Http11Protocol init
INFO: Initializing Coyote HTTP/1.1 on http-8080
29-mei-2012 16:56:57 org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 1285 ms
29-mei-2012 16:56:57 org.apache.catalina.core.StandardService start
INFO: Starting service Catalina
29-mei-2012 16:56:57 org.apache.catalina.core.StandardEngine start
INFO: Starting Servlet Engine: Apache Tomcat/6.0.33
29-mei-2012 16:56:58 org.apache.catalina.core.ApplicationContext log
INFO: Marking servlet appServlet as unavailable
29-mei-2012 16:56:58 org.apache.catalina.core.ApplicationContext log
SEVERE: Error loading WebappClassLoader
context: /SpringMVCOefeningen
delegate: false
repositories:
/WEB-INF/classes/
----------> Parent Classloader:
org.apache.catalina.loader.StandardClassLoader@5a5 e5a50
org.springframework.web.servlet.DispatcherServlet
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1526)
at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1095)
at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:4421)
at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4734)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:840)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:463)
at org.apache.catalina.core.StandardService.start(Sta ndardService.java:525)
at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalin a.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:414)
29-mei-2012 16:56:58 org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet /SpringMVCOefeningen threw load() exception
java.lang.ClassNotFoundException: org.springframework.web.servlet.DispatcherServlet
at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1680)
at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1526)
at org.apache.catalina.core.StandardWrapper.loadServl et(StandardWrapper.java:1095)
at org.apache.catalina.core.StandardWrapper.load(Stan dardWrapper.java:993)
at org.apache.catalina.core.StandardContext.loadOnSta rtup(StandardContext.java:4421)
at org.apache.catalina.core.StandardContext.start(Sta ndardContext.java:4734)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1057)
at org.apache.catalina.core.StandardHost.start(Standa rdHost.java:840)
at org.apache.catalina.core.ContainerBase.start(Conta inerBase.java:1057)
at org.apache.catalina.core.StandardEngine.start(Stan dardEngine.java:463)
at org.apache.catalina.core.StandardService.start(Sta ndardService.java:525)
at org.apache.catalina.core.StandardServer.start(Stan dardServer.java:754)
at org.apache.catalina.startup.Catalina.start(Catalin a.java:595)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknow n Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Un known Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.apache.catalina.startup.Bootstrap.start(Bootst rap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstr ap.java:414)
29-mei-2012 16:56:58 org.apache.coyote.http11.Http11Protocol start
INFO: Starting Coyote HTTP/1.1 on http-8080
29-mei-2012 16:56:58 org.apache.jk.common.ChannelSocket init
INFO: JK: ajp13 listening on /0.0.0.0:8009
29-mei-2012 16:56:58 org.apache.jk.server.JkMain start
INFO: Jk running ID=0 time=0/44 config=null
29-mei-2012 16:56:58 org.apache.catalina.startup.Catalina start
INFO: Server startup in 1584 ms
29-mei-2012 16:56:59 org.apache.catalina.core.StandardWrapperValve invoke
INFO: Servlet appServlet is currently unavailable
This us my web.xml


Code:


12 years ago
Hi I have a Webapp and i want to insert a record in my db
This is my controller


tis is my dao


my daoImpl

When I press on save in my view it doensn't insert a new record in my db

I have no errors, the webpage goes back to my home.jsp...

Someone who knows what im doing wrong ?

Thanks!
12 years ago