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 8031273
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:02:35+00:00 2026-06-05T01:02:35+00:00

Im a getting the follwoing error: java.lang.NoSuchMethodException: Unknown property ‘language’ on class ‘class java.lang.Class’

  • 0

Im a getting the follwoing error:

java.lang.NoSuchMethodException: Unknown property 'language' on class 'class java.lang.Class'

Rest call used : /Test/rest/Languages/insertobj/Japanese/Swedish%206

I am using : org.apache.commons.beanutils.PropertyUtils;

I do had the specified property ‘language’ in my Languages class so Im not sure why it is throwing the error. It works when I declare its as such :

Languages lanobj = new Lanaguages();

//Languages class

public class Languages implements java.io.Serializable {
    private String language;
    private String displayName;

public Languages() {
        this.language = null;
        this.displayName = null;
    }


public Languages(String language, String displayName) {
    this.language = language;
    this.displayName = displayName;
}

public void setLanguageId(Long languageId) {
    this.languageId = languageId;
}

@Column(name = "language", nullable = false, length = 50)
public String getLanguage() {
    return this.language;
}

public void setLanguage(String language) {
    this.language = language;
}

@Column(name = "displayName", nullable = false, length = 50)
public String getDisplayName() {
    return this.displayName;
}

public void setDisplayName(String displayName) {
    this.displayName = displayName;
}

}

///Resource manager code

@Path("{subResources}/insertobj/{language-id}/{displayname-id}")
//@POST 
@GET // Using get for the sake of making rest call with browser
@Produces(MediaType.TEXT_HTML)
public String getLanguageById(@PathParam("subResources") String id,
                            @PathParam("language-id") String language_id,
                            @PathParam("displayname-id") String displayname_id) 
{
    try{
        Class<?> c = Class.forName("com.test."+id);
        PropertyUtils.setProperty(c, "language",language_id);
        PropertyUtils.setProperty(c, "displayName",displayname_id);
        TransactionManager.createObject(c);     

    }catch (Exception exc){
        exc.printStackTrace();      
    }

}

//TransactionManager snippet:

public static void createObject(Object entityObject) {
    Transaction tx = null;
    //SessionFactoryUtil.getInstance().openSession();
    Session session =  SessionFactoryUtil.openSession();
    try {
      tx = session.beginTransaction();        
      session.save(entityObject);         
      tx.commit();
    } 
    catch (RuntimeException e)
    {
      if (tx != null && tx.isActive())
      {
        try 
        {
            // Second try catch as the rollback could fail as well
            tx.rollback();
        } 
        catch (HibernateException e1) {
            //logger.debug(“Error rolling back transaction”);
        }
        // throw again the first exception
        throw e;
      }
    }
    finally
    {
        session.close();
    }
  }
  • 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-05T01:02:37+00:00Added an answer on June 5, 2026 at 1:02 am

    setProperty needs an instance whereas you are passing the class, see the documentation

    Class<?> c = Class.forName("com.test."+id);
    Language language = (Language)c.newInstance();
    PropertyUtils.setProperty(language , "language",language_id);
    

    Either you specificially cast to Language or else you can just leave it as Object

    Object object  = Class.forName("com.test."+id).newInstance();
    PropertyUtils.setProperty(object, "language",language_id);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

New to android programming. Getting Following error. 04-07 14:49:05.452: ERROR/AndroidRuntime(1566): FATAL EXCEPTION: main java.lang.OutOfMemoryError
I am getting the following error when testing my DAO using Assert.AssertEquals() method: java.lang.AssertionError:
I am trying to put String[] in jsonObject and getting following error java.lang.IllegalArgumentException: Invalid
I am getting the following error: java.lang.StringIndexOutOfBoundsException: length=13243; regionStart=32; regionLength=-39 at java.lang.String.startEndAndLength(String.java:593) at java.lang.String.substring(String.java:1474)
I am getting the following error on execution of a multi-threading program java.lang.OutOfMemoryError: Java
Getting the following error : java.lang.NullPointerException: Module 'null' not found. <?xml version=1.0 encoding=UTF-8 ?>
hi my application contains SQLite .My application some time getting the following error java.lang.RuntimeException:
I am getting the following error Exception in thread main java.lang.ClassCastException: org.hibernate.impl.SessionFactoryImpl cannot be
I am getting following error message: java.lang.IllegalStateException: Neither BindingResult nor plain target object for
I'm getting the following error: Exception in thread main java.lang.IndexOutOfBoundsException: Index: 86, Size: 86

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.