2

When I try to add h2database dependency to my maven pom.xml I get 151 errors and can't build.

This is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>2.6.6</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>com</groupId>
    <artifactId>something</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>something else</name>
    <description>some info</description>
    <properties>
        <java.version>11</java.version>
        <azure.version>3.13.1</azure.version>
        <azure-identity.version>1.5.0</azure-identity.version>
        <spring-cloud-azure-starter-keyvault-secrets.version>4.0.0</spring-cloud-azure-starter-keyvault-secrets.version>
        <jackson.version>2.12.1</jackson.version>
        <azure-core-serializer-json-jackson.version>1.2.15</azure-core-serializer-json-jackson.version>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <log4j2.version>2.17.1</log4j2.version>

    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        <dependency>
            <groupId>com.azure.spring</groupId>
            <artifactId>azure-spring-boot-starter</artifactId>
        </dependency>
        <dependency>
            <groupId>com.microsoft.sqlserver</groupId>
            <artifactId>mssql-jdbc</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
        </dependency>
        <dependency>
            <groupId>com.azure</groupId>
            <artifactId>azure-core-serializer-json-jackson</artifactId>
            <version>${azure-core-serializer-json-jackson.version}</version>
        </dependency>
        <dependency>
            <groupId>com.azure.spring</groupId>
            <artifactId>spring-cloud-azure-starter-keyvault-secrets</artifactId>
            <version>${spring-cloud-azure-starter-keyvault-secrets.version}</version>
        </dependency>
        <dependency>
            <groupId>com.azure</groupId>
            <artifactId>azure-identity</artifactId>
            <version>${azure-identity.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-oauth2-resource-server</artifactId>
        </dependency>
    </dependencies>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>com.azure.spring</groupId>
                <artifactId>azure-spring-boot-bom</artifactId>
                <version>${azure.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    
    
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>com.microsoft.azure</groupId>
                <artifactId>azure-webapp-maven-plugin</artifactId>
                <version>2.3.0</version>
                <configuration>
                    <schemaVersion>V2</schemaVersion>
                    <subscriptionId>xxx</subscriptionId>
                    <resourceGroup>xxxx</resourceGroup>
                    <appName>xxx</appName>
                    <pricingTier>P1v2</pricingTier>
                    <region>West Europe</region>
                    <runtime>
                        <os>linux</os>
                        <javaVersion>java 11</javaVersion>
                        <webContainer>Java SE</webContainer>
                    </runtime>
                    <!-- start of APP_SETTINGS -->
                    <appSettings>
                        <property>
                            <name>JAVA_OPTS</name>
                            <value>-Dserver.port=80</value>
                        </property>
                    </appSettings>
                    <!-- end of APP_SETTINGS -->
                    <deployment>
                        <resources>
                            <resource>
                                <directory>${project.basedir}/target</directory>
                                <includes>
                                    <include>*.jar</include>
                                </includes>
                            </resource>
                        </resources>
                    </deployment>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

These are the error messages:

[INFO] Validation error:

[ERROR] org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for com.h2database:h2:jar:1.4.200
[ERROR] Maven server structure problem

[ERROR] org.eclipse.aether.resolution.ArtifactDescriptorException: Failed to read artifact descriptor for com.h2database:h2:jar:1.4.200
Cannot resolve org.jboss:jandex:2.4.2.Final
Cannot resolve io.netty:netty-transport-classes-epoll:4.1.75.Final
Cannot resolve org.springframework.boot:spring-boot-autoconfigure:2.6.6
Cannot resolve com.microsoft.azure:msal4j-persistence-extension:1.1.0
Cannot resolve org.springframework:spring-orm:5.3.18
Cannot resolve org.junit.jupiter:junit-jupiter-api:5.8.2
Cannot resolve org.springframework.boot:spring-boot-test:2.6.6
Cannot resolve org.springframework:spring-aop:5.3.18
Cannot resolve org.springframework.security:spring-security-web:5.6.2
Cannot resolve com.azure.spring:azure-spring-boot-starter:3.13.0
Cannot resolve org.opentest4j:opentest4j:1.2.0
Cannot resolve org.reactivestreams:reactive-streams:1.0.3
Cannot resolve org.junit.jupiter:junit-jupiter:5.8.2
Cannot resolve com.azure:azure-security-keyvault-secrets:4.3.6
Cannot resolve org.assertj:assertj-core:3.21.0
Cannot resolve com.azure:azure-core-amqp:2.4.1
Cannot resolve io.netty:netty-handler-proxy:4.1.75.Final
Cannot resolve org.skyscreamer:jsonassert:1.5.0
Cannot resolve net.java.dev.jna:jna-platform:5.6.0
Cannot resolve org.slf4j:jul-to-slf4j:1.7.36
Cannot resolve com.vaadin.external.google:android-json:0.0.20131108.vaadin1
Cannot resolve ch.qos.logback:logback-classic:1.2.11
Cannot resolve org.springframework:spring-web:5.3.18
Cannot resolve org.springframework.boot:spring-boot-starter-validation:2.6.6
Cannot resolve com.sun.activation:jakarta.activation:1.2.2
Cannot resolve org.springframework.boot:spring-boot-test-autoconfigure:2.6.6
Cannot resolve org.springframework:spring-core:5.3.18
Cannot resolve org.springframework.security:spring-security-oauth2-jose:5.6.2
Cannot resolve org.mockito:mockito-junit-jupiter:4.0.0
Cannot resolve org.springframework:spring-jdbc:5.3.18
Cannot resolve com.microsoft.azure:msal4j:1.11.0
Cannot resolve javax.validation:validation-api:2.0.1.Final
Cannot resolve com.azure.spring:spring-cloud-azure-autoconfigure:4.0.0
Cannot resolve io.netty:netty-handler:4.1.75.Final
Cannot resolve org.junit.platform:junit-platform-engine:1.8.2
Cannot resolve org.springframework.data:spring-data-commons:2.6.3
Cannot resolve org.jboss.logging:jboss-logging:3.4.3.Final
Cannot resolve com.h2database:h2:1.4.200
Cannot resolve com.fasterxml:classmate:1.5.1
Cannot resolve org.junit.jupiter:junit-jupiter-params:5.8.2
Cannot resolve ch.qos.logback:logback-core:1.2.11
Cannot resolve org.springframework:spring-aspects:5.3.18
Cannot resolve net.bytebuddy:byte-buddy-agent:1.11.22
Cannot resolve org.objenesis:objenesis:3.2
Cannot resolve org.springframework.boot:spring-boot-starter-json:2.6.6
Cannot resolve org.springframework.boot:spring-boot-starter-oauth2-resource-server:2.6.6
Cannot resolve org.springframework.security:spring-security-core:5.6.2
Cannot resolve io.netty:netty-codec-http2:4.1.75.Final
Cannot resolve com.microsoft.sqlserver:mssql-jdbc:9.4.1.jre8
Cannot resolve io.projectreactor.netty:reactor-netty-http:1.0.17
Cannot resolve io.netty:netty-tcnative-boringssl-static:2.0.51.Final
Cannot resolve org.springframework.boot:spring-boot-starter-logging:2.6.6
Cannot resolve org.springframework.security:spring-security-oauth2-core:5.6.2
Cannot resolve com.azure.spring:azure-spring-boot:3.13.0
Cannot resolve org.mockito:mockito-core:4.0.0
Cannot resolve org.springframework:spring-beans:5.3.18
Cannot resolve org.springframework:spring-tx:5.3.18
Cannot resolve jakarta.activation:jakarta.activation-api:1.2.2
Cannot resolve com.nimbusds:oauth2-oidc-sdk:9.7
Cannot resolve org.springframework.boot:spring-boot-starter-tomcat:2.6.6
Cannot resolve com.nimbusds:content-type:2.1
Cannot resolve org.glassfish.jaxb:txw2:2.3.6
Cannot resolve org.slf4j:slf4j-api:1.7.36
Cannot resolve org.springframework:spring-expression:5.3.18
Cannot resolve com.zaxxer:HikariCP:4.0.3
Cannot resolve com.azure.spring:spring-cloud-azure-core:4.0.0
Cannot resolve com.fasterxml.jackson.core:jackson-annotations:2.13.2
Cannot resolve io.projectreactor:reactor-core:3.4.16
Cannot resolve jakarta.annotation:jakarta.annotation-api:1.3.5
Cannot resolve org.apache.tomcat.embed:tomcat-embed-core:9.0.60
Cannot resolve org.ow2.asm:asm:9.1
Cannot resolve jakarta.xml.bind:jakarta.xml.bind-api:2.3.3
Cannot resolve com.fasterxml.jackson.core:jackson-core:2.13.2
Cannot resolve io.netty:netty-transport-native-epoll:4.1.75.Final
Cannot resolve io.netty:netty-transport-classes-kqueue:4.1.75.Final
Cannot resolve jakarta.persistence:jakarta.persistence-api:2.2.3
Cannot resolve io.netty:netty-resolver-dns-native-macos:4.1.75.Final
Cannot resolve org.springframework:spring-test:5.3.18
Cannot resolve net.minidev:accessors-smart:2.4.8
Cannot resolve com.fasterxml.woodstox:woodstox-core:6.2.7
Cannot resolve org.apache.qpid:proton-j:0.33.8
Cannot resolve com.azure:azure-core-http-netty:1.11.9
Cannot resolve io.netty:netty-transport-native-unix-common:4.1.75.Final
Cannot resolve io.netty:netty-transport:4.1.75.Final
Cannot resolve jakarta.validation:jakarta.validation-api:2.0.2
Cannot resolve io.netty:netty-common:4.1.75.Final
Cannot resolve org.springframework.boot:spring-boot-starter-test:2.6.6
Cannot resolve com.fasterxml.jackson.dataformat:jackson-dataformat-xml:2.13.2
Cannot resolve com.azure:azure-core:1.24.1
Cannot resolve com.azure.spring:spring-cloud-azure-service:4.0.0
Cannot resolve com.azure:azure-core-management:1.5.3
Cannot resolve com.azure.spring:spring-cloud-azure-starter-keyvault-secrets:4.0.0
Cannot resolve org.hibernate:hibernate-core:5.6.7.Final
Cannot resolve io.netty:netty-resolver:4.1.75.Final
Cannot resolve org.springframework.security:spring-security-crypto:5.6.2
Cannot resolve net.java.dev.jna:jna:5.5.0
Cannot resolve org.xmlunit:xmlunit-core:2.8.4
Cannot resolve com.github.stephenc.jcip:jcip-annotations:1.0-1
Cannot resolve org.apache.tomcat.embed:tomcat-embed-el:9.0.60
Cannot resolve org.springframework:spring-webmvc:5.3.18
Cannot resolve org.junit.jupiter:junit-jupiter-engine:5.8.2
Cannot resolve org.junit.platform:junit-platform-commons:1.8.2
Cannot resolve net.minidev:json-smart:2.4.8
Cannot resolve io.netty:netty-codec-socks:4.1.75.Final
Cannot resolve io.projectreactor.netty:reactor-netty-core:1.0.17
Cannot resolve antlr:antlr:2.7.7
Cannot resolve io.netty:netty-buffer:4.1.75.Final
Cannot resolve jakarta.transaction:jakarta.transaction-api:1.3.3
Cannot resolve org.springframework.data:spring-data-jpa:2.6.3
Cannot resolve org.codehaus.woodstox:stax2-api:4.2.1
Cannot resolve org.apiguardian:apiguardian-api:1.1.2
Cannot resolve com.fasterxml.jackson.core:jackson-databind:2.13.2.2
Cannot resolve org.springframework.security:spring-security-config:5.6.2
Cannot resolve org.yaml:snakeyaml:1.29
Cannot resolve org.apache.tomcat.embed:tomcat-embed-websocket:9.0.60
Cannot resolve org.springframework.boot:spring-boot-starter-web:2.6.6
Cannot resolve org.apache.logging.log4j:log4j-to-slf4j:2.17.1
Cannot resolve com.nimbusds:nimbus-jose-jwt:9.14
Cannot resolve org.springframework.boot:spring-boot-starter-aop:2.6.6
Cannot resolve io.netty:netty-resolver-dns:4.1.75.Final
Cannot resolve io.netty:netty-transport-native-kqueue:4.1.75.Final
Cannot resolve com.azure:azure-core-serializer-json-jackson:1.2.15
Cannot resolve io.netty:netty-tcnative-classes:2.0.51.Final
Cannot resolve com.fasterxml.jackson.datatype:jackson-datatype-jdk8:2.13.2
Cannot resolve io.netty:netty-codec:4.1.75.Final
Cannot resolve com.nimbusds:lang-tag:1.5
Cannot resolve com.sun.istack:istack-commons-runtime:3.0.12
Cannot resolve org.springframework:spring-jcl:5.3.18
Cannot resolve org.glassfish.jaxb:jaxb-runtime:2.3.6
Cannot resolve org.hibernate.validator:hibernate-validator:6.2.3.Final
Cannot resolve org.hibernate.common:hibernate-commons-annotations:5.1.2.Final
Cannot resolve org.springframework.boot:spring-boot-starter-data-jpa:2.6.6
Cannot resolve org.springframework.boot:spring-boot-starter-jdbc:2.6.6
Cannot resolve com.fasterxml.jackson.datatype:jackson-datatype-jsr310:2.13.2
Cannot resolve javax.annotation:javax.annotation-api:1.3.2
Cannot resolve com.microsoft.azure:qpid-proton-j-extensions:1.2.4
Cannot resolve com.fasterxml.jackson.module:jackson-module-parameter-names:2.13.2
Cannot resolve net.bytebuddy:byte-buddy:1.11.22
Cannot resolve io.netty:netty-resolver-dns-classes-macos:4.1.75.Final
Cannot resolve org.aspectj:aspectjweaver:1.9.7
Cannot resolve org.springframework.boot:spring-boot:2.6.6
Cannot resolve io.netty:netty-codec-dns:4.1.75.Final
Cannot resolve org.springframework:spring-context:5.3.18
Cannot resolve org.springframework.boot:spring-boot-starter:2.6.6
Cannot resolve org.springframework.security:spring-security-oauth2-resource-server:5.6.2
Cannot resolve io.netty:netty-codec-http:4.1.75.Final
Cannot resolve com.jayway.jsonpath:json-path:2.6.0
Cannot resolve com.azure:azure-identity:1.5.0
Cannot resolve org.apache.logging.log4j:log4j-api:2.17.1
Cannot resolve org.hamcrest:hamcrest:2.2
Cannot resolve com.azure.spring:spring-cloud-azure-starter:4.0.0

I tried to add the dependency under but then I get error:

Caused by: java.lang.IllegalStateException: Cannot load driver class: org.h2.Driver

See this for reference, saying I can't add under dependencymanagement: Cannot load driver class: org.h2.Driver in spring boot application

What do I do now?

3 Answers 3

1

You should apply the version of H2 in the pom.xml file

<dependency>
    <groupId>com.h2database</groupId>
    <artifactId>h2</artifactId>
    <version>1.4.200</version>
    <scope>runtime</scope>
</dependency>

you may have error in the test file, just open it and press ( Ctrl + Shift + O) to edit the import

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks, I tried adding the version number and different scopes. But nothing seem to work. I think it is my firewall blocking connections.
Maybe your firewall is the problem, if you solved it, just let me know that.
Yes 100% my firewall, it is rather annoying because it creates new errors every week. Thanks for your time!
1

I think you should type it like this

    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
        <scope>runtime</scope>
    </dependency>

this should work for you, if it doesn't work, you could add the h2 version.

1 Comment

Thanks for reply. It was my firewall that caused issues and I have to run specific java version in separate command prompt to resolve.
0

I could conclude that it is my firewall that most likely is the reason behind the issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.