スタンドアロンで実行しているときに既存のAzureストレージアカウントにコンテナを正常に作成するテスト用の非常に簡単なスプリングブートプロジェクトがあります。しかし、WebLogic 12cサーバーにデプロイすると、インターネットで見つけられないエラーで失敗します。WeblogicにデプロイするときにAzureストレージコンテナを作成できない12c
proyectには、コントローラ、アプリケーション、weblogic.xml、およびpom.xmlがあります。それをローカルで実行すると、アカウントの接続文字列(アカウントキー付き)とコンテナの名前を持つコンテナが作成されます。ここで
はControllerクラスのコードです:
package com.example;
import java.io.IOException;
import java.net.URISyntaxException;
import java.security.InvalidKeyException;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.microsoft.azure.storage.CloudStorageAccount;
import com.microsoft.azure.storage.StorageException;
import com.microsoft.azure.storage.blob.CloudBlobClient;
import com.microsoft.azure.storage.blob.CloudBlobContainer;
@RestController
public class DemoController {
@RequestMapping(value = "/createAzureContainer", method = RequestMethod.GET)
void createAzureContainer()
throws URISyntaxException, StorageException, IOException, InvalidKeyException {
CloudStorageAccount storageAccount =
CloudStorageAccount.parse("DefaultEndpointsProtocol=https;" +
"AccountName=[accountName];AccountKey=[accountKey]");
CloudBlobClient blobClient = storageAccount.createCloudBlobClient();
CloudBlobContainer container = blobClient.getContainerReference("[containerName]");
container.createIfNotExists();
container.downloadAttributes();
}
}
およびアプリケーション・クラスのコード:
package com.example;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.web.WebApplicationInitializer;
@ComponentScan
@SpringBootApplication
public class DemoApplication extends SpringBootServletInitializer
implements WebApplicationInitializer {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(DemoApplication.class);
}
}
これは、SRC /メイン/ webappの/にあり、weblogic.xmlのですWEB-INF:
<?xml version="1.0" encoding="UTF-8"?>
<wls:weblogic-web-app xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.oracle.com/weblogic/weblogic-web-app http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
<wls:context-root>demo</wls:context-root>
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.slf4j.*</wls:package-name>
<wls:package-name>org.springframework.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>
</wls:weblogic-web-app>
そして最後の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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>demo</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.2.RELEASE</version>
<relativePath/>
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.microsoft.azure</groupId>
<artifactId>azure-storage</artifactId>
<version>5.0.0</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifest>
<addDefaultImplementationEntries>false</addDefaultImplementationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
Azureストレージアカウントを持つ誰でも、スタンドアローンを実行してコンテナを作成しようとすることができます。が、WebLogic 12cに次の行を展開するとき:
container.createIfNotExists();
はブロブをアップロードするときに持っていることの問題のように私に聞こえる次の例外、と失敗しますが、中にそれについてのすべての参照を見つけることができませんコンテナに関するインターネット検索:
com.microsoft.azure.storage.StorageException: The server encountered an unknown failure: Length Required
at com.microsoft.azure.storage.StorageException.translateException(StorageException.java:101) ~[azure-storage-5.0.0.jar:na]
at com.microsoft.azure.storage.core.StorageRequest.materializeException(StorageRequest.java:305) ~[azure-storage-5.0.0.jar:na]
at com.microsoft.azure.storage.core.ExecutionEngine.executeWithRetry(ExecutionEngine.java:175) ~[azure-storage-5.0.0.jar:na]
at com.microsoft.azure.storage.blob.CloudBlobContainer.create(CloudBlobContainer.java:261) ~[azure-storage-5.0.0.jar:na]
at com.microsoft.azure.storage.blob.CloudBlobContainer.createIfNotExists(CloudBlobContainer.java:385) ~[azure-storage-5.0.0.jar:na]
at com.microsoft.azure.storage.blob.CloudBlobContainer.createIfNotExists(CloudBlobContainer.java:326) ~[azure-storage-5.0.0.jar:na]
at com.example.DemoController.createAzureContainer(DemoController.java:66) ~[_wl_cls_gen.jar:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:116) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) ~[javax.servlet.javax.servlet-api.jar:3.1.0]
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[javax.servlet.javax.servlet-api.jar:3.1.0]
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:286) ~[com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.StubSecurityHelper$ServletServiceAction.run(StubSecurityHelper.java:260) ~[com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.StubSecurityHelper.invokeServlet(StubSecurityHelper.java:137) ~[com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:350) ~[com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.TailFilter.doFilter(TailFilter.java:25) ~[com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197) ~[spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:115) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.web.support.ErrorPageFilter.access$000(ErrorPageFilter.java:59) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.boot.web.support.ErrorPageFilter$1.doFilterInternal(ErrorPageFilter.java:90) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107) [spring-web-4.3.7.RELEASE.jar:4.3.7.RELEASE]
at org.springframework.boot.web.support.ErrorPageFilter.doFilter(ErrorPageFilter.java:108) [spring-boot-1.5.2.RELEASE.jar:1.5.2.RELEASE]
at weblogic.servlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:78) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.wrapRun(WebAppServletContext.java:3683) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3649) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:326) [com.oracle.weblogic.security.subject.jar:12.2.1.2]
at weblogic.security.service.SecurityManager.runAsForUserCode(SecurityManager.java:197) [com.oracle.weblogic.security.subject.jar:12.2.1.2]
at weblogic.servlet.provider.WlsSecurityProvider.runAsForUserCode(WlsSecurityProvider.java:203) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.provider.WlsSubjectHandle.run(WlsSubjectHandle.java:71) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppServletContext.doSecuredExecute(WebAppServletContext.java:2433) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:2281) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:2259) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.ServletRequestImpl.runInternal(ServletRequestImpl.java:1691) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1651) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.servlet.provider.ContainerSupportProviderImpl$WlsRequestExecutor.run(ContainerSupportProviderImpl.java:270) [com.oracle.weblogic.servlet.jar:12.2.1.2]
at weblogic.invocation.ComponentInvocationContextManager._runAs(ComponentInvocationContextManager.java:348) [com.bea.core.utils.full.jar:12.2.1.2]
at weblogic.invocation.ComponentInvocationContextManager.runAs(ComponentInvocationContextManager.java:333) [com.bea.core.utils.full.jar:12.2.1.2]
at weblogic.work.LivePartitionUtility.doRunWorkUnderContext(LivePartitionUtility.java:54) [com.oracle.weblogic.work.jar:12.2.1.2]
at weblogic.work.PartitionUtility.runWorkUnderContext(PartitionUtility.java:41) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
at weblogic.work.SelfTuningWorkManagerImpl.runWorkUnderContext(SelfTuningWorkManagerImpl.java:640) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
at weblogic.work.ExecuteThread.execute(ExecuteThread.java:406) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
at weblogic.work.ExecuteThread.run(ExecuteThread.java:346) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]
ご協力いただきありがとうございます。
私はこの問題が、Microsoft Azure Javaライブラリと、** weblogic.net.http.SOAPHttpsURLConnection **の代わりに、** HttpURLConnection **クラスのwebLogicの実装との間に互換性がないことに気付きましたTomcat ** sun.net.www.protocol.https.DelegateHttpsURLConnection **から。 前者には** Content-Length **がなく、エラーが発生します。 サーバーの開始パラメータ** - DUseSunHttpHandler = true **を使用して、その実装を使用するようにwebLogicを取得しようとしました。 –