java-ee

finalize method in MessageDrivenBean

安稳与你 提交于 2019-12-24 14:12:32
问题 Message-Driven Bean Class the requirements of a message-driven bean class: It must not define the finalize method. What is the reason for above requirement ? 回答1: If you look in the EJB spec, you will see that it is a requirement for all types of EJB. http://download.oracle.com/otndocs/jcp/ejb-3.1-pfd-oth-JSpec/ I can't find a definitive answer but looking on various Java forums over the last 13 years, you can see answers consistently saying that, because the container will decide the life

Properties file as init-param in web.xml

纵饮孤独 提交于 2019-12-24 14:05:55
问题 I am migrating a Jsp-servlet based Java project that was hosted in websphere to tomcat. Following init-param is in web.xml inside a filter definition. I moved the properties file src folder which is classpath. How to change the following in the web.xml. Can I define properties file as init-param because most of the answers I saw has used context-param to define properties file. I dont think its an option to me as the existing application needs the properties file to be init-param. <init-param

JSF <h:inputText> / <h:outputText> not rendering according to boolean value

雨燕双飞 提交于 2019-12-24 13:53:58
问题 I have a <h:dataTable> that is populated from an Entity class and displays different products. I want to be able to click a <h:commandLink> and edit row that the link belongs to. I have structured it mostly the same way as this nice example and article at mkyong. The table (with some columns excluded): <h:form> <h:dataTable id="gnomeTable" value="#{gnome.productList}" var="item" styleClass="gnomeTable" headerClass="gnomeTableHeader" rowClasses="gnomeTableOddRow,gnomeTableEvenRow" bgcolor="

Links to network drive doesn't work in standalone Tomcat, but works in Eclipse+Tomcat

夙愿已清 提交于 2019-12-24 13:49:43
问题 I'm trying to create hyperlinks to open files from network drive G: (more details here). G: is mapped as network drive. When I deploy the WAR on Tomcat server integrated to Eclipse, it works . When I deploy it on the same but standalone Tomcat itself, it doesn't work I've tried: Run Tomcat as Domain Admin , which has an access to the location, but without success . Run it as Local user , but check the box Allow service to interact with desktop . Also without success . What's the difference in

Dozer Singleton Startup Bean injetced as Null

ぐ巨炮叔叔 提交于 2019-12-24 13:26:25
问题 I have created an instatiator bean for Dozer (http://dozer.sourceforge.net/). But when I Inject this EJB it throws nullpointer exception. Here is my Singleton Startup Bean for intialising Dozer package com.unijunction.ordercloud.common.rest; import javax.annotation.PostConstruct; import javax.annotation.PreDestroy; import javax.inject.Singleton; import javax.ejb.Startup; import org.dozer.DozerBeanMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @Startup @Singleton public class

Simple database-based instance synchronization

*爱你&永不变心* 提交于 2019-12-24 12:25:46
问题 I'm working on a service that runs in a java app server farm that needs to do some periodic jobs (say, once every 2 minutes). The service must interface to external entities, and it is necessary to synchronize the different instances so that only one of them works on the job at a given time. Since the service uses a DB during this job, I thought of implementing the synchronization based on a simple DB table: id, owner, stamp where id is the lock's id, owner is the current owner and stamp is

Lazy Loading error

余生颓废 提交于 2019-12-24 12:05:06
问题 I know that this issue was already raised here several time. However I couldn't find any solution which will help so I decided to post it again. I'm using Hibernate with Spring MVC framework and I'm trying to fetch my class wth sub class: public class Scene implements Serializable{ private Long id; private Author author; //omitting getters and setters } public class Author{ private Long id; Private String name; //omitting getters and setters } My Hibernate configuration is the following:

Unable to load class [com.sun.jmx.mbeanserver.RepositorySupport] to check against the @HandlesTypes

橙三吉。 提交于 2019-12-24 11:20:26
问题 after migrating to tomcat 7.0.22 and installing t7mp ( tomcat 7 plugin from google code ) i am running on maven 2 btw when trying to run mvn t7:run , i got the following exception: WARNING: Unable to load class [com.sun.jmx.mbeanserver.MBeanInstantiatorImpl] to check against the @HandlesTypes annotation of one or more ServletContentInitializers. java.lang.IncompatibleClassChangeError: Implementing class at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader

Subresouce and CDI Injection Issue

孤人 提交于 2019-12-24 11:19:04
问题 I am new to jax-rs and i am stuck with subresources. Take a look. this is not working @Path(..) public class Test { @Path(...) public SubResource getSub(){ return new SubResource(); } } public class SubResource { @Inject private MyBean myBean; @GET public String getStr(){ return myBean.getStr(); // myBean is null, injection didnt work properly } this works, but why???? @Path(..) public class Test { @Context private ResourceContext context; @Path(...) public SubResource getSub(){ return

JPA entity classes residing in a Wildfly module are not scanned

走远了吗. 提交于 2019-12-24 11:06:15
问题 I have some JPA entity classes residing in a Wildfly module. Although there are entity classes in this module, there's no JPA deployment descriptor (persistence.xml file) in the module. Here's the complete path of the module: {Wildfly_installation}/modules/system/layers/base/br/edu/ufca/main/ufca.jar The module descriptor (located in the same folder): <?xml version="1.0" encoding="UTF-8"?> <module xmlns="urn:jboss:module:1.3" name="br.edu.ufca"> <resources> <resource-root path="ufca.jar"/> <