EJB 2.0 best practices suggested a design pattern where data and behavior were
were treated as independent concerns. Stone Age Development (SAD) using structs
and procedural programming sounded bad so they were dubbed Transfer or Value
Objects, emphasis on "Object".
My EJB 3.0 entities are now
I'm using 4.0.4 RC1 but not sure what EJB3 version it has. Will try CR2 (looks
like release candidate is now candidate release) which is now available. I'm
doing bee = getEJB("foo") using my own generic lookup method so it's pretty
clean, but @EJB beats that and it's less error prone.
View th
I have a service bean Special that depends on service bean Core. The special
bean loads and the core bean is injected without a hiccup. I have print
statements that show the create and start methods of Special are called. Core
create and start methods are not called. Special is definitely there.
The injection fails because A is loaded before B and there's no B to stuff in
variable "bee".
| @Service ... A
| {
|@EJB B bee;
|
|
I can use @Depend to load Service beans in order but what about mingled EJBs
and Service beans where they call each other? I need bean-lev
Coherence is short for "ensuring consistency across all of the constituent
parts". SLSBs have to behaive exactly the same regardless of which instance you
get or where that instance lives.
This is from the trailblazer on JMX which is why I think the Service bean is
the way to go:
Different fr
What's the difference between the "name" attribute and the "objectName"
attribute in org.jboss.annotation.ejb.Service? Given they are both optional
what is the default name?
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3934579#3934579
Reply to the post :
I was aware that state in a SLSBs was fine provided it was not conversational
state between the client and the server. I dissmissed that option because the
SLSBs are pooled and in my case clustered. Does an EJB container maintain
coherence in SLSBs? If so that reall is a viable option.
View th
It appears there is no such beast. You have to use the session context of a web
application to host distributed applications. There is no shared context in
Java EE that would allow a Swing front end to share code with a Web front end
or a Web Services interface or an MDB driven interface.
The
They may be nothing more than decorative ornaments on the client side but the
class loader will need to load runtime and class-resident annotations. That
sets up a dependency right out of the box. That a class is required to extend a
specific super type is what makes something lose its PO qualit
How are local entity beans detached? The local session bean uses the entity
manager to find and return an entity bean. What mechanism is responsible for
detaching that bean prior to returning it to, say , the web tier.
Corollary: what is the "injection" mechanism? I know annotations trigger the
I have a service interface created with EJBs. I have a web application that
uses those services but it's optional. What is the business tier equivalent of
the servlet session context? JNDI?
I am building up a data structure from the database so it has no direct
persistence mapping. I want to k
CachedRowSet also fails with Decimal. ResultSet works fine. Obviously there are
serious compatibility problems with the MySQL driver (3.2.12) and JDBC 3.0 (an
official part of Java 5.0. MySQL 5.0 beta driver also fails.
View the original post :
http://www.jboss.com/index.html?module=bb&op=view
My entity beans are working just fine with MySQL and auto-increment keys. When
rendering 2D view-only tables, however, you don't want to marshall a bean only
to flatten it again. I use CachedRowSet for that job but it blows up with an
'unknown type 16' exception on the auto-increment keys.
se
First part of answer is you can use any old list since otherwise it's not a
POJO. Second, you initialize your own collections or pre-check for null.
Pre-initializing is the lesser of two evils.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3933014#3933014
I have a new entity Author and want to add a Book. The book list is empty
which generates an exception in author.getBooks().add( new Book() ). Two
questions.
First, can any old List implementation be used to initialize the list? My
impression was that was a special implementation of List with
That's usually what I've done but that adds another file (manifest) and changes
the build script and then you've got to repeat that for all the jars that use
common.jar. It seems like a lot of needless tinkering when it should just load
jars in the base of the ear listed as "java" modules.
In
Modules have to be an EJB, WAR or application jar. Listing any old jar as a
module only works in JBoss. WLS, for exampe, won't load a plain jar file.
Historically I have used Class-Path settings but was hoping there was now a
more convenient yet portable solution. I guess I will use the applic
My entity beans have enum columns and EJB 3.0 handles the translation without
any intervention on my part -- not even an annotation! Here's my problem: where
can common classes like enums be placed in my EAR such that the entity bean jar
can see them? I do not want to put them IN the jar contain
In the past I would corral all of my queries as string constants in a query
manager class -- an old Indian trick my grandfather taught me. Having a single
location for database queries had a material impact in terms of improving
maintainability.
I believe the objective of @NamedQuery is to pre
Thanks for clarifying I was under the impression the recent JNDI name pattern
was a standard default. The EAR file name prefix does have a bit of an odor to
it but that will evaporate when the web tier gets @EJB injection. Having a
default name is a good thing. I can parameterize the pattern in
They were going to use Foo and Bar as the defaut binding names but a
preliminary study exposed the strategy as sub-optimal for implementations that
were neither single nor dual-bean in nature. The class name seemed like a
suitable, portable, default.
Reasonable or not, I was also visibly upset
Thanks Emmanual. I found the specification sections you are referring to:
2.1.8.4.0
2.1.8.5.1
2.1.8.5.2
BTW, nice introduction here for anybody else wading (plunging in fact) in to
EJB 3.0 as I am:
http://www.ejb3workshop.com/presentation/EJB3Introduction.pdf
View the original post :
http:/
Looking for a WHEN-TO on relationship cascading options. Assuming you have your
owner/inverse relationships correctly constructed, what's the downside in
cascading everthing, always?
TIA
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3932475#3932475
Reply t
Here's a tip for doing a lookup without having to cast: generic method. I've
hard-coded some assumptions that are easy enough to parameterize or use globa
settings with.
|
| public static T getEJB(Class klass) throws NamingException
| {
|return (T) (new InitialContext().lookup("
I am getting frustrated in my attempt to use default names since I don't know
what they are and cannot find a reference. Table and column names were changed
from underscores to camel-case so no problem there: what you see is what you
get. My relations, however, are another story.
What is the
Happily I control the schema so just using this convention in the sql:
create Table MyTable { myColumn ... }
I think, however, the MY_TABLE and MY_COLUMN pattern is by far the most common
and it would be a shame to have to force explicit table/column names for those
guys.
View the original po
Where is the default naming scheme published and is it possible to provide your
own? I assume there's a table, column and intersect (many-to-many) table naming
convention.
Java class: CamelusDromedarius
Table name: CAMELUS_DROMEDARIOUS.
Java property: CamelusDromedarius
Column name: CAMELUS
Good to hear. That annotation is facinating. In general terms, is shows you can
use annotations to override Java's default variable initialization value in any
reference. In this case to supply a container-specific value.
View the original post :
http://www.jboss.com/index.html?module=bb&op=v
Trying to use variable "server" throws a null pointer exception.
| public class Client
| {
|@EJB Server server;
|
|execute(String operation)
|{
| server.execute(operation);
|}
| }
|
Does @EJB lose its magic power in the web tier?
View the original p
The session will timeout. You could configure SFSB timeout in descriptors. Not
sure if there's an EJB 3.0 annotation for that.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3931485#3931485
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=pos
Using JBoss 4.X with Tomcat 5.X you will need standard.jar in WEB-INF/lib. Not
sure why they would not just bundle that and have it loaded once for all web
applications. AFAIK everything else you need is bundled as part of the install.
View the original post :
http://www.jboss.com/index.html
Resource Bundle Redux (oops, forgot code block)
Enumerate messages:
| enum Messages
| {
|UserNameInUser,
|... more ...
| }
|
Load this xml in to Map< Message, Map< Locale, String > >
|
|
|
| User name already in use
| blah blah blah
| d
Resource Bundle Redux
Enumerate messages:
enum Messages
{
UserNameInUser,
... more ...
}
Load this xml in to Map>
User name already in use
blah blah blah
daka daka daka
... more ...
... more messages ...
This strategy puts all the token translatio
Resource bundles do not work with XML or RDBMs which is very telling IMO.
Supports my contention that I8N with resource bundles should be renamed
SteamingResourcePile [audible laughter from crowd].
It seems infinitely simpler to just create a message file for each language,
then load them all
I did not see any mention of a dummy static welcome file mapping in the 2.4
servlet specfiication. Whatever works I suppose. I think I will stick with the
bona fide static welcome file that sets the window location. That also works.
Thanks for the feedbackScott.
View the original post :
http
Workaround until servlet welcome-files are fixed:
Use a static welcome file...
index.html
Containing the following script element...
< body>
< script type="text/javascript">window.location="/navigator"
hang on buddy...
Add query string arguments as needed by your controller, e.g.,
/n
Just add a servlet, with or without a servlet mapping:
Navigator
com.acme.Navigator
Try using "Navigator" as a welcome-file:
Navigator
If the war file is "acme" then http://localhost/acme will NOT go to the
Navigator servlet. Instead the default tomcat servlet is called and you
I understand the current behavior and it is working well. Keep in mind we are
only looking to keep that behavior but extend it with one extra feature:
programmatic login.
I have an idea based on your's and Brian's input. I will report back with
results.
View the original post :
http://w
Posting to j_sercurity_check is not allowed, AFAIK. The container wants to
forward the request to the original target.
Consider the "remember me" login feature. J2ee_junkie says that you have to
ditch form-based login if you need that feature. I think he's high:)
View the original post :
Using JBoss 4.0 with Tomcat (5.X) and added a servlet name as a welcome file in
my webapp. 2.4 servlet container claims you can do this. Rather than providing
a file you just drop in a servlet name as-is with no slashes or any other
baggage; just the servlet net.
Anybody have this working? My
I want to invoke the magic login action with an explicit call. I want the
container to manage authentication just as always does. That is what users want
and in general how authentication is implemented on websites. I don't see how
allowing an explicit authentication call suddenly invalidates fo
We are using JAAS with form based login and j_security_check on our web
application. We want users to login from the home page rather have them be
intercepted when attempting to access a protected resource. We cannot put the
j_security_check form on our home page because it appears it will only
Related advice: why waste time with an inferior product when you can save a
bundle and get Net Beans, Eclipse or IntelliJ? My personal experience with
JBuilder is that it's horribly designed, buggy as hell and extremely
inefficient. It's the bottom of the barrel but ironically the most expensive
Exception starting JBoss on Mac:
| 1:58:29,292 WARN [HANamingService] Failed to start AutomaticDiscovery
| java.net.SocketException: bad argument for IP_MULTICAST_IF: address not
bound to any interface
| .. stack trace ...
|
No biggue since it goes away when a hostname is supplied (e
This is a fundamental question of paramount importance to EJB 3.0 entity bean
development. EJB 3.0 keeps it simple and loads everything. You can take a
different tack and lazy load everything for maximum performance.
When you get an exception such as yours, you can analyze the situation. If tha
FTB, here's an example of an EJB stored procedure. You can use these from, say,
a session bean:
Query query = em.createNativeQuery("exec foo()" );
List bars = query.getResultList();
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3927901#3927901
Reply to
>> Most devs that are dead set against stored procs do not have an open mind.
Too strong. I think also that he was just saying he was not a "fan" versus
anti-stored-procedure.
>> Stored procs offer an interface into the db that is consistent.
That is to say they provide a "uniform implement
Stored procedures have performance benefits and also provide a uniform
implementation when you have Java and other languages using the same resources.
If some client insists on using stored procedures use JDBC. You can call stored
procedures from POJOs or old-style EJB code. Cash client check as
According to the 2.4 servlet specification the login form will only be invoked
on an attempt to access a secured resource. Direct login is not supported.
What I need is a companion to j_security_check that allows me to directly login
a user rather than wait for that user to access a secure reso
I configured my application to use JAAS with FORM based authentication. It
seems to work well enough. Attempting to access a protected page prior to
logging in causes the login page to display. The requested page then displays,
assuming you logged in as a user with the required role.
What is no
http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossHA
"Setting up multiple..." at the bottom.
Not to say it isn't useful; rather, it's not the simplest solution for that
task.
BTW, I tried to add some additional comments to the wiki page but apparenly you
need special powers.
View the original
There's a link on the JBoss HA wiki page for clustering that details an eight
step configuration process for multiple instances of JBoss. I think it creates
the impression that using multiple JBoss instances is complicated when it's
actually a zero-configuration process for JBoss.
On Windows o
http://jira.jboss.com/jira/browse/JBCLUSTER-86
I can use MagicBean for all application scope variables and since it will be
distributed my application scope will be distributed.
The ServletContextAttributeListener will allow me to vacuum up and distribute
servlet context objects but MagicBean-
Are objects in the web container's application scope replicated? If not there
are several alternatives from persistent POJOs (EJB 3.0) to JBoss Cache (a POJO
cache) but it would be useful to transparently replicate the application scope
of a web application, automagically.
TIA
View the origin
The version timestamp has the same problem as the primary key: generated in
entity manager. Therefore looks like I have to use semi-unique business key for
each class as Hibernate suggests.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3926103#3926103
Reply
I have a package of classes that all share a common base class Model. The Model
implements Serializable and houses a few common values important values:
public class Model implements Serializable
{
long id; // primary key
Timestamp version; // optimistic locking aid
boolean deleted; //
Each of my persisted classes has a version property of type Timestamp annotated
with @Version. Guidelines suggest not using the auto-generated primary keys for
equality checks. Is the version timestamp suitable? That would simplify things
since the equals and hashCode overrides would be the same
I want a persistent collection but I do not want anybody accessing the
collection directly. So rather than getProtons you might call addProton:
|
| @Entity class Atom
| {
|...
|public void addProton(Proton proton)
|{
| protons.add(proton);
| proton.set
Side note:
Whoever put together the Trailblazer for EJB 3.0 would help us all by
continuing to create such documetnation. Extremely well organized, crystal
clear and razor sharp in terms of hitting all the points I was interested in.
Thanks!
View the original post :
http://www.jboss.com/inde
The Trailblazer guide on EJB 3.0 is very concise but there are a couple of
minor tidbits that hit me like fingernails scratched across a chalkboard.
First, they have a note about generics and a link to a generics reference. IMO
there should be zero bandwidth taken up with a discussion about ess
Thanks for replies. Turns out I cannot eliminate every URL access to those
resources so I will have to use a bona fide role. Since we use our own home
brewed authentication/authorization, a servlet filter should do the trick.
View the original post :
http://www.jboss.com/index.html?module=bb&o
P.S. We use form-based login without JAAS and would not like to add a login
module if possible. We just want certain extensions to be inaccessible via
direct HTTP request.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3901754#3901754
Reply to the post :
h
I want to block all access to files with a specific extension. I tried using a
security constraint with a non-existent role but that did not prevent acess to
files with the extension "vax".
It is impractical to move these files to a WEB-INF folder so they are out in
the open for the time bein
Microsoft will not display error pages less than 512 bytes based on some
asinine "friendly message" rule. So even after fixing the error on the error
page IE still failed but FF worked fine. Increased the response size with an
image to solve the problem.
View the original post :
http://www.j
There is an error in my error page! Tomcat cannot display the custom error page
so it coughs up the default hairball instead.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3900758#3900758
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=pos
Just created test.war with on hello world page and a web.xml containing the
error-page elements. The error page is in the root of the war. No impact. It
does not display my custom error page. Thanks for trying it. I will poke around
some more and see what gives.
View the original post :
http
What the heck? My location tag is evaporating. Just assume that /NotFound.jsp
is wrapped in an open and closing location tag.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3900746#3900746
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=post
Sorry, forgot to type in the location tag in my original post. This is what is
in my web.xml but the custom error page is not displayed. I get the same old
404 error page you always get from Tomcat.
404
/NotFound.jsp
View the original post :
http://www.jboss.com/index.html?modul
I added this to my web.xml but the standard 404 page is displayed in the
browser. I expected a custom page. The war file is in an ear for whatever
that's worth.
404
/NotFound.jsp
Using JBoss 3.2.7 with Tomcat built-in
View the original post :
http://www.jboss.com/index.html
Anybody know a means of detecting a spoofed referer (sic) in the HTTP header? I
would like to ensure that all access to pages to our site after the login page
originate from our site.
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3898752#3898752
Reply to the
I think therefore I can safely cache the context used for lookups. The other
issue is overlapping create calls from multiple threads on an EJB home. That
it's stateless is promising but you never know if it's scribbling on class
values that preclude overlapping calls. Unless it's stipulated it
I have a question regarding the reentrancy of the create call on EJB home
objects and whether a context lookup is reentrant if its use is restricted to a
lookup. It is safe to assume a multi-threaded J2EE application although that
might be redundant.
View the original post :
http://www.
I wanted to know whether contexts and home interfaces were reentrant
independent of any specific application. Scott indicated neither is (being
undefined is just as good as not being reentrant if portability is an issue).
I am interested in what alternatives exist outside of a lookup/create c
That is frustrating because more than one article exists showing cached JNDI
contexts and home objects. Based on your information we need to create the
context and perform the home lookup every time we need to make EJB calls.
Can you confirm that? Are there more efficient yet still portable and
Are EJB home interfaces thread-safe such that we could create it once and use
it simultaneously from any number of threads? Google doesn't seem to know the
answer to this. There is a mountain of ambiguous and contradictory information
on the topic.
Regarding the Context for looking up the hom
OK, there's jboss.bind.address so that will take care of the host name. That
leaves the port number. That reduces my question to the following:
I How can I programatically retrieve the port number the web container is
listening on before my first request comes in.
View the original post :
ht
The scheme is also dynamic (ftp, https, http, file...) so obviously I will have
to assume that also. That leaves the host and port number. Is there a runtime
config setting for those I can get at somewhere?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=
I frequently load URL based resources and I can get the URL using request
attributes to generate a URL like this: https://acme:8443/portal
The code is dirt simple:
| getURL( HTTPServletRequest r)
| {
| return r.getScheme() + "://" + r.getServerName() + ":" +
| r.g
Agreed, need metrics from production system or a reasonable fax. Pinning each
JVM in a multiple JVM configuration with many threads per JVM may be beneficial
but the proof of the pudding is in the eating as they say.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewto
Correction: keep one JVM pinned to a range of CPUs from one to several. Main
point is each JVM has its own resources to retain cache and minimize memory
contention.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3886934#3886934
Reply to the post :
http://ww
We are running multiple JVMs on a dual CPU box. Each is running the same
application under JBoss so they are sharing the same code and within a JVM
sharing a lot of application data.
Best practice seems to indicate that multi-threaded applications should set
processor affinity to keep the thre
To clarify, the RemoteException is thrown from a stateless session bean and
caught in the web tier. Tested and does work but also know that throwing
RemoteException is a crime with an unstipulated punishment.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=388
I understand RemoteException should not be thrown directly. Say you had a
release where RemoteException was thrown by some session beans: until the next
patch is released, are there any dangers we need to know about?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtop
S'er a way to have CMR sets returned as a SortedSet such as TreeSet?
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3882415#3882415
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3882415
---
... given enough time and money.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3880235#3880235
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3880235
---
This SF.Net
Class loaders are nested to provide isolation. WARs use war-local resources,
EARs use ear-local, ditto for SARs and so on. The configuration is next
followed by jars or classes in the server.
WAR files have the added requirement of an option that stipulates that no
classes outside of system
Yuck! Drop the leading / and use relative paths. Not context required. If you
need absolute use a tag. It's mindbogglingly simple to create tags nowadays; no
code required even. That way the tag can supply the context for absolute paths
and it can check for that.
|
|
View the original
Try capturing the 404 and poking around from there.
|
| 404
| /jboss/whaddup.jsp
|
|
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3872956#3872956
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&m
Correction:
public class ColorMap extends TreeMap {
|public ColorMap() {
| for(Color value : Color.values()) {
| put(value.name(), value.name());
| }
|}
| }
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3872938#3872938
I have come up with a solution so elegant it brings tears to my eyes:)
Color is an enum. I convert it to a map that can be useBean'd and dereferenced
in EL. So my app uses the enum while the JSP uses the same enum in map form.
Sweet!
public class ColorMap extends TreeMap {
public C
Constant management is a major sore point that can be addressed using static
final constants accessed via snipplets. It's ugly but you get compile time
checking versus flakey runtime symptoms from typos.
Enums might improve things but 3.2.6 jasper is using javac without the -source
1.5 switch
Deployed webapp with / as the context-root in jboss-web.xml. The welcome file
in web-xml is login.jsp however if fails to load unless entered explicitly:
This works:
http://host/login.jsp
This brings up the Welcome to JBoss page:
http://host/
Version of JBoss: 3.2.6
View the original p
I want to load one of my own URLs at startup time and would like to build the
URL dynamically. For example: https://foo:8080/bar/baz.xml
I can genrate that URL easily using these request methods and a little glue:
request.getScheme()
request.getServerName()
request.getServerPort()
request.getCo
Oops... try disable HTML.
Foo
generateFoo
Foo[]
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3854540#3854540
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3854540
-
Forgot to quote my XML
Foo
generateFoo
Foo[]
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=385
Are there restrictions on JMX operation return types? Probably an RTFM solution
but nothing jumped out at me. Got this error deploying. String array also
croaked.
Exception: ...
Caused by: java.lang.IllegalArgumentException: Return type is not a valid java
identifier (or is reserved): Foo[]
No replies. Figures given that JSF is a noob on the technology scene. I can always
trace the code in the reference implementation to see what's going on I suppose.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3851182#3851182
Reply to the post :
http://ww
I am evaluating JSF as a possible alternative to JSPs with Struts and have run in to a
problem that might be a design flaw in JSF.
Consider a simple page with one edit box, one drop-down menu and one submit button.
When the menu changes the edit box should display that item's description. You
ORDER is reserved as part of ORDER BY so the error is correct behavior according to
JBoss.
View the original post :
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3845483#3845483
Reply to the post :
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3845483
We are using HTTPS connections to an application running on JBoss 3.2.3. We receive an
SSL error with officially certs in production and with self-signed certs in
development. This problem is not present in 3.2.5 but we are not ready to upgrade at
the moment. Ideas?
TIA!
2004-06-30 10:14:39,
1 - 100 of 118 matches
Mail list logo