Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9130055
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T07:53:13+00:00 2026-06-17T07:53:13+00:00

I’m working with a DataTable component, and my very straightforward goal is to delete

  • 0

I’m working with a DataTable component, and my very straightforward goal is to delete a row using an inline command button. This is the code for the dataTable component.

        <p:dataTable rowKey="#{dobavljac.dobavljacID}" value="#{dobavljacMB.vratiDobavljace()}" var="dobavljac" >
            <p:column>
                <f:facet name="header">ID</f:facet>
                <h:outputText value="#{dobavljac.dobavljacID}" />
            </p:column>
            <p:column>
                <f:facet name="header">Naziv</f:facet>
                <h:outputText value="#{dobavljac.naziv}" />
            </p:column>
            <p:column>
                <f:facet name="header">Adresa</f:facet>
                <h:outputText value="#{dobavljac.adresa}" />
            </p:column>

            <p:column colspan="2" style="text-align: center">
                <f:facet name="header">Operacija</f:facet>
                <p:commandButton id="viewButton" style="height: 35px" value="Delete" action="#{dobavljacMB.obrisi(dobavljac)}" ajax="false"/>          
            </p:column>
        </p:dataTable>

“dobavljac” is the entity I need to delete using action=”#{dobavljacMB.obrisi(dobavljac)}”

The managed bean class that has the deleting function “obrisi” is as follows:

/**
 * Creates a new instance of DobavljacMB
 */
private Dobavljac tekuci;

public Dobavljac getTekuci() {
    return tekuci;
}

public void setTekuci(Dobavljac tekuci) {
    this.tekuci = tekuci;
}



public DobavljacMB() {
}

public String prikazDobavljaca() {

    System.out.println("Prikaz dobavljaca");
    // System.out.println("podaci su:"+tekuciKorisnik.getKorisnickoIme());



    FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Ne postoji korisnik sa tim korisnickim imenom i sifrom!", ""));
    return null;
}

public List<Dobavljac> vratiDobavljace() {

    return KonekcijaDB.vratiInstancu().vratiDobavljace();

}

public String obrisi(Dobavljac d){
    try {
        System.out.println("obrisi");
        KonekcijaDB.vratiInstancu().obrisi(d);
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Dobavljac obrisan", ""));
        return "prikazDobavljaca.xhtml";
    } catch (Exception e) {
        FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(FacesMessage.SEVERITY_ERROR, "Greska pri brisanju", ""));
        return "prikazDobavljaca.xhtml";
    }


    }

The Dobavljac class is a simple POJO class, generated by the IDE, so no need to post it. The problem is that when the method is called, it throws a
java.lang.IllegalArgumentException: Cannot convert model.Dobavljac[ dobavljacID=66 ] of type class model.Dobavljac to class model.Dobavljac which is pretty absurd, since the object passed is the same as the one in the MB method “obrisi(Dobavljac d)”.
Of course, the object is never deleted from the DB, since the method is not invoked. My thoughts are that it’s a PrimeFaces problem, and not one of the JSF.

I’ve found examples that are very similar to this, and found that no one had this kind of problem (conversion between same classes), and don’t need to implement a converter.

I’m not sure if I need to add some more info to the question, and I’d be most thankful for an answer. It is very annoying. Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T07:53:14+00:00Added an answer on June 17, 2026 at 7:53 am
    java.lang.IllegalArgumentException: Cannot convert model.Dobavljac[ dobavljacID=66 ]
          of type class model.Dobavljac to class model.Dobavljac
    

    The webapp’s runtime classpath is dirty. There are multiple class file definitions of the model.Dobavljac class, each loaded by a different ClassLoader. The webapp’s runtime classpath covers by default all class files in /WEB-INF/classes, all JAR files /WEB-INF/lib, all JAR files in server’s /lib, all JAR files in JRE’s /lib and /lib/ext. The server can have other folders added via specific configuration settings. How and which exactly depends on the server’s make/version which you didn’t tell anything about.

    Cleanup the runtime classpath and get rid of the duplicate class file definiton (either the just standalone .class file, or the JAR file containing the offending .class file). After a rebuild/redeploy/restart this problem should disappear.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I am using JSon response to parse title,date content and thumbnail images and place
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.