JSF request scoped bean keeps recreating new Stateful session beans on every request?

Stateful session beans (SFSB) are not exactly what you think they are. You seem to think that they behave somehow like session scoped JSF managed beans. This is untrue. The term “session” in EJBs has an entirely different meaning than the HTTP session which you’ve had in mind. The “session” in EJBs must be interpreted … Read more

JAXB XJC Possible to suppress comment creation in generated classes?

I am using this Maven plugin which replaces the // Generated on: 2011.02.23 at 02:17:06 PM GMT line: <plugin> <groupId>com.google.code.maven-replacer-plugin</groupId> <artifactId>maven-replacer-plugin</artifactId> <version>1.3.8</version> <executions> <execution> <phase>prepare-package</phase> <goals> <goal>replace</goal> </goals> </execution> </executions> <configuration> <includes> <include>src/main/java/jaxb/*.java</include> </includes> <token>^// Generated on.*$</token> <value>// Generated on: [TEXT REMOVED by maven-replacer-plugin]</value> <regexFlags> <regexFlag>MULTILINE</regexFlag> </regexFlags> </configuration> </plugin>

How does class loading work when the same class exists in different applications on the same server?

A Java classloader typically works by looking for classes in one or more places in a fixed sequence. For instance, the classloader that loads your application when you run it from the command line looks first in the rt.jar file (and others on the bootclasspath), and then in the directories and JAR files specified by … Read more

HttpServletRequest.getRemoteUser() vs HttpServletRequest.getUserPrincipal().getName()

A Principal represents someone who could potentially authenticate with your application. The Principal’s name depends on the authentication method used: a username such as “fred” (in the case of HTTP Basic authentication) a Distinguished Name such as “CN=bob,O=myorg” (in the case of X.509 client certificates – in which case a X500Principal may be returned) getRemoteUser() … Read more

Java EE 6: JSF vs Servlet + JSP. Should I bother learning JSF?

JSF basically enables you to develop a web application with only model objects (JavaBeans) and views (JSP/XHTML pages). With “plain vanilla” JSP/Servlet you’ll have to bring in a lot of code to control, preprocess, postprocess, gather data, validate, convert, listen, etc the HTTP request and response. And then I’m not talking about refactoring it to … Read more

Am I Using JDBC Connection Pooling?

Assuming that it’s the BasicDataSource is from DBCP, then yes, you are using a connection pool. However, you’re recreating another connection pool on every connection acquirement. You are not really pooling connections from the same pool. You need to create the connection pool only once on application’s startup and get every connection from it. You … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)