java-ee-7

java.lang.ClassNotFoundException: com.sun.corba.ee.impl.orb.ORBSingleton while using JDK 8 in Java EE 7 applications

北慕城南 提交于 2019-12-06 08:07:02
问题 I have an enterprise application running in the following environment. Mojarra 2.2.6 PrimeFaces 5.0 final PrimeFaces Extension 2.0 final OmniFaces 1.8.1 EclipseLink 2.5.1 having JPA 2.1 GlashFish 4.0 NetBeans IDE 8.0 JDK 1.8 Today I have upgraded from JDK 1.7 (jdk-7u11-windows-i586) to JDK 1.8 (jdk-8u5-windows-i586). Everything except remote EJBs runs fine (there is no problem with local EJBs. They work just fine as usual). In case of remote EJBs, it causes the following exception to be

Java EE 7 CDI - Injection doesn't work, sending NullPointerException

浪尽此生 提交于 2019-12-06 05:23:05
问题 I have a problem with my injection, it's the first time I try it. I'm working with Wildfly and Java EE 7. I've got a NullPointerException when trying to access Authenticator instance in LoginController . I use maven, my beans.xml is found under src/main/webapp/META-INF but I'v tried to put it in src/main/webapp/WEB-INF/classes without success. Here is my code : The class to inject : @Stateless public class Authenticator { @Inject HashGenerator hashGenerator; @Inject UserPersistance

From JSON String to Java Object using javax.json

冷暖自知 提交于 2019-12-06 05:07:17
问题 I'm using the com.google.gson.Gson API to convert a JSON string to a Java object: Gson gson = new Gson(); User u = gson.fromJson(jsonString, User.class); I'd like to know if there's an equivalent API in javax.json api to do the equivalent. Thanks! 回答1: This is definitely not possible with an oneliner like as with Gson. The javax.json API is very low level. It only returns you a JSON object structure which you've to breakdown and map to a javabean further all by yourself. In order to achieve

Using a secured EJB from a JAX-RS web service

浪子不回头ぞ 提交于 2019-12-06 01:12:16
I'm running Glassfish 4 and Jersey as JAX-RS implementation. I have secured my EJB like this: @Stateless @DeclareRoles({"Authentication_Reader"}) @RolesAllowed({"Authentication_Reader"}) public class AuthenticationServiceBean { public void foo() { ... } } I have created a security-role-mapping entry in glassfish-web.xml, and I've also created a security-role declaration in web.xml. The following works from a servlet: @WebServlet(name = "TestServlet", urlPatterns = {"/test.do"}) @RunAs("Authentication_Reader") public class TestServlet extends HttpServlet { @Inject private

Custom Security mechanism in Java EE 6/7 application

流过昼夜 提交于 2019-12-05 22:03:39
I would like to create (implement by my own) authentication mechanism which will be plugged into my Java EE application. As far as I know I have to implement LoginModule and connect this implementation with container mechanisms somehow. But the problem is that I don't know how to do it. Maybe You know where I can find sample code or tutorial about it? In other words I would like to force container to call my classes whenever methods: authenticate, login, and logout are called. Sample implementation : HttpServletRequest.login method will successfully authenticate only users with even numer of

Injecting EJBs using @Inject in class library

拜拜、爱过 提交于 2019-12-05 19:53:36
I have a full-fledged Java EE application using GlassFish Server 4.1 / Java EE 7. It is a standard NetBeans project i.e. it does not use Apache Maven. The application contains a class library named "ProjectLibrary" which is added to both the modules namely the EE module and the web module. The IDE shows the basic tree structure diagrammatically as follows. There is a requirement to inject an EJB into a JPA entity listener as follows. @ApplicationScoped public class EntityListener { @Inject private Event<EntityChangeEvent> event; @EJB private UserService service; @PostPersist @PostUpdate

How to start JBoss AS 7.1.1 on Windows?

耗尽温柔 提交于 2019-12-05 17:26:07
I am new to JBOSS .I downloaded jboss-as-7.1.1.Final.zip and unzip this zip file. Then I go to bin folder and double click on standalone.bat but new cmd window open and close within 2 -3 sec. I tried to start server throught cmd.I open cmd in 2 ways 1.normally mode Run as Admin (Admin Mode). In 2 ways I get: Calling "P:\Software\JBOSS\jboss-as-7.1.1.Final\bin\standalone.conf.bat" 'findstr' is not recognized as an internal or external command, operable program or batch file. then it stops. So the JBoss server does not start. I added Environment Variables like. JBOSS_HOME : P:\Software\JBOSS

Java Web Socket ServerEndpoint Thread Safety

点点圈 提交于 2019-12-05 17:14:22
Are individual ServerEndpoints thread safe or do they belong to all clients who are interacting with them at a given time? Or another way to ask the same question: Are global objects in the ServerEndpoint class in danger of creating concurrency issues, like they do in HttpServlets ? This example seems to indicate that each Endpoint is thread-safe, or he is just using Set and praying that concurrency issues don't pop up? So, assuming that the they are thread safe, does the container (Tomcat, Glassfish, etc.) create new instances of the ServerEndpoint class each time a new connection from a

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

╄→гoц情女王★ 提交于 2019-12-05 14:51:05
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.HttpHandler.runService(HttpHandler.java:201) at org.glassfish.grizzly.http.server.HttpHandler.doHandle

Java EE7 REST server no longer returning List<String> as JSON

故事扮演 提交于 2019-12-05 09:22:05
The following example works in a Java EE6 (Glassfish3) project of mine but failed after I switched to Java EE7 (Glassfish4). The HTTP request returns "500 Internal Error" without any message in the Glassfish server log. The project was setup using NetBeans8 as Maven Web Project and has no special dependencies, beans.xml or other configuration. @RequestScoped @Path("generic") public class GenericResource { @GET @Path("ping") @Produces(APPLICATION_JSON) public List<String> debugPing() { return Arrays.asList("pong"); } And then: $ curl -v http://localhost:8080/mavenproject2/webresources/generic