简体   繁体   中英

Do Azure Container Instances (Windows) support access to Table Storage

I have a container instance (Windows) running a spring-boot application that accesses azure table storage from within a spring-boot CommandLineRunner. The container runs fine locally (Docker / Win10 Pro).

When I deploy to a container instance, a StorageException is thrown at the point that an attempt is made to retrieve a DynamicTableEntity from a table. The connection to the storage account and the table appear to succeed, but the retrieve operation fails. The Tomcat server is running and responsive (I catch the exception and prepare basic error information to be returned by servlets that manage requests). I have been unable to find any examples or definitive statements about using the Java Azure storage libraries in containers, so I would like to know if there are any restrictions, or work-arounds if necessary.

Below are logs which indicate where the exception is thrown. Log entries with "CommandLineRunner" are generated by my code. Line 397 in my application is the line where I attempt to retrieve a DynamicTableEntity from the table (14 lines into the log). Prior to that, the connection string is parsed without error, and a reference to the table is generated without error. Although not shown, I am satisfied that the partitionKey and RowKey are correct (and the exception is because the table does not exist - but it does, and is accessible when the container is run locally). Line 562 is the entry point of the spring-boot CommandLineRunner.

    **2019-05-13 00:57:44.632  INFO 3060 --- [           main] a.c.n.sbtest.demo.DemoApplication        : CommandLineRunner: Engine Intialization Ready (status: 0)**
2019-05-13 00:57:44.670  INFO 3060 --- [           main] a.c.n.sbtest.demo.DemoApplication        : CommandLineRunner: Deployment table <Deployments> accessible
2019-05-13 00:57:44.687  INFO 3060 --- [           main] a.c.n.sbtest.demo.DemoApplication        : CommandLineRunner: User <e7c6163e-8c06-4146-b0e4-78fec93e6cce> Container accessible
2019-05-13 01:00:17.755  INFO 3060 --- [nio-8080-exec-7] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring DispatcherServlet 'dispatcherServlet'
2019-05-13 01:00:17.755  INFO 3060 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet        : Initializing Servlet 'dispatcherServlet'
2019-05-13 01:00:17.768  INFO 3060 --- [nio-8080-exec-7] o.s.web.servlet.DispatcherServlet        : Completed initialization in 13 ms
com.microsoft.azure.storage.StorageException:
        at com.microsoft.azure.storage.StorageException.translateException(StorageException.java:87)
        at com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:209)
        at com.microsoft.azure.storage.table.QueryTableOperation.performRetrieve(QueryTableOperation.java:178)
        at com.microsoft.azure.storage.table.TableOperation.execute(TableOperation.java:694)
        at com.microsoft.azure.storage.table.CloudTable.execute(CloudTable.java:529)
        at com.microsoft.azure.storage.table.CloudTable.execute(CloudTable.java:496)
        at **ai.com.neuralstudio.sbtest.demo.DemoApplication.lambda$commandLineRunner$0(DemoApplication.java:562)**
        at org.springframework.boot.SpringApplication.callRunner(SpringApplication.java:813)
        at org.springframework.boot.SpringApplication.callRunners(SpringApplication.java:797)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:324)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
        at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
        at **ai.com.neuralstudio.sbtest.demo.DemoApplication.main(DemoApplication.java:397)**
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
        at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
        at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:51)
Caused by: java.net.UnknownHostException: neuralstudiotest002.table.core.windows.net
        at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:184)
        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172)
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
        at java.net.Socket.connect(Socket.java:589)
        at sun.security.ssl.SSLSocketImpl.connect(SSLSocketImpl.java:673)
        at sun.net.NetworkClient.doConnect(NetworkClient.java:175)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:463)
        at sun.net.www.http.HttpClient.openServer(HttpClient.java:558)
        at sun.net.www.protocol.https.HttpsClient.<init>(HttpsClient.java:264)
        at sun.net.www.protocol.https.HttpsClient.New(HttpsClient.java:367)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.getNewHttpClient(AbstractDelegateHttpsURLConnection.java:191)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect0(HttpURLConnection.java:1156)
        at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:1050)
        at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:177)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1564)
        at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1492)
        at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
        at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:347)
        at com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:115)
        ... 19 more
2019-05-13 01:00:29.420 ERROR 3060 --- [           main] a.c.n.sbtest.demo.DemoApplication        : CommandLineRunner: StorageException com.microsoft.azure.storage.StorageException:  (status: -3)

I would greatly appreciate any insights into what might be going on. Jack

UPDATE : While the underlying issue is unresolved for recent Windows container images, jakaruna-MSFT responded in another forum and pointed out that an older image

mcr.microsoft.com/windows/servercore:1607-KB4505052-amd64

would work, and it does. The underlying issue is apparently related to DNS services, and was either broken or omitted in transitions to more recent images. Presumably MS will get around to fixing the later images, with or without explanation.

See UPDATE above. While the underlying issue is unresolved for recent Windows container images, jakaruna- MSFT responded in another forum and pointed out that an older image mcr.microsoft.com/windows/servercore:1607-KB4505052-amd64

would work, and it does. The underlying issue is apparently related to DNS services, and was either broken or omitted in transitions to more recent images. Presumably MS will get around to fixing the later images, with or without explanation.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM