java - Creating Azure storage container fails when deploying on weblogic 12c -


i have simple spring boot project testing creates container in existing azure storage account when running standalone. when deployed in weblogic 12c server fails error can't find on internet.

the proyect has controller, application, weblogic.xml , pom.xml, nothing more. when running locally works perfectly, creating container connection string of account (with de account key) , name of container.

here code of controller class:

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();     } } 

and code of application class:

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);     } } 

this weblogic.xml, located in src/main/webapp/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> 

and 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> 

with azure storage account can try run standalone , create containers. when deploying weblogic 12c following line:

        container.createifnotexists(); 

fails following exception, sounds me problem may have when uploading blob, can't find reference in internet searching containers:

com.microsoft.azure.storage.storageexception: server encountered unknown failure: length required     @ com.microsoft.azure.storage.storageexception.translateexception(storageexception.java:101) ~[azure-storage-5.0.0.jar:na]     @ com.microsoft.azure.storage.core.storagerequest.materializeexception(storagerequest.java:305) ~[azure-storage-5.0.0.jar:na]     @ com.microsoft.azure.storage.core.executionengine.executewithretry(executionengine.java:175) ~[azure-storage-5.0.0.jar:na]     @ com.microsoft.azure.storage.blob.cloudblobcontainer.create(cloudblobcontainer.java:261) ~[azure-storage-5.0.0.jar:na]     @ com.microsoft.azure.storage.blob.cloudblobcontainer.createifnotexists(cloudblobcontainer.java:385) ~[azure-storage-5.0.0.jar:na]     @ com.microsoft.azure.storage.blob.cloudblobcontainer.createifnotexists(cloudblobcontainer.java:326) ~[azure-storage-5.0.0.jar:na]     @ com.example.democontroller.createazurecontainer(democontroller.java:66) ~[_wl_cls_gen.jar:na]     @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) ~[na:1.8.0_121]     @ sun.reflect.nativemethodaccessorimpl.invoke(nativemethodaccessorimpl.java:62) ~[na:1.8.0_121]     @ sun.reflect.delegatingmethodaccessorimpl.invoke(delegatingmethodaccessorimpl.java:43) ~[na:1.8.0_121]     @ java.lang.reflect.method.invoke(method.java:498) ~[na:1.8.0_121]     @ org.springframework.web.method.support.invocablehandlermethod.doinvoke(invocablehandlermethod.java:205) ~[spring-web-4.3.7.release.jar:4.3.7.release]     @ org.springframework.web.method.support.invocablehandlermethod.invokeforrequest(invocablehandlermethod.java:133) ~[spring-web-4.3.7.release.jar:4.3.7.release]     @ org.springframework.web.servlet.mvc.method.annotation.servletinvocablehandlermethod.invokeandhandle(servletinvocablehandlermethod.java:116) ~[spring-webmvc-4.3.7.release.jar:4.3.7.release]     @ org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter.invokehandlermethod(requestmappinghandleradapter.java:827) ~[spring-webmvc-4.3.7.release.jar:4.3.7.release]     @ org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter.handleinternal(requestmappinghandleradapter.java:738) ~[spring-webmvc-4.3.7.release.jar:4.3.7.release]     @ org.springframework.web.servlet.mvc.method.abstracthandlermethodadapter.handle(abstracthandlermethodadapter.java:85) ~[spring-webmvc-4.3.7.release.jar:4.3.7.release]     @ org.springframework.web.servlet.dispatcherservlet.dodispatch(dispatcherservlet.java:963) ~[spring-webmvc-4.3.7.release.jar:4.3.7.release]     @ org.springframework.web.servlet.dispatcherservlet.doservice(dispatcherservlet.java:897) ~[spring-webmvc-4.3.7.release.jar:4.3.7.release]     @ org.springframework.web.servlet.frameworkservlet.processrequest(frameworkservlet.java:970) ~[spring-webmvc-4.3.7.release.jar:4.3.7.release]     @ org.springframework.web.servlet.frameworkservlet.doget(frameworkservlet.java:861) ~[spring-webmvc-4.3.7.release.jar:4.3.7.release]     @ javax.servlet.http.httpservlet.service(httpservlet.java:687) ~[javax.servlet.javax.servlet-api.jar:3.1.0]     @ org.springframework.web.servlet.frameworkservlet.service(frameworkservlet.java:846) ~[spring-webmvc-4.3.7.release.jar:4.3.7.release]     @ javax.servlet.http.httpservlet.service(httpservlet.java:790) ~[javax.servlet.javax.servlet-api.jar:3.1.0]     @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:286) ~[com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.internal.stubsecurityhelper$servletserviceaction.run(stubsecurityhelper.java:260) ~[com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.internal.stubsecurityhelper.invokeservlet(stubsecurityhelper.java:137) ~[com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.internal.servletstubimpl.execute(servletstubimpl.java:350) ~[com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.internal.tailfilter.dofilter(tailfilter.java:25) ~[com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:78) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ org.springframework.web.filter.requestcontextfilter.dofilterinternal(requestcontextfilter.java:99) ~[spring-web-4.3.7.release.jar:4.3.7.release]     @ org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter.java:107) [spring-web-4.3.7.release.jar:4.3.7.release]     @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:78) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ org.springframework.web.filter.httpputformcontentfilter.dofilterinternal(httpputformcontentfilter.java:105) ~[spring-web-4.3.7.release.jar:4.3.7.release]     @ org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter.java:107) [spring-web-4.3.7.release.jar:4.3.7.release]     @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:78) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ org.springframework.web.filter.hiddenhttpmethodfilter.dofilterinternal(hiddenhttpmethodfilter.java:81) ~[spring-web-4.3.7.release.jar:4.3.7.release]     @ org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter.java:107) [spring-web-4.3.7.release.jar:4.3.7.release]     @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:78) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ org.springframework.web.filter.characterencodingfilter.dofilterinternal(characterencodingfilter.java:197) ~[spring-web-4.3.7.release.jar:4.3.7.release]     @ org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter.java:107) [spring-web-4.3.7.release.jar:4.3.7.release]     @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:78) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ org.springframework.boot.web.support.errorpagefilter.dofilter(errorpagefilter.java:115) [spring-boot-1.5.2.release.jar:1.5.2.release]     @ org.springframework.boot.web.support.errorpagefilter.access$000(errorpagefilter.java:59) [spring-boot-1.5.2.release.jar:1.5.2.release]     @ org.springframework.boot.web.support.errorpagefilter$1.dofilterinternal(errorpagefilter.java:90) [spring-boot-1.5.2.release.jar:1.5.2.release]     @ org.springframework.web.filter.onceperrequestfilter.dofilter(onceperrequestfilter.java:107) [spring-web-4.3.7.release.jar:4.3.7.release]     @ org.springframework.boot.web.support.errorpagefilter.dofilter(errorpagefilter.java:108) [spring-boot-1.5.2.release.jar:1.5.2.release]     @ weblogic.servlet.internal.filterchainimpl.dofilter(filterchainimpl.java:78) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.internal.webappservletcontext$servletinvocationaction.wraprun(webappservletcontext.java:3683) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.internal.webappservletcontext$servletinvocationaction.run(webappservletcontext.java:3649) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.security.acl.internal.authenticatedsubject.doas(authenticatedsubject.java:326) [com.oracle.weblogic.security.subject.jar:12.2.1.2]     @ weblogic.security.service.securitymanager.runasforusercode(securitymanager.java:197) [com.oracle.weblogic.security.subject.jar:12.2.1.2]     @ weblogic.servlet.provider.wlssecurityprovider.runasforusercode(wlssecurityprovider.java:203) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.provider.wlssubjecthandle.run(wlssubjecthandle.java:71) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.internal.webappservletcontext.dosecuredexecute(webappservletcontext.java:2433) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.internal.webappservletcontext.securedexecute(webappservletcontext.java:2281) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.internal.webappservletcontext.execute(webappservletcontext.java:2259) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.internal.servletrequestimpl.runinternal(servletrequestimpl.java:1691) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.internal.servletrequestimpl.run(servletrequestimpl.java:1651) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.servlet.provider.containersupportproviderimpl$wlsrequestexecutor.run(containersupportproviderimpl.java:270) [com.oracle.weblogic.servlet.jar:12.2.1.2]     @ weblogic.invocation.componentinvocationcontextmanager._runas(componentinvocationcontextmanager.java:348) [com.bea.core.utils.full.jar:12.2.1.2]     @ weblogic.invocation.componentinvocationcontextmanager.runas(componentinvocationcontextmanager.java:333) [com.bea.core.utils.full.jar:12.2.1.2]     @ weblogic.work.livepartitionutility.dorunworkundercontext(livepartitionutility.java:54) [com.oracle.weblogic.work.jar:12.2.1.2]     @ weblogic.work.partitionutility.runworkundercontext(partitionutility.java:41) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]     @ weblogic.work.selftuningworkmanagerimpl.runworkundercontext(selftuningworkmanagerimpl.java:640) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]     @ weblogic.work.executethread.execute(executethread.java:406) [com.bea.core.weblogic.workmanager.jar:12.2.1.2]     @ weblogic.work.executethread.run(executethread.java:346) [com.bea.core.weblogic.workmanager.jar:12.2.1.2] 

any appreciated, time.

according error information & azure storage offical error codes, issue caused missing content-length header, please see below.

enter image description here

you can try use fiddler check error code 411 & response make sure issue reason when exception happened.

per exception, think weblogic server caused missing content-length header issue. searched , discovered weblogic server use strategies backward-compatibility use own implementation standard jax-rs, jax-prc, etc.

so think can try refer oracle offical document invoking web services client applications , weblogic server & fusion middleware developing , securing restful web services oracle weblogic server 12.1.3 resolve issue.

some solutions think may resolving it.

  1. according document 1, trying add code below.

    // setup global jax-rpc service factory system.setproperty( "javax.xml.rpc.servicefactory", "weblogic.webservice.core.rpc.servicefactoryimpl"); 
  2. try configuring web application use jersey 2.5.1 (jax-rs 2.0 ri).

  3. try refer developing restful web service clients change or setup code.

hope helps.


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -