Javascript 响应mime类型不正确(应为';应用程序/wasm)PSPDFKIT,并且保留的大小不足以包含oracle apex的签名问题?

Javascript 响应mime类型不正确(应为';应用程序/wasm)PSPDFKIT,并且保留的大小不足以包含oracle apex的签名问题?,javascript,oracle-apex,Javascript,Oracle Apex,我遵循了PSPDFKit独立集成步骤,所有文件都在公共目录中(apachetomcat中的文件夹“I”) 我收到“PSPDFKit for Web已成功加载!”消息,但它挂起,控制台给我一个错误:- Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'. 当我尝试添加数字签名时,也会遇到这个问题 Cannot add the containe

我遵循了PSPDFKit独立集成步骤,所有文件都在公共目录中(apachetomcat中的文件夹“I”)

我收到“PSPDFKit for Web已成功加载!”消息,但它挂起,控制台给我一个错误:-

Failed to execute 'compile' on 'WebAssembly': Incorrect response MIME type. Expected 'application/wasm'.
当我尝试添加数字签名时,也会遇到这个问题

Cannot add the container structure because the reserved size is not enough to contain the signature. Available size 8193, actual size 89694
我尝试了以下代码

PSPDFKit.load({
        container: "#pspdfkit",
        document: 'f?p=&APP_ID.:0:&APP_SESSION.:APPLICATION_PROCESS=PREVIEW_FILE:::FILE_ID:'  + apex.item('P6_ID').getValue(),
        licenseKey: "",
    initialViewState: new PSPDFKit.ViewState({
      showSignatureValidationStatus:
        PSPDFKit.ShowSignatureValidationStatusMode.IF_SIGNED
    }),
     async trustedCAsCallback() {
    
      const response = await fetch("http://localhost:90/i/certs/ca.pem");
      const cert = await response.text();
      return [cert];
    }
})   

.then(function(instance) {
    
var item = {
  type: "custom",
  id: "my-button",
  title: "digital sign",
  onPress: function(event) {
      instance
  .signDocument(null, generatePKCS7)
  .then(() => {
    console.log("document signed.");
  })
    

  .catch(error => {
    console.error("The document could not be signed.", error);
  });

  }
};
if (app_user =="aaaa") {
instance.setToolbarItems(function(items) {
  items.push(item);
  return items;
});
}
   function generatePKCS7({ fileContents }) {
  const certificatePromise = fetch("http://localhost:90/i/certs/certificate.pem").then(response =>
    response.text()
  );
  const privateKeyPromise = fetch("http://localhost:90/i/certs/private-key.pem").then(response =>
    response.text()
  );
  return new Promise((resolve, reject) => {
    Promise.all([certificatePromise, privateKeyPromise])
      .then(([certificatePem, privateKeyPem]) => {
        const certificate = forge.pki.certificateFromPem(certificatePem);
        const privateKey = forge.pki.privateKeyFromPem(privateKeyPem);
        const p7 = forge.pkcs7.createSignedData();
        p7.content = new forge.util.ByteBuffer(fileContents);    
        p7.addCertificate(certificate);
        p7.addSigner({
          key: privateKey,
          certificate: certificate,
          digestAlgorithm: forge.pki.oids.sha256,
          authenticatedAttributes: [
            {
              type: forge.pki.oids.contentType,
              value: forge.pki.oids.data
            },
            {
              type: forge.pki.oids.messageDigest
            },
            {
              type: forge.pki.oids.signingTime,
              Value: new Date()
            }
          ]
        }
           );

        p7.sign({ detached: true })
        
        const result = stringToArrayBuffer(
          forge.asn1.toDer(p7.toAsn1()).getBytes()
        );
        resolve(result);
        
      })
      .catch(reject);
  });
}

function stringToArrayBuffer(binaryString) {
  const buffer = new ArrayBuffer(binaryString.length);
  let bufferView = new Uint8Array(buffer);
  for (let i = 0, len = binaryString.length; i < len; i++) {
    bufferView[i] = binaryString.charCodeAt(i);
  }

  return buffer;
}

})

        .catch(function(error) {
          console.error(error.message);
        })




WASM文件的内容类型似乎不正确。解决方案是修复服务器以返回正确的内容类型,或者在加载PSPDFKit时禁用WebAssembly的流式实例化,如下所述:

今后,请联系我们,我们的支持团队将在这方面为您提供帮助

apex version 19.2 
tomcat 8.5 ,
ords