java-ee-6

JBoss7.1.3: @EJB works while @Inject fails

回眸只為那壹抹淺笑 提交于 2019-12-12 04:37:22
问题 I've recently developed an app with Glassfish and the development goes very smoothly, now with JBoss I'm trying to do the same but is being slow down by various problems such as: @EJB works but @Inject fails. I don't have a fancy class yet, I just have a Singleton Startup class and a simple Stateless class that I inject, and to my surprise injection doesn't work. Here's my class: package com.czetsuya.dropship; import javax.annotation.PostConstruct; import javax.ejb.EJB; import javax.ejb

what is the right path to refer a jar file in jpa persistence.xml in a web app?

馋奶兔 提交于 2019-12-12 04:12:51
问题 persistence.xml looks like this: <persistence-unit name="testPU" transaction-type="RESOURCE_LOCAL"> <provider>org.hibernate.ejb.HibernatePersistence</provider> <non-jta-data-source>jdbc/test</non-jta-data-source> <jar-file>../../lib/app-services-1.0.jar</jar-file> <exclude-unlisted-classes>false</exclude-unlisted-classes> </persistence-unit> It is a web project, so the deployment unit is a war file. The jar file I tried to refer is in WEB-INF/lib/ folder , persistence.xml is in WEB-INF

Passing parameters between Request Scoped Managed Beans in JSF + EJB 3.1

依然范特西╮ 提交于 2019-12-12 03:48:29
问题 Our problem is a very basic, simple implementation of editing the database using JSF + EJB. Keeping things short: two separate XHTML views, use two separate Managed Beans @RequestScope. WebuserListBean and EditWebuserBean, and with @ManagedProperty we inject WebuserListBean, so we could obtain selected user data. So far no problems. Views are filled with data succesfully! BUT! We want to be able to edit the user! And here (to my surprise) we cannot overcome the problem. 1st try: Because the

404 Error while deploying simple web-app in JBoss AS 6 and JBoss AS 7?

谁都会走 提交于 2019-12-12 03:14:02
问题 I followed this blog for injecting EJB in REST layer. Here is the code that I tried deploying in JBOSS AS 6 and 7 using Eclipse: REST: package com.example.rest; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.ws.rs.GET; import javax.ws.rs.Path; @Stateless @Path("current") public class ServiceFacade { @EJB ServiceImpl service; @GET public String getDate(){ return service.getCurrentDate().toString(); } } EJB: import java.util.Date; import javax.ejb.Stateless; @Stateless public

Running Java EE 7 on Tomcat 7 in Netbeans

青春壹個敷衍的年華 提交于 2019-12-11 21:36:27
问题 I'm not able to run a Java EE 7 webapp on tomcat 7 while in Eclipse using the same tomcat server it works. I can find my tomcat 7 server if I change the following in my pom.xml: <dependency> <groupId>javax</groupId> <artifactId>javaee-web-api</artifactId> <version>7.0</version> <scope>provided</scope> </dependency> If i change it to 6.0 it works fine in Netbeans but the problem is I'm using Jersey for my Rest API and at client side I use: new Gson().fromJson(resp.readEntity(String.class),

Instrumented (by cobertura) @Decorator bean could not validated by OpenEJB for unit testing

天涯浪子 提交于 2019-12-11 18:09:22
问题 In order to get code coverage report, i instrument the @Decorator bean by cobertura maven plugin. When running my unit test in OpenEJB container. The container reports some error during start up (new initial context). Caused by: org.apache.webbeans.exception.WebBeansConfigurationException: Decorator : MyDecorator, Name:null, WebBeans Type:DECORATOR, API Types:[org.apache.commo ns.configuration.Configuration,net.sourceforge.cobertura.coveragedata.HasBeenInstrumented,org.apache.commons

Maven tests troubles with SOAP having Java EE 6 dependency

笑着哭i 提交于 2019-12-11 18:06:37
问题 I'm finding troubles when trying to use SOAP in tests in a maven project that has Java EE 6 API as a provided-scoped dependency. Important facts I'm aware that the API is unusable for testing I know I should import an implementation of any specification if I want to use it SOAP is part of Java SE, not EE SOAP (mock) classes are included in the Maven artifact and I believe they should not This happens in Java EE 6, but those classes have been removed in version 7 If I remove the dependency,

NameNotFoundException when running simple webapp in JBOSS 6 but Not on JBOSS 7

只谈情不闲聊 提交于 2019-12-11 18:02:17
问题 I have a simple web-app ( REST service and EJB ) that when I run on JBOSS 7 works fine. But on JBOSS 6 I get NameNotFoundException . I am unable to figure out why it works with JBOSS 7 but not with JBOSS 6 . my pom.xml includes dependencies for java ee 6 api . Here is the code: jax-rs activator: import javax.ws.rs.ApplicationPath; import javax.ws.rs.core.Application; @ApplicationPath("rest") public class RestApplication extends Application { } EJB import java.util.Date; import javax.ejb

Java EE 6 - Pessimistic Locking - ViewScoped bean + Stateful bean with UserTransaction, PreDestroy and other problems

回眸只為那壹抹淺笑 提交于 2019-12-11 14:11:44
问题 In application I'm working on we need to start transaction before user enters 'edit page' (to lock DB records currently edited) and end it when he clicks the button or left the page. For this purpose I use @Stateful EJB bean which manages the transaction and CDI @ViewScoped bean which is used on the 'edit page'. Of course user can take many actions on edit page, which are supposed to be invoked within the same transaction. Here's sample code: @Stateful @LocalBean @TransactionManagement

Example for CDI-SessionScoped LogIn with TomEE

拈花ヽ惹草 提交于 2019-12-11 14:06:48
问题 i'm currently fighting with TomEE, JSF and CDI (i think). Is there any example out there which has "@javax.enterprise.context.SessionScoped" annotation using TomEE 1.5.1 (or current snapshot)? I DONT want to use @ManagedBean or something else from javax.faces, just plain CDI. My problem is: when i change some @SessionScoped user session instance i end up in having a new sessionID (session fixation problem?!?). My Use-Case: I want to have a login on one page and have the possability to login