java-ee-7

How to pause a queue in Activemq

蹲街弑〆低调 提交于 2020-01-06 03:24:46
问题 I need to pause a queue in Activemq 5.13.2 inside an application and according to this post https://stackoverflow.com/a/32165140/1458556 it's possible with version 5.12 but I don't know how to implement it. Any Java code samples would be great. @Test public void testPauseQueue() throws Exception { JMXServiceURL url = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/jmxrmi"); JMXConnector jmxc = JMXConnectorFactory.connect(url); MBeanServerConnection conn = jmxc

Java EE 7 updatetool installation fails

霸气de小男生 提交于 2020-01-05 08:03:16
问题 I have tried to install Java EE 7 with updatetool to be able to run Java EE Tutorial examples. But the installation of updatetool fails. I have tried to start updatetool installation from the command line on my elementary os, then I saw the error when installing updatetool. Here is an image: http://oi58.tinypic.com/x6iumx.jpg Error text example 1: Input/output error: Connection failed for URL http://pkg.oracle.com/javaeesdk/7/native/release/manifest/0/updatetool@2.3.5%2C0-56.2852

What are “Java EE 7 API Library” and “Java EE Web 7 API Library” and when to use them?

笑着哭i 提交于 2020-01-03 19:31:25
问题 I have a full-fledged Java EE project running on GlassFish 4.1 / Java EE 7 (NetBeans 8.0.2) not using Apache Maven. Depending upon the project functionality, the CDI dependency has to be added to both the projects/modules namely the EE module and the Web module (and a class library, if any). I have been confusing for a long time seeing people recommending to add either "Java EE 7 API Library" or "Java EE Web 7 API Library" to the compile-time class-path as a CDI dependency (these libraries

Java EE 7 - Injection into Runnable/Callable object

非 Y 不嫁゛ 提交于 2020-01-02 01:25:28
问题 Concurrency Utilities(JSR 236) has been introduced in Java EE 7. Is there any way how to inject my EJBs into Runnable/Callable object? Specifically I want something like this: ejb with business logic @LocalBean public class MyEjb { public void doSomeStuff() { ... do some stuff ... } } runnable/callable class where I want to inject instance of MyEjb public class MyTask implements Runnable { @EJB MyEjb myEjb; @Override public void run() { ... myEjb.doSomeStuff(); ... } } Object which starts the

Quartz vs Java EE 7 scheduler

我只是一个虾纸丫 提交于 2020-01-02 01:05:00
问题 I'm a java EE developer which has used until now frameworks like Quartz to schedule tasks. I can see that Java EE 7 features a ManagedScheduledExecutorService to schedule single or repeating tasks. As I have never used in real projects this new features I wonder if there are still advantages of using Quartz (or others) when you have a portable way to do it ? Thanks! 回答1: I believe that in future projects, there's really no need to use third-party libraries. Java EE 7 is full of scheduling

How to set Locale in Bean Validation

…衆ロ難τιáo~ 提交于 2020-01-01 06:15:29
问题 By default Bean Validation gets Locale based on Locale.getDefault(), which is common to whole JVM. How to change BeanValidation's Locale for current EJB method call? I'm using JavaEE7 and want to get benefits from integration of JPA and Bean Validation, i.e. automatic triggering validation on insert/update/delete events, and as far as possible avoid of writing everything manually. EDIT After all, I'm just returning non-interpolated messages from EJB: public class DoNothingMessageInterpolator

How to set Locale in Bean Validation

亡梦爱人 提交于 2020-01-01 06:15:26
问题 By default Bean Validation gets Locale based on Locale.getDefault(), which is common to whole JVM. How to change BeanValidation's Locale for current EJB method call? I'm using JavaEE7 and want to get benefits from integration of JPA and Bean Validation, i.e. automatic triggering validation on insert/update/delete events, and as far as possible avoid of writing everything manually. EDIT After all, I'm just returning non-interpolated messages from EJB: public class DoNothingMessageInterpolator

Java EE 7 Portable solution for Integration and Unit testing

谁说胖子不能爱 提交于 2019-12-31 04:23:05
问题 I am trying to find a portable solution to test my Java EE 7 application. It is especially tricky when to test the EJB and their injections. For example: @org.junit.Test public void testIsValidCredentials() throws Exception { System.out.println("isValidCredentials"); String username = ""; String password = ""; Map properties = new HashMap(); properties.put(EJBContainer.MODULES, new File[] {new File("target/classes")}); EJBContainer container = javax.ejb.embeddable.EJBContainer

Mock or build a Jersey InboundJaxrsResponse

扶醉桌前 提交于 2019-12-30 17:24:33
问题 I'm fairly new developing jersey client, and has run into some problems with some testing. First off all I maybe should mention that my application is all client side, no server side stuff at all. My problem is that I would like to create a Response object of instance InboundJaxrsResponse , so far I've tried to achieve this by mocking a Response using Mockito and ResponseBuilder.build() Using Mockito: Response response = mock(Response.class); when(response.readEntity(InputStream.class))

Mock or build a Jersey InboundJaxrsResponse

纵饮孤独 提交于 2019-12-30 17:24:09
问题 I'm fairly new developing jersey client, and has run into some problems with some testing. First off all I maybe should mention that my application is all client side, no server side stuff at all. My problem is that I would like to create a Response object of instance InboundJaxrsResponse , so far I've tried to achieve this by mocking a Response using Mockito and ResponseBuilder.build() Using Mockito: Response response = mock(Response.class); when(response.readEntity(InputStream.class))