java-ee

How to get bound server address and port programmatically in Java EE?

空扰寡人 提交于 2019-12-18 19:23:15
问题 At startup we need to get the server address and the http port of the running application. Until now we made it like this: MBeanServer mBeanServer = ManagementFactory.getPlatformMBeanServer(); ObjectName socketBindingMBean = new ObjectName("jboss.as:socket-binding-group=standard-sockets,socket-binding=http"); String host = (String) mBeanServer.getAttribute(socketBindingMBean, "boundAddress"), Integer port = (Integer) mBeanServer.getAttribute(socketBindingMBean, "boundPort")); Everything was

How to connect remote EJB module from application client

半城伤御伤魂 提交于 2019-12-18 19:11:41
问题 I have a EJB module in remote Glassfish server and application client in my computer. I want to connect from the application client to the remote EJB. Here is the my EJB interface: @Remote public interface BookEJBRemote { public String getTitle(); } Here is the my ejb: @Stateless public class BookEJB implements BookEJBRemote { @Override public String getTitle() { return "Twenty Thousand Leagues Under the Sea"; } } I have several questions : Can I use Dependency Injection in the remote

How to connect remote EJB module from application client

牧云@^-^@ 提交于 2019-12-18 19:11:01
问题 I have a EJB module in remote Glassfish server and application client in my computer. I want to connect from the application client to the remote EJB. Here is the my EJB interface: @Remote public interface BookEJBRemote { public String getTitle(); } Here is the my ejb: @Stateless public class BookEJB implements BookEJBRemote { @Override public String getTitle() { return "Twenty Thousand Leagues Under the Sea"; } } I have several questions : Can I use Dependency Injection in the remote

How to optimize solr index

强颜欢笑 提交于 2019-12-18 19:07:04
问题 How to optimize solr index. I want to optimize my solr indexing for i try to change in solrconfig.xml it getting indexed but i want to how to verify that they are optimized and with which thing are involve in index optimization. 回答1: I find this to be the easiest way to optimize a Solr index. In my context "optimize" means to merge all index segments. curl http://localhost:8983/solr/<core_name>/update -F stream.body=' <optimize />' 回答2: Check the size of respective core before you start. Open

Understanding who provides servlet-api.jar, is it web-container or part of Java EE download

南笙酒味 提交于 2019-12-18 19:06:07
问题 I need understanding about the serlvet-api.jar which is needed to compile a servlet. I am building a simple servlet, like this: import javax.servlet.*; import javax.servlet.http.*; public class FirstServlet extends HttpServlet { // Remaining code here } I know that we need servlet-api.jar file to compile this simple servlet, like this: javac -classpath /path/where/jar/is/servlet-api.jar Now my doubts starts here: What is servlet-api.jar? Who provides this jar? Does each web-container provide

Understanding who provides servlet-api.jar, is it web-container or part of Java EE download

雨燕双飞 提交于 2019-12-18 19:05:23
问题 I need understanding about the serlvet-api.jar which is needed to compile a servlet. I am building a simple servlet, like this: import javax.servlet.*; import javax.servlet.http.*; public class FirstServlet extends HttpServlet { // Remaining code here } I know that we need servlet-api.jar file to compile this simple servlet, like this: javac -classpath /path/where/jar/is/servlet-api.jar Now my doubts starts here: What is servlet-api.jar? Who provides this jar? Does each web-container provide

org.hibernate.MappingException: Unable to find column with logical name

蹲街弑〆低调 提交于 2019-12-18 19:04:06
问题 hi my tables are as follows: 1- medical_company : medical_company_id foreign key on account_entity table account_entity_id column (not a pk) column1 column2 column3 2- account_entity : account_entity_id (pk) column1 column2 column3 3- person: person_id (pk) column1 column2 column3 4- employee_company: company_id foreign key on medical_company table on medical_company_id employee_id foreign key on person table on person_id column1 column2 ENTITIES: 1- MedicalCompany: @SuppressWarnings("serial"

CDI : WELD-001408 Unsatisfied dependencies, how to resolve it?

一个人想着一个人 提交于 2019-12-18 18:48:09
问题 I do a small test project with CDI. My application is composed of an EJB EAR and WAR, all deployed on Glassfish 4. I'm using Hibernate 4.3.4 to access the database. My goal is to verify that a class in an EJB (DAO) can receive an injection of an EntityManager. The pattern SessionBean + EJB is not fantastic but I have to modify an application already created so I do not have much choice. Here is my code of the EJB: @Named public class DAOTest implements Serializable { private static final long

Which are the differences/similarities between hibernate and other frameworks or specifications?

萝らか妹 提交于 2019-12-18 18:33:43
问题 I want to know the differences/similarities between Hibernate and simple persistence in Java EE 5? I'm not clear if Hibernate implements Java EE 5 persistence implementation or if it is a totally different approach to data representation over back-end systems. I'm confused about Hibernate and its relation with the concepts about java persistence given in the Java EE 5 tutorial... could you clarify the role of Hibernate in the context of Entities and EJBs? Also, I want to know other approaches

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/PersistenceException

烂漫一生 提交于 2019-12-18 17:32:58
问题 I'm new to JavaEE. I created enterprise application project in NETBEANS 7.2.1 with glassfish server 3.1. When I try to clean and build I get following error An annotation processor threw an uncaught exception. Consult the following stack trace for details. java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/PersistenceException at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass