English 中文(简体)
Java EE方案人员没有书写文件
原标题:Java EE programmers do not write to files

今天,有人告诉我,Java EE方案制定者没有写到文件。 为什么我不能在 Java EE集装箱内(例如来自JBos的)提交档案? 什么是错的?

最佳回答
问题回答

页: 1 本人:你无法肯定你会随时接触档案系统。 造成这种情况的原因很多,最明显的是,集装箱内的应用将:

  • no certainty that any subsequent invocation of an EJB would even be on the same physical server with access to the same files/filesystem (e.g. upon clustering)
  • no possibility of interfering with each other (multiple applications attempting to write to the same file)
  • no security issues (one app writing confidential data which another app could read)

您还应假设:you ben t:

  • create your own threads (the container will manage this for you; if you create your own you may starve other applications in the container of CPU time)
  • use socket-IO (also has security issues)

即便你能够进入档案系统,只要有分发的系统,你就一定会确保今后使用一种方法,在文件撰写的同一机器上处理。

每 Java EE规格中,EJBs严格禁止通过“资源经理”以外的任何手段获得任何外部资源,这尤其包括通过<代码>java.io的包裹进入当地档案系统。 此外,也不得使用<条码>ClassLoader进入,例如从申请类别中装载财产档案。

在其他答复中已经提出了这样做的理由:

  • Security issues
  • Portability issues
  • Clustering issues
  • Threading issues

最后,这些事项的最佳资源是数据库。

如果你的情况没有分类,或能够保证所有情况都能使用网络驱动力,那么,它就不是将档案复印机用于读/篡改档案的问题。 然而,必须注意正确的道路,酌情加以清理。 往往没有必要再写书面文件,以便再次思考。 多数人给出的主要理由是,在一组服务器中,不同的服务器在同一个档案中看到了变化,因此也出现了变化。 归根结底,大多数小型机械师在这种组群中运行......

由于Java EE的光谱不提供书写档案的预报。 当然,你只能利用Java IO 2008/6号普通文件来制作档案,但你必须保证该法典已经安全,有人清理档案,将档案名字传给下一位星,在贵爱者被移至该组的另一点时,档案已经迁移。

因此,尽管你能够这样做,但实际上,你遇到了许多小问题,这些问题使得在 JavaE处理档案的工作确实难以解决。

为了与遗留的非杰2人系统进行互动,你有时不得不做“坏事”,如一/一、一、二、三、三等。 在世界上最好的地方,将严格遵循吉卜赛人的幽灵,但是,为了权宜之计,人们完全放弃非吉卜赛人。 有一些办法可以安全、周密地把这些东西推走。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签