java-ee

Choose EJB to be injected without recompiling

北城余情 提交于 2019-12-18 08:45:30
问题 Imagine you have two implementations of a @Local interface @Local public interface LocalInterface { } @Stateless public class MyFirstImplementation implements LocalInterface { } @Stateless public class MySecondImplementation implements LocalInterface { } And I want to choose, without recompiling the project (that is, at runtime or using an external configuration property) which one (MyFirstImplementation or MySecondImplementation) I want to use. public class MyClass { @EJB LocalInterface

Can you render a file without a .jsp extension as a JSP?

梦想的初衷 提交于 2019-12-18 07:40:13
问题 Is it possible to tell a standard Java EE servlet container to interpret and render a file as a JSP even if it doesn't have a .jsp extension? Say I have a file called foo.xyz in the root directory of my WAR. This file contains some jstl logic as you would expect in a .jsp file. If I request http://myserver/myapp/foo.xyz I'm going to see the literal code from that file rendered as text. Is there a way to configure the web app such that it renders the file using the JSP interpreter without

How does Gradle resolve the javaee-api dependency to build an EAR?

蓝咒 提交于 2019-12-18 07:24:39
问题 I see that there's an EAR plugin for Gradle. How is it used to build an EAR ? Yes, there's an ear task. To build an EAR with an EJB module there's a dependency on java-ee. How is that dependency resolved? https://virgo47.wordpress.com/2015/05/13/why-gradle-doesnt-provide-provided/ http://www.lordofthejars.com/2015/10/gradle-and-java-ee.html http://www.adam-bien.com/roller/abien/entry/the_only_one_dependency_you I don't mind reading the fine manual -- just please specify a chapter at least

Portable JNDI Syntax lookup for EJB on Glassfish

为君一笑 提交于 2019-12-18 07:23:19
问题 Previous attempts were to have Netbeans deploy an EJB module, which builds as a JAR rather than an EAR, onto the Glassfish server which Netbeans has access to. However, deploying that JAR to Glassfish through the CLI with asadmin possibly runs into a bug. The EAR deploys through the CLI without issue -- however, the JNDI names for the EJB doesn't appear to work. What is the discrepancy? 32.4.1.1 Portable JNDI Syntax Three JNDI namespaces are used for portable JNDI lookups: java:global, java

Primefaces Login Application [duplicate]

感情迁移 提交于 2019-12-18 07:22:35
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: JSF HTTP Session Login I am using Primefaces to implement my web application. In my implementation the user can log in to the system, then they can load the redirected pages again by copying that URL without login again. How can I prevent this? Here is my login logic: public String doLogin() { if(username != null && username.equals("admin") && password != null && password.equals("admin")) { msg = "table?faces

Changing Activation Config of Topic reading MDB at deploy time

本秂侑毒 提交于 2019-12-18 07:14:36
问题 I feel this should be easy. Just RTM and go. But I can't find the info I need. Q: Can I change the value of an @ActivationConfigProperty at deploy time without having to write any XML? More detail I have an MDB which is using the @MessageDriven annotation. Within this are a number of @ActivationConfigProperty annotations configuring it. @MessageDriven(mappedName = "jms/TestJeremyTopic ", activationConfig = { @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue = "Auto

Inject PersistenceContext with CDI

99封情书 提交于 2019-12-18 07:01:57
问题 Currently, I'm using PersistenceContext to inject an EntityManager. The EM is injected perfectly. @Stateless public StatelessSessionBean implements StatelessSessionBeanLocal { @PersistenceContext(unitName = "MyPersistenceUnit") private EntityManager em; @Override public Collection<MyObject> getAllObjects(){ CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriqQuery<MyObject> query = cb.createQuery(MyObject.class); query.from(MyObject); return em.createQuery(query).getResultList(); } } Now I

Inject PersistenceContext with CDI

拜拜、爱过 提交于 2019-12-18 07:01:53
问题 Currently, I'm using PersistenceContext to inject an EntityManager. The EM is injected perfectly. @Stateless public StatelessSessionBean implements StatelessSessionBeanLocal { @PersistenceContext(unitName = "MyPersistenceUnit") private EntityManager em; @Override public Collection<MyObject> getAllObjects(){ CriteriaBuilder cb = em.getCriteriaBuilder(); CriteriqQuery<MyObject> query = cb.createQuery(MyObject.class); query.from(MyObject); return em.createQuery(query).getResultList(); } } Now I

Lob is closed. ERRORCODE=-4470, SQLSTATE=null

拈花ヽ惹草 提交于 2019-12-18 06:08:38
问题 I am using IBM websphere commerce and db2, have following piece of code Clob clobVar = null; if (result.elementAt(3) != null) clobVar = (Clob) result.elementAt(3); if (clobVar == null) { infoTable.put("EInfo", ""); } else { stringTemp = clobVar.getSubString(1, (int) clobVar.length()); infoTable.put("EInfo", stringTemp); } Code works fine till clobVar = (Clob) result.elementAt(3); but as soon as execution comes to stringTemp = clobVar.getSubString(1, (int) clobVar.length()); System throws an

Servlet 3.0 annotations <welcome-file>

梦想的初衷 提交于 2019-12-18 06:02:22
问题 Is it possible to set welcome-file tag from standard web.xml file by servlet 3.0 annotation ? <welcome-file-list> <welcome-file>PageName.html</welcome-file> </welcome-file-list> 回答1: No, there is not such annotation at the moment. Servlet 3.0 annotations are InitParam, ServletFilter, WebServlet, WebServletContextListener, there's nothin for the welcome files in there. 来源: https://stackoverflow.com/questions/2540549/servlet-3-0-annotations-welcome-file