Javax.naming.namingexception: невозможно создать экземпляр ресурса.

Я следую руководству по https://www.sap.com/developer/tutorials/hcp-java-weatherapp-part8.html с Eclipse Juno. На шаге 6 я не могу запустить код, так как получил сообщение об ошибке. Я также скопировал код из https://github.com/SAP/cloud-weatherapp.

20:21:45.727 [http-nio-8080-exec-8] ERROR c.s.c.s.a.tomcat.support.DelegatingObjectFactory - Exception is thrown by default object creation facroty during retrieving object instance. Exception is: javax.naming.NamingException: Cannot create resource instance

Вот моя настройка pom.xml:

    <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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.sap.hana.cloud.samples</groupId>
  <artifactId>weatherapp</artifactId>
  <version>0.0.1-SNAPSHOT</version>
  <packaging>war</packaging>

    <properties>
        <java-version>1.7</java-version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <org.slf4j-version>1.7.2</org.slf4j-version>
        <com.sap.cloud.neo.api-version>1.76.13</com.sap.cloud.neo.api-version>      
        <org.apache.cxf-version>3.0.0</org.apache.cxf-version>
        <org.codehaus.jackson-version>1.9.13</org.codehaus.jackson-version>
        <httpclient.version>4.5.4</httpclient.version>
        <httpcore.version>4.4.10</httpcore.version>
    </properties>

    <repositories>
        <repository>
            <id>central</id>
            <name>Maven Central Repository</name>
            <url>http://repo1.maven.org/maven2/</url>
        </repository>
        <repository>
            <id>eclipselink</id>
            <name>EclipseLink Maven Repository</name>
            <url>http://download.eclipse.org/rt/eclipselink/maven.repo/</url>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>com.sap.cloud</groupId>
            <artifactId>neo-java-web-api</artifactId>
            <version>${com.sap.cloud.neo.api-version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- Servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>

        <!-- Apache CXF -->
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxws</artifactId>
            <version>${org.apache.cxf-version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.cxf</groupId>
            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
            <version>${org.apache.cxf-version}</version>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>2.0</version>
        </dependency>

        <!-- EclipseLink (and JPA) -->
        <dependency>
            <groupId>org.eclipse.persistence</groupId>
            <artifactId>eclipselink</artifactId>
            <version>2.5.0</version>
        </dependency>
        <dependency>
           <groupId>org.eclipse.persistence</groupId>
           <artifactId>javax.persistence</artifactId>
           <version>2.1.0</version>
         </dependency>
         <!-- Derby -->
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derbyclient</artifactId>
            <version>10.9.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.derby</groupId>
            <artifactId>derby</artifactId>
            <version>10.9.1.0</version>
        </dependency>

        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>2.0</version>
        </dependency>

        <dependency>
            <groupId>org.codehaus.jackson</groupId>
            <artifactId>jackson-jaxrs</artifactId>
            <version>${org.codehaus.jackson-version}</version>
        </dependency>   

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>${httpclient.version}</version>
        </dependency>

        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpcore</artifactId>
            <version>${httpcore.version}</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>${java-version}</source>
                    <target>${java-version}</target>
                    <showDeprecation>true</showDeprecation>
                    <showWarnings>true</showWarnings>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <warName>weatherapp</warName>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.5</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                    <id>compile</id>
                    <phase>compile</phase>
                    <configuration>
                        <target>
                            <property name="compile_classpath" refid="maven.compile.classpath" />
                            <property name="runtime_classpath" refid="maven.runtime.classpath" />
                            <property name="test_classpath" refid="maven.test.classpath" />
                            <property name="plugin_classpath" refid="maven.plugin.classpath" />

                            <echo message="compile classpath: ${compile_classpath}" />
                            <echo message="runtime classpath: ${runtime_classpath}" />
                            <echo message="test classpath: ${test_classpath}" />
                            <echo message="plugin classpath: ${plugin_classpath}" />
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>

        <pluginManagement>
            <plugins>
                <!-- Eclipse m2e settings only - influence on the Maven build itself -->
                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>
                                            org.apache.maven.plugins
                                        </groupId>
                                        <artifactId>
                                            maven-antrun-plugin
                                        </artifactId>
                                        <versionRange>
                                            [1.7,)
                                        </versionRange>
                                        <goals>
                                            <goal>run</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <execute></execute>
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>

    <organization>
        <name>SAP SE</name>
        <url>http://www.sap.com</url>
    </organization>

    <developers>
        <developer>
            <name>SAP HANA Cloud Platform</name>
            <url>http://hcp.sap.com</url>
            <organization>SAP SE</organization>
            <organizationUrl>http://www.sap.com/</organizationUrl>
        </developer>
    </developers>

    <licenses>
        <license>
            <name>The Apache Software License, Version 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <url>https://github.com/SAP/cloud-weatherapp</url>
</project>

и web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
    <display-name>cloud-weatherapp</display-name>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
    </welcome-file-list>
    <resource-ref>
        <res-ref-name>jdbc/DefaultDB</res-ref-name>
        <res-type>javax.sql.DataSource</res-type>
    </resource-ref>   
    <resource-ref>
        <res-ref-name>openweathermap-destination</res-ref-name>
        <res-type>com.sap.core.connectivity.api.http.HttpDestination</res-type>
    </resource-ref>
    <servlet>
        <display-name>HelloWorldServlet</display-name>
        <servlet-name>HelloWorldServlet</servlet-name>
        <servlet-class>com.sap.hana.cloud.samples.weatherapp.web.HelloWorldServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>HelloWorldServlet</servlet-name>
        <url-pattern>/hello</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>CXFServlet</servlet-name>
        <servlet-class>
        org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
    </servlet-class>
        <init-param>
            <param-name>jaxrs.serviceClasses</param-name>
            <param-value>
                com.sap.hana.cloud.samples.weatherapp.api.AuthenticationService,
                com.sap.hana.cloud.samples.weatherapp.api.FavoriteCityService,
                com.sap.hana.cloud.samples.weatherapp.api.WeatherService
            </param-value>
        </init-param>
        <init-param>
            <param-name>jaxrs.providers</param-name>
            <param-value>org.codehaus.jackson.jaxrs.JacksonJsonProvider</param-value>
        </init-param>        
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>CXFServlet</servlet-name>
        <url-pattern>/api/v1/*</url-pattern>
    </servlet-mapping>
    <login-config>
        <auth-method>FORM</auth-method>
    </login-config>
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Protected Area</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <!-- Role Everyone will not be assignable -->
            <role-name>Everyone</role-name>
        </auth-constraint>
    </security-constraint>
    <security-role>
        <description>All SAP Cloud Platform users</description>
        <role-name>Everyone</role-name>
    </security-role>
</web-app>

Пожалуйста помоги.

Не могли бы вы выложить всю трассировку стека? Есть дополнительная информация, которую он не нашел?

Simon Martinelli 10.08.2018 14:38

Это все что у меня из лога 2018 08 10 20:21:45#+0800#ERROR#com.sap.core.services.accessor.tomcat.s‌​upport.DelegatingObj‌​ectFactory#BC-NEO-RT‌​-JAV#anonymous#http-‌​nio-8080-exec-8#com.‌​sap.core.services.ac‌​cessor#N/A#N/A#N/A#d‌​ev_default#na#na#na#‌​na#Exception is thrown by default object creation facroty during retrieving object instance. Exception is: javax.naming.NamingException: Cannot create resource instance

user9550188 10.08.2018 14:48

Неужели это все? У вас есть идея, из какого ресурса нельзя создать экземпляр?

Simon Martinelli 10.08.2018 15:04

это все, что я получил от Eclipse, где взять другие подробности?

user9550188 13.08.2018 10:41
1
4
295
0

Другие вопросы по теме