How to run glassfish 4 on port 80 instead of 8080? root access is not an issue

To run GlassFish on port 80 you need to : Connect to the administration interface (by default on port :4848) In the left menu go to Configurations Then select the appropriate configuration you need to change eg server-config Then go to Network Config Then go to Network Listeners Select the appropriate listener, probably http-listener-1 Change … Read more

Using the context-root from glassfish-web.xml in GlassFish 3

In GlassFish 3 and GlassFish 4 the configuration of a web application is done via glassfish-web.xml. In your case the desired configuration file would look like this: <!DOCTYPE glassfish-web-app PUBLIC “-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN” “http://glassfish.org/dtds/glassfish-web-app_3_0-1.dtd”> <glassfish-web-app> <context-root>/path/to/our/App</context-root> </glassfish-web-app> You can find further details in section GlassFish Server Deployment Descriptor Files of Oracle … Read more

Proper usage of JDBC Connection Pool (Glassfish)

Apart from the C-style formatting, a few unnecessary lines and a bit poor exception handling, you can just do so. Here’s how I’d do it: public final class SQLUtil { private static DataSource dataSource; // .. static { try { dataSource = (DataSource) new InitialContext().lookup(name); } catch (NamingException e) { throw new ExceptionInInitializerError(e); } } … Read more

DCH class error with JavaMail

Add these before you send your message: MailcapCommandMap mc = (MailcapCommandMap) CommandMap.getDefaultCommandMap(); mc.addMailcap(“text/html;; x-java-content-handler=com.sun.mail.handlers.text_html”); mc.addMailcap(“text/xml;; x-java-content-handler=com.sun.mail.handlers.text_xml”); mc.addMailcap(“text/plain;; x-java-content-handler=com.sun.mail.handlers.text_plain”); mc.addMailcap(“multipart/*;; x-java-content-handler=com.sun.mail.handlers.multipart_mixed”); mc.addMailcap(“message/rfc822;; x-java-content-handler=com.sun.mail.handlers.message_rfc822”); CommandMap.setDefaultCommandMap(mc); I got the problem in my Android app and it works.

how to create a remote session EJB from a client

I started from scratch. The only difference I can think of is that instead of making an EJB application, I just made an EJB module for the bean. Otherwise, I think it’s the same. structure: thufir@dur:~/NetBeansProjects$ thufir@dur:~/NetBeansProjects$ tree HelloLibrary/ HelloLibrary/ ├── build.xml ├── nbproject │   ├── build-impl.xml │   ├── genfiles.properties │   ├── private │   │   … Read more

Glassfish error when producing JSON

It’s a bug in Glassfish 4.1.1 https://java.net/jira/browse/JERSEY-2888 I was able to fix it in a dirty way: In glassfish/modules/org.eclipse.persistence.moxy.jar fix META-INF/MANIFEST.MF Just append the following to Import-Package: ,org.xml.sax.helpers,javax.xml.parsers;resolution:=optional,javax.naming;resolution:=optional so it looks like after: and restart GF btw: you can easy edit jars in terminal with emacs org.eclipse.persistence.moxy.jar