How do I configure log4j per deployed application in Glassfish 3?

I'm trying to use log4j to handle the logs for a web-service which is running under Glassfish 3. Most of the guides I've seen using log4j with Glassfish want me to mess around with Glassfish global settings, which I want to avoid as there will be more than one application deployed per instance of Glassfish. Is there any way for me to have Glassfish execute a piece of code when my web se

如何在Glassfish 3中为每个部署的应用程序配置log4j?

我正在尝试使用log4j来处理在Glassfish 3下运行的Web服务的日志。我在Glassfish中使用log4j时看到的大多数指南都希望我能够解决Glassfish全局设置,这是我想要避免的因为每个Glassfish实例都会部署多个应用程序。 有没有什么办法让我Glassfish在部署Web服务时执行一段代码,这将允许我使用XML文件调用DOMConfigurator并设置log4j? 谢谢你的帮助! 编辑:答案是将log4j.xml文件放在WEB-INF / classes中。 在我们的例子中

method and function overloads in javascript and jquery

Can I use method and function overload in java-script and JQuery, if possible it means how to do that. I have developed following code, but I think that is wrong, what's my error I don't know that, please clarify that function isnull(txtid, errid, err) { if (trimString(get(txtid).value) == '') { return false; } return true; } function

方法和函数重载在JavaScript和jQuery中

