Showing posts with label JEE_Servers. Show all posts
Showing posts with label JEE_Servers. Show all posts

Monday, December 24, 2012

Run JBoss, Tomcat/Tomee in debug mode

 

The needed params are:

-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

For jboss as 7 in bin/standalone.bat (or sh) add those additional params to line 53

set JAVA_OPTS=-Dprogram.name=%PROGNAME% %JAVA_OPTS%

the line will look like this:

set JAVA_OPTS=-Dprogram.name=%PROGNAME% %JAVA_OPTS% -Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

For tomcat/tomee

in catalina.bat (.sh) at this as the first line in file:

set JAVA_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=n

To debug the code in Eclipse:

  1. Run -> Debug Configurations… -> Remote Java Application -> Right click –> New
  2. Then on Connect tab, set these Connection Properties: host = localhost, port=8787
  3. Then select your Project and in Source tab add extra projects or libraries.
  4. Press Apply button
  5. Press Debug button
  6. You are connected!!! – the server must be started
  7. Add a Breakpoint in your code
  8. Trigger your application to reach a Breakpoint

To debug the code in Netbeans:

  1. Go in menu: Debug->AttachDebuger…
  2. set port to 8787
  3. press ok (make sure that the server is up and running) – repeat the process every time when you need debugging

Tuesday, December 11, 2012

Global JNDI Names standardized in JEE6

The Enviromental Naming Context (ENC) is a JNDI context that can be accessed via java:comp/env.

This Context is used to create portable JNDI names for EJBs. Names in the ENC are created with entries in a deployment descriptor. The JEE6 adds support for sandard JNDI names of EJBs withour requiring usage of the ENC:

java:global[/<app-name>]/<module-name>/<bean-name>

java:app[/<module-name>]/<bean-name>

java:module/<bean-name>

app-name is same as ear without extension, module-name is ejb jar or war name without extension

also CDI can target specific JNDI name


@EJB(mappedName=”java:global/ejbmodule/FooBean”)
FooRemote foo;

Updating GlasFish v3 with latest EclipseLInk and JSF Mojara

 

Download newer version of EclipseLink binaries from http://www.eclipse.org/eclipselink/downloads/. Choose OSGI bundles from the available downloads.

Download javax.faces-2.1.14.jar from http://javaserverfaces.java.net/download.html (the latest at the moment, not use 2.2.x version because this will be part of the new jee7 spec and may not work with glassfish 3.1)

Replace following files under $GLASSFISH_HOME/glassfish/modules with corresponding jars you downloaded above:

  • org.eclipse.persistence.antlr.jar
  • org.eclipse.persistence.jpa.jar
  • org.eclipse.persistence.asm.jar
  • org.eclipse.persistence.jpa.modelgen.jar
  • org.eclipse.persistence.core.jar
  • org.eclipse.persistence.oracle.jar
  • javax.persistence.jar
  • javax.faces.jar

    Restart GlassFish

  • Note: This will solve problems with create-tables in hsqldb – the defauld eclipse link from glassfish 3 generate some SQLs which are not executed for tables creation.