Announcement Announcement Module
Collapse
No announcement yet.
Possibly AOP? Possibly Data? Or just confused? illegalStateException... Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Possibly AOP? Possibly Data? Or just confused? illegalStateException...

    Hey folks, I'm trying not to spam the boards, but I'm hoping my question doesn't fall into a black hole. I'm trying to implement a JPA structure via Spring, and the AOP / Proxy setup is driving me bonkers.

    I'm posting here - apologies again if this feels like overposting, but the Data board doesn't seem to be warming to the question...

    The error is:

    Code:
    java.lang.IllegalStateException: Cannot convert value of type 
    [$Proxy26 implementing com.stonekeep.congo.dao.GenericDAO,org.springframework.aop.SpringProxy,org.springframework.aop.framework.Advised] 
    to required type 
    [com.stonekeep.congo.dao.FriendDAO]: no matching editors or conversion strategy found
    The full post describing the problem has all the gritty details.

    Help? This is holding up a pretty important project (to me at the moment

  • #2
    I suggest a forum search... That question has been answered numerous times before.

    You are probably trying to cast a proxied instance to a concrete class (FriendDao) instead of the interface (GenericDao) it implements. I suggest a read of the aop chapter.

    Comment


    • #3
      I have searched the forums several times, and I'm as confused as I was when I started. Understand I didn't have any intention of implementing AOP, this was 'how hibernate is used in spring'. I'm not an AOP guru.

      Your solution is incomplete, as I'm not sure -how- I'm doing a cast here. Can you give me a pointer to what I should change to fix the problem? I'm injecting the FriendDAO into my action class, I'm assuming that's what you're suggesting I should change?

      I'm sorry to sound obtuse or sound like i'm not willing to learn to get the problem solved - but this is forcing me into working with something I have little experience with,and all I want to do is use JPA to make it easier to implement DAO's.

      Comment


      • #4
        As soon as you use transactions in spring (with either @Transactional or xml configuration) you use aop, and that goes for many other things. As I stated I suggest a read on AOP so that you understand your issue, especially a read on proxy based AOP.

        What spring by default does it takes your class FriendDAO and checks if there are interfaces implemented, if there are it creates a dynamic class which implements all that interfaces (that class is named PRoxy$whatever). So it isn't a FriendDAO (concrete class) anymore, hence you should be programming to interfaces (the interface that FriendDAO) implements.

        And that question, regarding proxies has been answered numerous times before (just by me alone alread, hence my suggestion to use the search).

        Comment

        Working...
        X