Washington (CNN) President Donald Trump's nominee for secretary of Defense , Mark Esper, appeared to sail through Tuesday's hearing before the Senate Armed Services Committee despite being grilled by a 2020 Democratic presidential candidate, Sen. Elizabeth Warren, over his ties to the defense contractor Raytheon, where he previously worked as a lobbyist.

Throughout the hearing, several Democrats and Republicans praised Esper's qualifications and some said they looked forward to voting to confirm him for the permanent defense secretary role.

Warren was one of the only lawmakers on the committee who raised serious objections to Esper's confirmation during a heated exchange in which the Army secretary refused to commit to recusing himself from matters involving his former employer, Raytheon.

As it stands Esper is not required to recuse himself after November, in accordance with his ethics agreement, but Warren wanted him to commit beyond then. Esper will still have to adhere to standard to ethics rules.

"On the advice of my ethics folks at the Pentagon, the career professionals, no, the recommendation is not to," Esper said about making that commitment.

Speaking to reporters on Monday, Esper's chief of staff said that he "is doing everything required by law" and adhering to required ethics agreement, adding "there's no waivers, nothing outside of law, everything that -- everything that he's required to do by law."

Additionally, Esper would not say whether he would seek a waiver to participate in matters that would affect Raytheon's "ability or willingness" to give him $1 million in deferred compensation he is owed as Warren said he wrote in a memo he could get a waiver to participate in such matters if it's "so important it cannot be referred to another official."

Warren said that response "smacks of corruption," prompting Esper to quote from a letter from the director of standards of conduct office that said "at no time while serving as secretary of the army or the acting secretary of defense" did he "request, seek, or receive" such a waiver.

Esper also refused to say he would not seek to work for or get paid by any defense contractor for at least four years after his government service, leading Warren to declare that "you can't make those commitments to this committee. That means you should not be confirmed as Secretary of Defense."

Esper pushed back hard against Warren's claim that his refusal was disqualifying.

"At the age of 18 I went to West Point, and I swore an oath to defend this Constitution, and I embraced a motto called duty and honor and country. And I've lived my life in accordance with those values ever since then. I went to war for this country. I served overseas for this country," he told the committee.

"I've stepped down from jobs that paid me well more than what I was working anywhere else. And each time it was to serve the public good and to serve the young men and women of our armed services," Esper added.

While other Democrats raised the issue of Esper's previous employment at Raytheon, most lawmakers other than Warren seemed satisfied with his commitment to abide by his ethics agreement.

Republican Sen. Tom Cotton defended Esper's ties to Raytheon, providing the opportunity for Esper to state he had fully divested his stake in the company and noting that several previous nominees for the secretary of defense role had also worked for defense contractors prior to their confirmation.

"There is a tendency to be too hard on former associates and employers because of the exact kind of perception that is raised when you leave industry and go into government," he said, adding that there are also advantages of having experience in the private sector.

Florida Republican Rick Scott took a harder line in his criticism of Warren, accusing her of "needing a moment for her presidential campaign."

"I apologize you were demonized earlier," Scott said at the end of his questioning, referring to Warren's comments.

This article has been updated.