java-ee-7

mvc pattern in java ee and migrating from spring to java ee 7

一世执手 提交于 2019-12-10 17:19:04
问题 I used spring MVC in the following manner: @Controller class MyControllerClass { @RequestMapping... method(){ ServiceCall()... //put something to modelAndView object here and redirect to jsp page. return "home"; // this will redirect data to home.jsp } } @Service class MyServiceClass{ @Transactional SomeServiceMethod(){ DaoMethod(); } } @Repository class MyDaoClass{ DaoMethdon(){...} } /view/myjsps.jsp path to view directory set in spring.xml Question: Can any body explain to me (preferably

web.xml not found in Java EE7 project

房东的猫 提交于 2019-12-10 17:05:29
问题 I'm doing a project in eclipse with JSF 2.2 and Servlet 3.1 (Java EE7). The first problem I had was a error in the pom.xml in line: <packaging>war</packaging> Error: web.xml is missing and is set true. I researched on the internet and added the following lines in my pom.xml <plugin> <artifactId>maven-war-plugin</artifactId> <version>2.4</version> <configuration> <failOnMissingWebXml>false</failOnMissingWebXml> </configuration> </plugin> After that the error was gone, but when running the

Glassfish 4 - Using Concurrency API to create Managed Threads

烂漫一生 提交于 2019-12-10 15:34:50
问题 I'm trying to use the new Concurrency API to inject a ManagedThreadFactory and use it per the Oracle tutorial. Here is an example of what I'm talking about: @Singleton @Startup public class Demo { @Resource(name="concurrent/__DefaultManagedThreadFactory") ManagedThreadFactory threadFactory; @PostConstruct public void startup() { threadFactory.newThread( new Runnable() { @Override public void run() { System.out.println("Do something."); } } ).start(); } } I'm developing in Eclipse using the

Mapping WebSocketEndpoints in a web.xml file

怎甘沉沦 提交于 2019-12-10 14:38:58
问题 I am trying to develop a Java EE 7 web application that uses a websocket endpoint and deploy it on a Jetty server. The application has the following structure: Game/ src/ main/ java/ game/ WebSocketEndpoint.java webapp/ index.html scripts/ variousjavascriptstuff.js WEB-INF/ beans.xml web.xml In the beans.xml file: <beans xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org

Java EE 7 First Cup Tutorial errors in Maven: Could not find artifact org.glassfish.javaeetutorial.firstcup:firstcup:pom:7.0.1-SNAPSHOT

橙三吉。 提交于 2019-12-10 14:05:32
问题 I'm following along with the Java EE 7 updated version of FirstCup. I have glassfish 4 installed and am using NetBeans 7.3. I'm working on the very first example and I'm getting maven issues. I generated the archetypes and am able to create the dukes-age project. However it has non-resolvable maven issues: Could not find artifact org.glassfish.javaeetutorial.firstcup:firstcup:pom:7.0.1-SNAPSHOT Here is the full error: [INFO] Scanning for projects... [ERROR] The build could not read 1 project

JSF 2.2 interpret empty string submitted values as null not working

佐手、 提交于 2019-12-10 13:27:53
问题 I have migrated from Java EE 6 to Java EE 7, and now with JSF 2.2 the context param INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL seems not work. In JSF 2.1 I set it to "true" and it works perfectly, but now I get always blank strings. <context-param> <param-name>javax.faces.INTERPRET_EMPTY_STRING_SUBMITTED_VALUES_AS_NULL</param-name> <param-value>true</param-value> </context-param> Can anyone say something about it? 回答1: The same happens with glassfish 4 with the latest Mojarra-2.2.5 as

JMS 2.0 QueueBrowser on Wildfly does not return messages

谁说胖子不能爱 提交于 2019-12-10 10:54:49
问题 I have 2 simple EJB beans. The first one is a timer method that is called every second. In this method I add 10 random messages to a TestQueue. @Singleton @Startup public class Timer { @Inject private JMSContext context; @Resource(mappedName = "java:/jms/queue/TestQueue") private Queue queue; @Schedule(hour = "*", minute = "*", second = "*/1", persistent = false) @AccessTimeout(unit = TimeUnit.DAYS, value = 1) public void addToQueue() { for(int i = 0; i<30; i++) context.createProducer().send

Confusion after installation of JDK 1.7 and Java EE 7 SDK?

两盒软妹~` 提交于 2019-12-10 09:54:22
问题 I am just starting with the Oracle Java EE 7 tutorial. While I have already gained some practice with an existing Apache Tomcat Environment I wanted to get in touch with the complete tutorial to have a clear learning path and trail. So I am currently using a Mac with OS X Mavericks. I have already installed an Oracle JDK 1.7 which is working pretty smooth. Developing is also nice so no problems with that. Now I came to the part in order to download "Java EE 7 SDK/JDK" (http://docs.oracle.com

java.lang.NullPointerException at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:272) while accessing JAX-WS services

喜你入骨 提交于 2019-12-10 06:46:45
问题 I'm getting the following exception while implementing JAX-WS services in a Java EE 7 application. Warning: Internal Server error: /Test-war/Test.xhtml java.lang.NullPointerException at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:272) at com.sun.enterprise.v3.services.impl.ContainerMapper$HttpHandlerCallable.call(ContainerMapper.java:459) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:167) at org.glassfish.grizzly.http.server

How can I get a cookie value inside websocket end-point

浪尽此生 提交于 2019-12-10 04:33:30
问题 I'm using Websocket-API based on JavaEE 7, in my application. I'm required to access the values set in cookies inside my websocket endpoint [Annotated one : @ServerEndpoint ("/websocket") ] . How would I do that? @onOpen() method is there, which will be called automatically when a connection to this websocket endpoint is established. I want to access cookies values in there, inside this method. I know how to do that in a servlet or JSP, but I'm new to Websockets. Please help me doing this.