java. lang.NoSuchMethodException: com. sun. proxy.$ Proxy58. List error resolution

java. lang.NoSuchMethodException: com. sun. proxy.$ Proxy58. List error resolution

There are always some unexpected exceptions when playing SSH on the web. There are many things caused by carelessness or carelessness. Therefore, the solutions will be different. The exception solutions of others may not be effective for you. Just like the exceptions I reported above, Baidu has given me many times. The answer is to add a sentence to AOP, but I'm very sorry, it's invalid! So it's the same sentence. For your own exceptions, you still have to solve them yourself.

First of all, explain the SSH structure of my exercise and the reason for the exception reported.

Framework struts 2 2+hibernate4. 2+spring4. 0, container chamber tomcat7 0. In action, I wrote a base class baseaction, inherited actionsupport, and implemented the modelDriven interface. The code is as follows:

The advantage of this is that in the action corresponding to each component, you only need to tell baseaction the generic type you want to implement, and then you only need to complete your own logic. This is a basic and easy scheme for each action to implement actionsupport.

Then, in each Action, the service component is invoked to implement its own function. In each Action, @Component ("departmentAction") and @Scope ("prototype") are used to annotate, but when a test is practiced, Java. will appear. lang.NoSuchMethodException: com. sun. proxy.$ Proxy58. List() is abnormal. After checking, it is found that the reason is:

Baseaction is abstract. Adding @ transactional to it is meaningless,

The @ transactional is managed by spring. The objects managed by spring need to generate proxies. For an abstract class, it cannot be new as an object. Only the concrete implementation class of an abstract class can be proxy by spring.

Therefore, removing @ transactional from baseaction is the reason for this question.

Thank you for reading, hope to help you, thank you for your support to this site!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>