- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试从 Java 存储过程使用 SOAP Web 服务,并且我使用 getOutputStream() 命令将有效负载写入连接,该连接抛出访问错误,如下所示。
Java 调用因未捕获的 Java 异常而终止:
java.security.AccessControlException:
the Permission (java.net.SocketPermission <Server-Name>:<Port> connect,resolve)
has not been granted to INFOIFACE.
The PL/SQL to grant this is dbms_java.grant_permission
( 'INFOIFACE', 'SYS:java.net.SocketPermission', <Server-Name>:<Port>, 'connect,resolve' )
但是 Oracle DB 中为架构提供了相同的访问权限,但仍然显示错误。
public class remoteConnection {
public static String connectToFPH(String destUrl, String pacFile, String cred, String payLoad) throws Exception {
System.out.println("Inside function");
BrowserProxyInfo bInfo = new BrowserProxyInfo();
bInfo.setType(ProxyType.AUTO);
bInfo.setAutoConfigURL(pacFile);
DummyAutoProxyHandler handler = new DummyAutoProxyHandler();
try {
handler.init(bInfo);
} catch (ProxyConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(cred.getBytes());
URL url = new URL(destUrl);
String proxyUrl = "";
ProxyInfo[] ps = handler.getProxyInfo(url);
for(ProxyInfo p : ps){
proxyUrl = p.toString();
}
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyUrl.split(":")[0], Integer.valueOf(proxyUrl.split(":")[1])));
HttpsURLConnection conn = (HttpsURLConnection)url.openConnection(proxy);
conn.setRequestMethod("POST");
conn.setRequestProperty ("Authorization", basicAuth);
conn.setRequestProperty("Content-Type", "text/xml; charset=UTF-8");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setAllowUserInteraction(false);
OutputStream out = conn.getOutputStream();
OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
writer.write(payLoad);
writer.close();
out.close();
String inputLine;
StringBuffer buf = new StringBuffer();
if(conn.getResponseCode() == 200)
{
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((inputLine = in.readLine()) != null)
{
buf.append(inputLine);
}
in.close();
}
else
{
//throw new Exception("Unable to connect to FPH. Please contact Administrator");
return "unable to connect";
}
conn.disconnect();
return buf.toString();
}
}
我请求这方面的帮助。 Oracle DB 中是否需要提供其他访问权限?
最佳答案
您似乎遇到了 Oracle 安全管理器。这基本上是一个由数据库表控制的经典 Java SecurityManager
:
"As with Java2 security, Oracle Database supports the security classes. Normally, you set the permissions for the code base either using a tool or by editing the security policy file. In Oracle Database, you set the permissions dynamically using DBMS_JAVA procedures, which modify a policy table in the database."
有关详细信息,请参阅:
请注意,上面的示例 10-1 显示了如何使用 DBMS_Java 授予 Java 权限。 (该示例显示了 FilePermission
授权。您将需要具有相关属性的 SocketPermission
授权。)
关于java - Java存储过程中的getOutputStream抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53718413/
我的 Controller 中有这个方法。 Whick 基本上呈现 pdf 文件。 def getUserInvoiceImage (GetInvoiceDataCommand form) {
我用谷歌搜索错误消息 getOutputStream() has already been called for this response很多人说这是因为 ,但在我的代码中,没有空格或换行符。我在
我用谷歌搜索错误消息 getOutputStream() has already been called for this response很多人说这是因为 ,但在我的代码中,没有空格或换行符。我在
这个问题已经有答案了: java.lang.IllegalStateException: getOutputStream() has already been called for this resp
我正在使用 Spring 开发一个项目,我遇到了这个问题,我用谷歌搜索了错误消息,我确实找到了解决方案,甚至所有关于这个问题的 SO 帖子也是如此 java.lang.IllegalStateExce
你好,当我尝试在程序的连接方法中使用这两行代码时,出现错误“找不到符号方法 getOutputStream()” 我不知道我做错了什么,这是代码 socket = new ServerSocket(6
我用谷歌搜索错误信息 getOutputStream() has already been called for this response很多人说是因为 ,但在我的代码中,没有空格或换行符。我在li
我正在编写一个 java 代码来将 POST 请求发送到 URL,但它卡在粗体指示的行上。我在 Android 模拟器上运行这个 URL url = new URL("htt HttpURLConne
来自此链接“Writing to the OutputStream of Java Process/ProcessBuilder as pipe”并进行研究,我没有找到指定从 getOutputStr
我正在使用 jssc 库通过串行端口与设备进行通信。在标准 java SerialComm 库中有两个方法 getInputStream() 和 getOutputStream()。 为什么我需要这个
我正在尝试构建将数据发布到node.js服务器的java应用程序。 在 Node.js 中处理帖子的代码如下: app.post('/login.html', function (req, res)
我有一个想要测试的servlet。我想测试 Mockito 的 doGet。在来自 srvlet 的主代码信息中,通过 PrintWriter 转到页面/json。在我的测试中,我想要一个包含测试信息
我正在为我们的 Android 设备创建一个应用程序。本节的目的是将用户名和密码(当前仅分配为字符串)发布到 Web 服务并接收登录 token 。当运行代码时,在 getOutputStream()
我正在尝试从 MySQL-DB 下载 pdf(我将其作为 Blob 获取,到目前为止一切正常。但是当我尝试让 ServletOutputstream 将其发送到客户端时,程序崩溃。 AFAIK 当该方
所以我从 GUI 启动 Bukkit (Minecraft) 服务器。 ProcessBuilder builder = new ProcessBuilder(); builder.redirectE
我在 Windows 机器上使用 gzip 实用程序。我压缩了一个文件并作为 blob 存储在数据库中。当我想使用 gzip 实用程序解压缩此文件时,我将此字节流写入 process.getOutpu
我知道还有许多其他帖子处理同样的错误,但所有这些帖子要么是关于 JSP/GSP 页面的,要么是出于任何其他原因,对我的情况不是很有帮助。我将 Spring MVC 与 Thymeleaf 一起使用。以
一个问题 以为例 DataOutputStream output= new DataOutputStream(clientSocket.getOutputStream()) ; 或 DataInput
我正在使用 Spring @RestController 并以 Json 格式发送响应。这工作正常,但我需要向记录器发送响应,所以我已经实现了 Spring 的 HandlerInterceptor
Socket socket = sslSocketFactory.createSocket(); socket.connect(new InetSocketAddress(hostname, port
我是一名优秀的程序员,十分优秀!