Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

java.lang.ClassNotFoundException: org.springframework.dao.DataAccessException #1839

Closed
izeye opened this issue Nov 6, 2014 · 12 comments
Closed
Labels
status: invalid An issue that we don't feel is valid

Comments

@izeye
Copy link
Contributor

izeye commented Nov 6, 2014

When 'org.springframework.boot:spring-boot-starter-web' dependency is only added and

run the following code:

@EnableAutoConfiguration
@ComponentScan
public class Application {

    public static void main(String[] args) {
        SpringApplication.run(Application.class);
    }

}

Got the following exception:

java.lang.ClassNotFoundException: org.springframework.dao.DataAccessException

I think there's no reason to get the above exception.

@snicoll
Copy link
Member

snicoll commented Nov 6, 2014

Which Spring Boot version are you using? I couldn't reproduce. Do you have any other component in the package were you defined this app?

@snicoll snicoll added the status: waiting-for-feedback We need additional information before we can continue label Nov 6, 2014
@izeye
Copy link
Contributor Author

izeye commented Nov 6, 2014

I'm using 1.2.0.M2. It occurred even when there's no component.

@snicoll
Copy link
Member

snicoll commented Nov 6, 2014

I still can't reproduce. Please attach a real project. Here's what I did, go on start.spring.io, select 1.2.0.M2, select "web", copy/paste the code above and run. It works

@izeye
Copy link
Contributor Author

izeye commented Nov 6, 2014

I didn't use Spring Initializer. I shared the project at:

https://github.com/izeye/SpringBootTest

@snicoll
Copy link
Member

snicoll commented Nov 6, 2014

Well, maybe you should have :)

Here's the exception you have in the logs

Caused by: java.lang.IllegalStateException: Could not evaluate condition owing to internal class not found. This can happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)

@snicoll snicoll closed this as completed Nov 6, 2014
@dsyer dsyer removed the status: waiting-for-feedback We need additional information before we can continue label Nov 6, 2014
@izeye
Copy link
Contributor Author

izeye commented Nov 6, 2014

Oh, sorry. I didn't understand the logs before you mentioned it.

Now I got it. Thanks 👍

@philwebb philwebb added the status: invalid An issue that we don't feel is valid label Nov 6, 2014
@ghost
Copy link

ghost commented Aug 4, 2015

@snicoll Thank you very much

@snicoll
Copy link
Member

snicoll commented Aug 4, 2015

👍

@hikrishna
Copy link

Hi, I have the very similar issue in the latest version of Spring boot

@snicoll
Copy link
Member

snicoll commented Aug 31, 2015

As I told you on stackoverflow already, you probably have one class in the default package that has component scan (defaut package = no package statement in the class). If that's not the case, please create a separate issue with a sample project that reproduces the problem.

@hikrishna
Copy link

I have created new issue #3850 with details. Please check if that is issue or not and close it.

@linxingzhi
Copy link

I also have this problem do you resolve it 。 please tell me thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

6 participants