我可以在java-script和JQuery中使用方法和函数重载,如果可能的话,它意味着如何做到这一点。 我开发了以下代码,但我认为这是错误的,我的错误我不知道,请澄清一下 function isnull(txtid, errid, err) { if (trimString(get(txtid).value) == '') { return false; } return true; } function isnull(txtid) { if (trimString(get(txtid).value) == '') {

BufferedImage to Bytes Java

I am trying to get the bytearray from a bufferedImage but the length of my ByteArrayOutputstream is always zero and I get no bytes. This is what I am doing any ideas why this is not working BufferedImage scaledPicture = ..... ByteArrayOutputStream baos = new ByteArrayOutputStream( ); ImageIO.write(scaledPicture, extension, baos); baos.flush(); byte[] toByteArray = baos.toByteArray(); baos.cl

BufferedImage字节Java

我试图从bufferedImage获取bytearray,但ByteArrayOutputstream的长度始终为零,并且没有字节。 这就是我正在做的 任何想法,为什么这是行不通的 BufferedImage scaledPicture = ..... ByteArrayOutputStream baos = new ByteArrayOutputStream( ); ImageIO.write(scaledPicture, extension, baos); baos.flush(); byte[] toByteArray = baos.toByteArray(); baos.close(); return toByteArray; 有任何想法吗? ImageIO.

Lucene 3.0.3 does not delete document

We use Lucene to index some internal documents. Sometimes we need to remove documents. These documents have an unique id and are represented by a class DocItem as follows (ALL THE CODE IS A SIMPLIFIED VERSION WITH ONLY SIGNIFICANT (I hope) PARTS): public final class DocItem { public static final String fID = "id"; public static final String fTITLE = "title"; private Document doc = new

Lucene 3.0.3不会删除文件

我们使用Lucene来索引一些内部文档。 有时我们需要删除文件。 这些文件有一个唯一的id,并且由一个DocItem类表示如下(所有的代码都是一个简化的版本,只有重要的(我希望)部分): public final class DocItem { public static final String fID = "id"; public static final String fTITLE = "title"; private Document doc = new Document(); private Field id = new Field(fID, "", Field.Store.YES, Field.Ind

Reusing Queries in Hibernate

I use HQL queries in Hibernate, and just wondered, if I could increase the preformance of my app reusing queries. Usually you have to create a new Query object for each session: Session session; Query q1 = session.createQuery("select a from Article a where id=:id"); q1.setInteger("id",123); List result = q1.list(); Now I have relatively complex queries in HQL, which I don't want to have p

在Hibernate中重用查询

我在Hibernate中使用HQL查询,只是想知道,如果我可以提高我的应用程序重用查询的性能。 通常你必须为每个会话创建一个新的Query对象: Session session; Query q1 = session.createQuery("select a from Article a where id=:id"); q1.setInteger("id",123); List result = q1.list(); 现在我在HQL中有相对复杂的查询,我不想一遍又一遍地分析。 有没有办法在另一个会话中创建查询并重用它? 喜欢这个: Session session;

How to use dependent style names together with the CssResource obfuscation?

I access the style names through CssResource, either from the UiBinder and from the java views. The problem is I cannot find a way to add and remove suffixes due to the class names obfuscation. By the moment I've managed the situation using @external anotation on the primary and dependent names, but I don't consider is a good solution. I think you're right that the dependent styl

如何将依赖样式名称与CssResource混淆一起使用?

我通过CssResource从UiBinder和java视图中访问样式名称。 问题是我无法找到一种方法来添加和删除由于类名混淆而产生的后缀。 到目前为止,我已经使用主外部名称和附属名称的@外部诠释来管理情况,但我认为这不是一个好的解决方案。 我认为你是正确的依赖风格不能与CssResources一起工作,但你可以通过分层样式获得类似的效果,比如 .widgetStyle .error { color: red; } 然后应用style.widgetStyle和style.error,而不

Changing the icon shown in a taskbar group for a multi window application

On Windows 7 an application can control how to group their Windows on the taskbar. Windows has some default settings related to the executable, how the shortcut was created, the name of the program, etc. to apply some default grouping. The problem with host based applications like Java, is that the same executable is used by many programs so Windows has some registry settings to set that javaw.

更改多窗口应用程序的任务栏组中显示的图标

在Windows 7上,应用程序可以控制如何在任务栏上将Windows分组。 Windows有一些与可执行文件相关的默认设置,如何创建快捷方式,程序名称等,以应用某些默认分组。 基于主机的应用程序(如Java)的问题是许多程序使用相同的可执行文件,因此Windows有一些注册表设置来设置javaw.exe是主机应用程序。 发生这种情况时,应用程序必须在运行时配置如何对Windows进行分组并启用引脚到任务栏。 我已经设置了应用程序用户模型ID,以

agents not working in uberjar

In my Leiningen project I have the following config: :java-agents [[com.newrelic.agent.java/newrelic-agent "3.19.2"]] When running my app as in lein repl the agent is being run, but when I create the uberjar and run it like: java -jar target/proclodo-spa-server-rendering.jar the agent is not started. I could include newrelic-agent.jar in my uberjar and pass the -javaagent argument, but I'

代理不在uberjar工作

在我的Leiningen项目中,我有以下配置: :java-agents [[com.newrelic.agent.java/newrelic-agent "3.19.2"]] 当运行我的应用程序,如lein repl代理正在运行,但是当我创建uberjar并运行它,如: java -jar target/proclodo-spa-server-rendering.jar 该代理程序未启动。 我可以在我的uberjar中包含newrelic-agent.jar并传递-javaagent参数,但我试图避免在我的存储库中存在大量不会自动升级的大型二进制Blob(为什么New Re

Java Generate Soap Envelop Message With Same Element Name With Different Type

I am new to web services. i am writing soap web services. Below is my bean structure which i wrote in web service. @XmlRootElement(name="processRequest") @XmlAccessorType(value=XmlAccessType.FIELD) public class RequestDO { @XmlElement(name="command", type=Common.class) private List<Common> commonList = null; @XmlElement(name="command",type=Output.class) private List<

使用不同类型的Java生成包含相同元素名称的Soap Envelo消息

我对web服务很陌生。 我正在写soap web服务。 下面是我在web服务中写的我的bean结构。 @XmlRootElement(name="processRequest") @XmlAccessorType(value=XmlAccessType.FIELD) public class RequestDO { @XmlElement(name="command", type=Common.class) private List<Common> commonList = null; @XmlElement(name="command",type=Output.class) private List<Output> outputList = null;

Namespace for root element & element Ref name issue

I have couple simple questions regarding JAXB marshaling. I am trying to marshal a class containing the following fields: @XmlElementRef(name = "AlternateVerificationKeys", namespace = "http://schemas.microsoft.com/Azure/MediaServices/KeyDelivery/TokenRestrictionTemplate/v1", type = JAXBElement.class, required = false) protected JAXBElement<ArrayOfTokenVerificationKey> alternateVerificati

根元素和元素参考名称问题的命名空间

我有几个关于JAXB编组的简单问题。 我试图编组包含以下字段的类: @XmlElementRef(name = "AlternateVerificationKeys", namespace = "http://schemas.microsoft.com/Azure/MediaServices/KeyDelivery/TokenRestrictionTemplate/v1", type = JAXBElement.class, required = false) protected JAXBElement<ArrayOfTokenVerificationKey> alternateVerificationKeys; @XmlElement(name = "Audience", required = true, nil