ejb

Cannot instantiate class: org.jnp.interfaces.NamingContextFactory

 ̄綄美尐妖づ 提交于 2020-01-14 14:57:07
问题 Here this my code: SpeakerRemote.java package test; import javax.ejb.Remote; @Remote public interface SpeakerRemote { String sayAPhrase( String phrase ); } SpeakerBean.java package test; import javax.ejb.Stateless; @Stateless public class SpeakerBean implements SpeakerRemote { @Override public String sayAPhrase( String phrase ){ return "Speaker Service:\t" + phrase; } } I assembled it with maven. Here I show you invoking part: Invoker.java import javax.naming.Context; import javax.naming

Cannot instantiate class: org.jnp.interfaces.NamingContextFactory

与世无争的帅哥 提交于 2020-01-14 14:56:52
问题 Here this my code: SpeakerRemote.java package test; import javax.ejb.Remote; @Remote public interface SpeakerRemote { String sayAPhrase( String phrase ); } SpeakerBean.java package test; import javax.ejb.Stateless; @Stateless public class SpeakerBean implements SpeakerRemote { @Override public String sayAPhrase( String phrase ){ return "Speaker Service:\t" + phrase; } } I assembled it with maven. Here I show you invoking part: Invoker.java import javax.naming.Context; import javax.naming

Postgres get first and last version for individual vendor

瘦欲@ 提交于 2020-01-14 13:53:08
问题 I have mapping table for RFQ(request for quotation) and Vendor's bid amount with version. Table : id rfq_id(FK) vendor_id(FK) amount version ----------------------------------------------- 1 1 1 100 1 2 1 1 90 2 3 1 1 80 3 4 1 2 50 1 5 1 7 500 1 6 1 7 495 2 7 1 7 500 3 8 1 7 525 4 9 1 7 450 5 10 1 7 430 6 11 2 1 200 1 12 2 2 300 1 13 2 2 350 2 14 2 3 40 1 15 3 4 70 1 In above table, I want analysis for vendor's first and last bid for particular rfq_id . Expected Output for rfq_id=1 : vendor

EJB/JPA: How to use EntityManager.persist() to always INSERT a new record, not update

我的梦境 提交于 2020-01-14 03:28:06
问题 EntityManager.persist() function is trying to update a existing record, but I always need to insert a new one. How to achieve this? Part of Entity bean: @Entity @Table(name="SYNC_TRIGGER", schema="ETL") public class SyncTrigger implements Serializable { @Id @Column(name="ID") @SequenceGenerator(name = "TRIGGER_SEQ", sequenceName = "ETL.TRIGGER_SEQ") @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "TRIGGER_SEQ") private Long triggerId; ...... Part of Stateless bean, which

How to lookup EJB using JNDI in WebSphere Liberty

≡放荡痞女 提交于 2020-01-14 03:18:06
问题 I am trying to perform a JNDI name search using Liberty Application Server.However, It is throwing me a dependency injection issue.Attached is my code I am getting the following Error: [ERROR ] SRVE0319E: For the [com.airline.controllers.FlightDetails] servlet, com.airline.controllers.FlightDetails servlet class was found, but a resource injection failure has occurred. CWNEN0030E: The server was unable to obtain an object instance for the java:comp/env/com.airline.controllers.FlightDetails

log4j2 logging of code in EJB jar on JBoss EAP 7

痴心易碎 提交于 2020-01-13 16:49:40
问题 I am doing the following: porting several legacy applications from WebLogic to JBoss EAP 7. Some of the components being ported are EJBs. Others are servlet apps that invoke these EJBs. These EJBs are deployed in ejb-jars. I know that I could wrap this whole thing into a big EAR file but we don't want to do that. The servlets and the EJB jars need to be separately deployable components. Then there is the logging setup. We are using log4j2 and we want to keep independent of the JBoss logging

How do I write a Java EE/EJB Singleton?

我是研究僧i 提交于 2020-01-12 07:48:19
问题 A day ago my application was one EAR, containing one WAR, one EJB JAR, and a couple of utility JAR files. I had a POJO singleton class in one of those utility files, it worked, and all was well with the world: EAR |--- WAR |--- EJB JAR |--- Util 1 JAR |--- Util 2 JAR |--- etc. Then I created a second WAR and found out (the hard way) that each WAR has its own ClassLoader, so each WAR sees a different singleton, and things break down from there. This is not so good. EAR |--- WAR 1 |--- WAR 2 |-

spring-day01-概述-IOC

岁酱吖の 提交于 2020-01-11 17:27:43
文章目录 一、spring概述 二、spring的EJB的区别(了解) 三、耦合和解耦 四、 解耦代码--自定义IOC(了解) 一、spring概述 spring 的 开源的轻量级框架 spring的两大核心:IOC ,AOP 二、spring的EJB的区别(了解) EJB可以说像是一个Web Service,但也不完全是,比如EJB将编写好的业务组件放置在EJB容器上,然后提供接口给客户端访问;但是功能不仅限如此,EJB标准中提供了很多规范等,而这些规范只有在EJB容器才能正常运行。 EJB是重量级框架 Spring容器取代了原有的EJB容器,因此以Spring框架为核心的应用无须EJB容器支持,可以在Web容器中运行。 Spring容器管理的不再是复杂的EJB组件,而是POJO(Plain Old Java Object) Bean。 Spring轻量级框架 三、耦合和解耦 1. 什么是耦合 模块之间的关联程度, 依赖程度 2. 什么是解耦 降低模块之间的耦合度(依赖关系) 3. 解耦的目的 编译器不依赖(编译没有语法错误),运行期才依赖(运行可能报错) 4. 解耦思路 1) 把全限类名都放到配置文件中 2) 通过工厂帮助创建对象 四、 解耦代码–自定义IOC(了解) spring内所有的类都叫bean对象 在这里插入代码片 来源: CSDN 作者: 树叶子_ 链接:

JAX-RS failed to inject @EJB or @Inject

偶尔善良 提交于 2020-01-11 09:20:54
问题 I'm trying to test a minimal JAX-RS + EJB/CDI injection mechanism and currently hitting a road-block due to GlassFish unable to inject for whatever reason. (Using @Inject will throw NPE because GlassFish cannot inject the POJO). My beans.xml contains only <beans /> Here's my web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun

Maven EAR module and EJB dependencies tests

删除回忆录丶 提交于 2020-01-11 02:26:06
问题 We are building our EAR & EJB projects with maven. It will build all the EJB projects and then they are used as the dependency for EAR, so they are packed into the EAR file eventually. The problem is that each EJB project has junit tests that check the EJB. For now these tests are not very useful because they try to connect to application server (jboss) and execute methods from EJB interface. Is there any way I can build the EJBs, build and deploy the EAR and then run all the tests from all