Mystic River

In 1975, three children - Jimmy, Sean, and Dave - are playing on the streets of Boston when a stranger approaches them. Since the stranger has a badge and is wearing a suit, the children assume that he is a police officer. The stranger orders Dave to enter his car, and Dave obeys. The men lock him inside a basement and sexually abuse him for four days, after which he manages to escape.
Twenty-eight years later, the boys are grown and still live in Boston, but they are no longer close friends. Jimmy (Sean Penn) is an ex-convict running a neighborhood store, while Dave (Tim Robbins) is a blue-collar worker. The two are still neighbors and related by marriage. Sean (Kevin Bacon) has become a detective with the Massachusetts State Police. Several months prior, his wife left him before having their child but his wife still sometimes calls him without saying a word.
Jimmy's 19-year-old daughter Katie (Emmy Rossum) visits him at the store he owns, and tells her father she will be going out that Saturday night with her friends. Jimmy mentions that the next day is her sister's communion, and as she leaves it is revealed she is secretly dating a boy named Brendan (Tom Guiry), and they reference plans they have for the next day. That night Dave is at a bar where Katie happens to also show up with her friends; Katie and her friends dance on the bar top to the music but Dave continues to watch the TV at the bar.
Dave comes home at 3am Sunday morning with an injured hand and blood on his clothes, which his wife Celeste (Marcia Gay Harden) helps him clean, but immediately notices inconsistencies in his story. Dave claims that he fought against a mugger and may have killed him. Katie's car is found on the street in the early morning after a call to emergency services; and Katie doesn't show up the next morning for work.
Jimmy attends a Sunday morning church service with his family and some neighborhood tough guys that are former associates, and Jimmy grows more concerned because Katie still hasn't shown up.
Katie's car has a bullet hole in the front seat and blood stains to match a shot from the outside, but a trail of trampled weeds leads into a state park. The state police are called in to search as a crowd gathers, Jimmy approaches the police line and sees that it's Katie's car. Celeste sees on television that a young girl is missing, and looks at her husband Dave with suspicion.
Suspecting foul play and wanting answers, Jimmy's associates try to get past the police line, when they can't Jimmy sends two of them to begin questioning Katie's friends, and a third helps him reach a part of the perimeter they can break through. Katie's body is found, beaten and shot again to kill her. Sean identifies her, just as Jimmy breaks through the police line, assumes it's his daughter and breaks down.
Sean and his partner Whitey (Laurence Fishburne) head up Katie's murder investigation. While trying to establish a timeline of Katie's last events, Jimmy asks Sean if he ever thinks about how one choice can change everything, bringing up the incident where Dave was abducted as a child, and Jimmy says his life would have been different if he had been abducted instead, how Katie would have never been born, and never killed. Sean and Jimmy talk about Dave, about the timeline, calls Katie made, if Katie had a boyfriend, and how on Sunday morning Brendan asked about Katie at the store.
Sean and Whitey speak about Dave's abduction and Sean tells the story of what happened after, that the abductors were caught and both died within a year. From the phone number records, and the evidence in the car, Sean and Whitey suspect Katie was planning to leave for Las Vegas on Sunday, they ask Katie's friends and they confirm she was going to elope with Brendan. Dave, who is related to Jimmy by marriage, is at Jimmy's house for the wake, where Celeste continues to look at him with suspicion, and Jimmy inquires about his injured hand, which Dave lies about.
Dave is shown to be having difficulty with his thoughts, and Celeste grows more concerned that a beaten up mugger isn't showing up in the newspapers. Brendan is questioned but doesn't have an alibi, and admits to their relationship and plans to elope. Brendan says that Jimmy forbade their relationship since he is a Harris, and Brendan tells his mom he wouldn't have just left without saying anything like his father. Brendan's mute brother, Silent Ray (Spencer Treat Clark), tries to comfort Brendan. Ray and their mother agree that Brendan is better off without Katie, to which Brendan reacts violently, saying he will never love like that again.
Dave becomes a suspect, having been seen at the bar the night Katie was murdered and not having a convincing explanation for his injured hand. Whitey searches Dave's car and finds blood, both in the front-seat and trunk. Dave is brought in for questioning but does not confess when he ascertains the search of his vehicle was done illegally.
Through ballistic reports, Sean and Whitey discover that the pistol used to kill Katie had been used in a liquor store robbery in the 1980s by "Just Ray" Harris, the father of Katie's boyfriend Brendan. Harris, though missing, supposedly mails his family $500 every month. A further look into Harris's past reveals he was an accomplice of Jimmy's, and that he had sold Jimmy out to authorities to avoid serving jail time for another crime.
Returning home late one night, Celeste confronts Dave that she suspects he killed Katie. He has a breakdown and reveals the sexual abuse he suffered as a child. He then tells Celeste that "Dave is dead" and that he can't "trust his mind anymore". Finally convinced that her husband did kill Katie, she meets with Jimmy and tells him about Dave's bloody clothing and that she believes him to be his daughter's killer.
Still searching for answers, Sean and Whitey play back the original 911 phone call from two teenage boys, reporting an abandoned car that ultimately led to the discovery of Katie's body. When the operator asks for the boy's name, the boy misinterprets the question and tells his friend, "they want to know her name". Sean wonders how these boys could know the victim's gender when the body was discovered in the woods, some distance away from the abandoned car.
Jimmy and his associates get Dave drunk at a local bar near Mystic River where they mention they won't be bothered, as the bar is absent of anyone else to witness them together. As they leave, Jimmy confesses that he had murdered "Just Ray" Harris and dumped his body at that exact location, and that, unless Dave confesses to Katie's murder, he will suffer the same fate. Dave repeatedly insists that the person he murdered was a male child molester, but being confused, and drunk, is unconvincing. When Jimmy doesn't believe him, and repeats that if Dave confesses he will only go to prison and won't be killed, Dave confesses, Jimmy asks why and Dave, fumbling with his words, says it was because he was jealous of Katie for having a childhood while he did not. Jimmy stabs him, throws the knife into the river, and shoots Dave to kill him.
Meanwhile, Brendan realizes that his father's pistol is missing from a loose panel in the kitchen ceiling. Brendan confronts his younger brother Ray and his brother's friend, John O'Shea, beating them up and threatening to kill them unless they admit their guilt. John O'Shea takes the gun and is about to shoot Brendan, but Sean and Whitey arrive in time to stop him.
The next morning, Sean tells Jimmy that the murderers are in custody and have confessed. Silent Ray and John O'Shea stole Just Ray's pistol and attempted to menace a random car, but they accidentally shot and wounded Katie. To cover up their crime, they chased her into the park, where Silent Ray beat her with a hockey stick and John O'Shea shot her a second time, killing her. Sean asks Jimmy whether he has seen Dave, since the police discovered the body of a known child molester and view Dave as a suspect. It is then revealed that Sean knew that Jimmy murdered Just Ray and Dave, and has been the one sending money to Just Ray's family. Jimmy realizes that murdering Dave was a mistake, but his wife reassures him that he did it with the right intention. Shortly after, Sean's wife and newborn daughter return to him. A few days later, at a parade, Sean sees Jimmy and mimics shooting him.

Question: Who confessed to murdering "Just Ray" Harris?
Answer: Jinmy.