Piter Smith

Ranch Hand
+ Follow
since Feb 25, 2009
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Piter Smith

I don't understand the classpath requirements for facelets and CDI on glassfish. I'm using Netbeans, and have the following:

when I look at javaee-api it has javax.enterprise.context.ApplicationScoped and javax.inject.Named which are the particular imports being used in the bean. The facelets part is working, the template navigates correctly. It deploys to Glassfish and runs, except...there's no output from the @Named bean:

from the page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml"

This and everything before will be ignored
<ui:composition template="template.xhtml">
<ui:define name="navigation">
<ui:include src="menu.xhtml"/>
<ui:define name="main">
next #{nextClient.next}
This and everything after will be ignored

Everything I read says to use CDI, that it's preferable now. I'm using EL, or more specifically, UEL, correctly, I believe. I'm largely following Facelets Essentials:


and am just trying to get the template client to invoke NextClient.getNext() with the EL of nextClient.next, but nothing happens...there's no stacktrace or error in glassfish:

the page displays as:

well, now I'm baffled. Now it's working. I can't figure what I did for the life of me...that's the desired output, each time the page is accessed the counter increments.

Now it works. Is this on the right track? Way off base? I have an entity class from a database which I'd like to link up to this, and output the class.

I can inject the entity into NextClient? I'm trying to do the "R" for Read in a CRUD application with CDI and facelets (using templates).

I've found much reference material on EJB, but it seems a mishmash. I just want to use CDI. What am I doing right/wrong, or, besides the PDF from Oracle on Java EE 7, what are good CDI reference material's? Much of what's on the web is woefully out of date, or not applicable to using CDI.

Paul Clapham wrote:I remember those forums from 10 or 15 years ago -- you could access them from your e-mail client, you could read the posts and responses which showed up in the natural tree structure in your mail reader, and you could respond to a post in your mail reader, which would result in an e-mail being sent to the forum and showing up in the tree structure for that thread. It had a four-letter acronym which I'm failing to remember right now, but the name "newsgroup" comes into my mind for some reason.

Some of the Oracle mailing lists still work like that..anyhow.
6 years ago
I'm starting an Enterprise Application with an EJB module and Web module:


Right now, everything is mushed into the Web module as so:

so that it deploys as an EAR:

How can I move this code:

from the web module into the EJB module? Or, am I just coming at this in the wrong way, somehow?
7 years ago
I'm trying to use the "legacy" connection:

but don't really know how to proceed. From the CLI, how do I find out more about a specific JDBC resource? How do I establish, with asadmin, or show, that it's configured and connected with a specific pool?

So far as I can tell, the pool works fine, it pings correctly:

but I'm not sure how to actually utilize this connection in code from an EJB. Is there a terminology to google? I don't mind reading a manual, and have been through a few Glassfish manuals, but must not have found the right section.
7 years ago

Rob Spoor wrote:javaee-web-api is a subset of javaee-api that has some packages omitted. Although I am surprised to see that for version 6, javax.jms, javax.xml.messaging javax.xml.registry are the only packages present in javaee-api and not in javaee-web-api. The difference is a bit larger in version 7 (where apparently javax.mail and a few other packages have been removed from javaee-web-api).

Generally speaking, when are these API's used? Or, more specifically, when would one be used instead of the other?

Ulf Dittmer wrote:Would the point be that you can submit posts via mail? JForum had that capability originally, but we deliberately did not turn it on. (Not that it ever supported singling out forums to my knowledge.)

It's already possible to be notified whenever a new post is made in any particular forum.

but not possible to reply....

7 years ago
I suppose mailing lists are dead, or dying, but, maybe JavaRanch could have one forum which also is a mailing list?
7 years ago
how does javaee-web-api vary from javaee-api and how do they fit into this discussion?
Rome worked fine for me, only a bit annoying that it's never moved past version 1.0.
7 years ago

K. Tsang wrote:I'm not sure if this is correct. I think for remote JNDI, the lookup code should look like:

I think you're right, but I can't quite get it to work right:

and then using gives:

see also:



the Enterprise Application and EJB module:


the CLI appclient:


the remote interface library:


the CORBA lookup:

7 years ago

I modified the classes a bit:

they seem to function "correctly", in that there are no duplicates in the database...
I'm using Rome RSS to aggregate RSS feeds. For right now, I'm just focused on persisting the actual links, and ensuring there are no duplicates.

Am I using best practices with the DAO and Facade for the Links class? It's just a flat database at the moment, using JPA 2.1 with EclipseLink.

I think this is a facade?

and this is a DAO?

my biggest concern is the method in the DAO.
What's the best, or most light-weight API for RSS feed parsing? By light-weight, I mean simple. I only need to get back very basic information.

I'm looking at the dependencies for Rome:

Project Dependency Graph
Dependency Tree

com.rometools:rome:jar:1.5.0-SNAPSHOT Information
com.rometools:rome-utils:jar:1.5.0-SNAPSHOT (compile) Information
org.jdom:jdom:jar:2.0.2 (compile) Information
org.slf4j:slf4j-api:jar:1.7.7 (compile) Information
ch.qos.logback:logback-classic:jar:1.1.2 (test) Information
ch.qos.logback:logback-core:jar:1.1.2 (test) Information
junit:junit:jar:4.11 (test) Information
org.hamcrest:hamcrest-core:jar:1.3 (test) Information


but when I compare that to:




it seems like Rome 1.0, which is available for download, couldn't possible be using JDOM 2.x, which wasn't released until 2012, while Rome 1.0 was in 2009.

What's the distinction between Rome and Rome tools?

I've seen a few other Java RSS API's, nothing seems as popular as Rome. I can't figure out whether Rome is stable, abandoned, under active development, or forked.

While I'm not anticipating delving into RSS in much detail, I do want to use JPA for persistence, so that dependency is interesting.

What do I download to get started with Rome, and, perhaps, Rome tools?
7 years ago

Tim Holloway wrote:Annotating an application-scope bean as Singleton is redundant. By definition, there's only one instance of it per application.

The problem here is that although your property is only coded once and for a single user, its get method has side-effects.

JavaBeans in general and specifically JSF backing beans should not have side-effects in their get/set methods. A get method for a property might be invoked 5 or 6 times in the course of a single request/response cycle.

The way around this is to back up the get/set methods by an actual instance variable (property item) and have the get/set methods set or retrieve that variable's value.

For a read-only property such as this one, the backing property variable can be initialized either in a @Postconstruct method or by coding the "get" method to employ the variable as a cached item. That is, on the first call, retrieve the value from the database and set the variable, on subsequent calls just return the variable.

by side effect, you mean mutate fields?
7 years ago
How do you troubleshoot NameNotFound exceptions? There's nothing in the log about failed lookup attempts, or that a client from ip address x.x.x.x tried to lookup bean foo.

see also:


pardon, didn't realize there was a Glassfish specific forum.
7 years ago