Ergent Help Using JBoss, EJBs ...
Hey to all ....
Please help me, i just started EJBs and i am having difficulties with the given project.
So ..
I am using EJB, Jboss too deploy everything
I have created my entities and some sessions.
Entities have created my database correctly.
Now i want to access the data from Jsp.
I Could use some help on that.
I am trying to create the JSP to call the sessions files that i have but i must be doing something wrong.
I have jared both entities and sessions and uploaded them in ejb container.
I am placing my jsp into the jsp container.
i am placing all classes into the web-inf container as well in the jsp container.
HOW will i get the data using the JSp ?
Please some help here.
Perhaps not the best post, but i have no idea what else too post
done it .... :)
Similar Messages
-
Deploy ejb in netbeans using jboss
I would like to know the steps to deploy ejb using jboss in netbeans..or please suggest a site which gives the detailed steps for deployment.
Thank youGoogle
-
How to create a cache for JPA Entities using an EJB
Hello everybody! I have recently got started with JPA 2.0 (I use eclipseLink) and EJB 3.1 and have a problem to figure out how to best implement a cache for my JPA Entities using an EJB.
In the following I try to describe my problem.. I know it is a bit verbose, but hope somebody will help me.. (I highlighted in bold the core of my problem, in case you want to first decide if you can/want help and in the case spend another couple of minutes to understand the domain)
I have the following JPA Entities:
@Entity Genre{
private String name;
@OneToMany(mappedBy = "genre", cascade={CascadeType.MERGE, CascadeType.PERSIST})
private Collection<Novel> novels;
@Entity
class Novel{
@ManyToOne(cascade={CascadeType.MERGE, CascadeType.PERSIST})
private Genre genre;
private String titleUnique;
@OneToMany(mappedBy="novel", cascade={CascadeType.MERGE, CascadeType.PERSIST})
private Collection<NovelEdition> editions;
@Entity
class NovelEdition{
private String publisherNameUnique;
private String year;
@ManyToOne(optional=false, cascade={CascadeType.PERSIST, CascadeType.MERGE})
private Novel novel;
@ManyToOne(optional=false, cascade={CascadeType.MERGE, CascadeType.PERSIST})
private Catalog appearsInCatalog;
@Entity
class Catalog{
private String name;
@OneToMany(mappedBy = "appearsInCatalog", cascade = {CascadeType.MERGE, CascadeType.PERSIST})
private Collection<NovelEdition> novelsInCatalog;
The idea is to have several Novels, belonging each to a specific Genre, for which can exist more than an edition (different publisher, year, etc). For semplicity a NovelEdition can belong to just one Catalog, being such a Catalog represented by such a text file:
FILE 1:
Catalog: Name Of Catalog 1
"Title of Novel 1", "Genre1 name","Publisher1 Name", 2009
"Title of Novel 2", "Genre1 name","Pulisher2 Name", 2010
FILE 2:
Catalog: Name Of Catalog 2
"Title of Novel 1", "Genre1 name","Publisher2 Name", 2011
"Title of Novel 2", "Genre1 name","Pulisher1 Name", 2011
Each entity has associated a Stateless EJB that acts as a DAO, using a Transaction Scoped EntityManager. For example:
@Stateless
public class NovelDAO extends AbstractDAO<Novel> {
@PersistenceContext(unitName = "XXX")
private EntityManager em;
protected EntityManager getEntityManager() {
return em;
public NovelDAO() {
super(Novel.class);
//NovelDAO Specific methods
I am interested at when the catalog files are parsed and the corresponding entities are built (I usually read a whole batch of Catalogs at a time).
Being the parsing a String-driven procedure, I don't want to repeat actions like novelDAO.getByName("Title of Novel 1") so I would like to use a centralized cache for mappings of type String-Identifier->Entity object.
Currently I use +3 Objects+:
1) The file parser, which does something like:
final CatalogBuilder catalogBuilder = //JNDI Lookup
//for each file:
String catalogName = parseCatalogName(file);
catalogBuilder.setCatalogName(catalogName);
//For each novel edition
String title= parseNovelTitle();
String genre= parseGenre();
catalogBuilder.addNovelEdition(title, genre, publisher, year);
//End foreach
catalogBuilder.build();
2) The CatalogBuilder is a Stateful EJB which uses the Cache and gets re-initialized every time a new Catalog file is parsed and gets "removed" after a catalog is persisted.
@Stateful
public class CatalogBuilder {
@PersistenceContext(unitName = "XXX", type = PersistenceContextType.EXTENDED)
private EntityManager em;
@EJB
private Cache cache;
private Catalog catalog;
@PostConstruct
public void initialize() {
catalog = new Catalog();
catalog.setNovelsInCatalog(new ArrayList<NovelEdition>());
public void addNovelEdition(String title, String genreStr, String publisher, String year){
Genre genre = cache.findGenreCreateIfAbsent(genreStr);//##
Novel novel = cache.findNovelCreateIfAbsent(title, genre);//##
NovelEdition novEd = new NovelEdition();
novEd.setNovel(novel);
//novEd.set publisher year catalog
catalog.getNovelsInCatalog().add();
public void setCatalogName(String name) {
catalog.setName(name);
@Remove
public void build(){
em.merge(catalog);
3) Finally, the problematic bean: Cache. For CatalogBuilder I used an EXTENDED persistence context (which I need as the Parser executes several succesive transactions) together with a Stateful EJB; but in this case I am not really sure what I need. In fact, the cache:
Should stay in memory until the parser is finished with its job, but not longer (should not be a singleton) as the parsing is just a very particular activity which happens rarely.
Should keep all of the entities in context, and should return managed entities form mehtods marked with ##, otherwise the attempt to persist the catalog should fail (duplicated INSERTs)..
Should use the same persistence context as the CatalogBuilder.
What I have now is :
@Stateful
public class Cache {
@PersistenceContext(unitName = "XXX", type = PersistenceContextType.EXTENDED)
private EntityManager em;
@EJB
private sessionbean.GenreDAO genreDAO;
//DAOs for other cached entities
Map<String, Genre> genreName2Object=new TreeMap<String, Genre>();
@PostConstruct
public void initialize(){
for (Genre g: genreDAO.findAll()) {
genreName2Object.put(g.getName(), em.merge(g));
public Genre findGenreCreateIfAbsent(String genreName){
if (genreName2Object.containsKey(genreName){
return genreName2Object.get(genreName);
Genre g = new Genre();
g.setName();
g.setNovels(new ArrayList<Novel>());
genreDAO.persist(t);
genreName2Object.put(t.getIdentifier(), em.merge(t));
return t;
But honestly I couldn't find a solution which satisfies these 3 points at the same time. For example, using another stateful bean with an extended persistence context (PC) would work for the 1st parsed file, but I have no idea what should happen from the 2nd file on.. Indeed, for the 1st file the PC will be created and propagated from CatalogBuilder to Cache, which will then use the same PC. But after build() returns, the PC of CatalogBuilder should (I guess) be removed and re-created during the succesive parsing, although the PC of Cache should stay "alive": shouldn't in this case an exception being thrown? Another problem is what to do when the Cache bean is passivated. Currently I get the exception:
"passivateEJB(), Exception caught ->
java.io.IOException: java.io.IOException
at com.sun.ejb.base.io.IOUtils.serializeObject(IOUtils.java:101)
at com.sun.ejb.containers.util.cache.LruSessionCache.saveStateToStore(LruSessionCache.java:501)"
Hence, I have no Idea how to implement my cache.. Can you please tell me how would you solve the problem?
Many thanks!
ByeHi Chris,
thanks for your reply!
I've tried to add the following into persistence.xml (although I've read that eclipseLink uses L2 cache by default..):
<shared-cache-mode>ALL</shared-cache-mode>
Then I replaced the Cache bean with a stateless bean which has methods like
Genre findGenreCreateIfAbsent(String genreName){
Genre genre = genreDAO.findByName(genreName);
if (genre!=null){
return genre;
genre = //Build new genre object
genreDAO.persist(genre);
return genre;
As far as I undestood, the shared cache should automatically store the genre and avoid querying the DB multiple times for the same genre, but unfortunately this is not the case: if I use a FINE logging level, I see really a lot of SELECT queries, which I didn't see with my "home made" Cache...
I am really confused.. :(
Thanks again for helping + bye -
Unable to create database connection using jboss
hi masters,
i have developed an application using jdeveloper ADF, and created .EAR file and deployed it in jboss. it shows that application is deployed, but when using application using URL http://localhost:8080/appl/index.jspx it opens login window, but when we enter username and password it does not authenticate user.
i am not developer, but a DBA and ask to deploy application using jboss. how can i resolve this issue??? while starting , jboss generates error "creating connection to database failed- unauthenticated login attempted"
what might be the issue?????
posting my exact error here, hope someone will post some suggestion.
MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM:
ObjectName: jboss.mq:service=PersistenceManager
state: FAILED
I Depend On: jboss.jca:service=DataSourceBinding,name=DefaultDS
Depends On Me: jboss.mq:service=DestinationManager
java.lang.SecurityException: Invalid authentication attempt, principal=null
ObjectName: jboss:service=KeyGeneratorFactory,type=HiLo
state: FAILED
I Depend On: jboss:service=TransactionManager
jboss.jca:service=DataSourceBinding,name=DefaultDS
Depends On Me: java.lang.SecurityException: Invalid authentication attempt, principal=null
ObjectName: jboss.mq:service=StateManager
state: FAILED
I Depend On: jboss.jca:service=DataSourceBinding,name=DefaultDS
Depends On Me: jboss.mq:service=DestinationManager
org.jboss.mq.SpyJMSException: Error creating connection to the database.; - nested throwable: (java.
lang.SecurityException: Invalid authentication attempt, principal=null)
ObjectName: jboss.ejb:service=EJBTimerService,persistencePolicy=database
state: FAILED
I Depend On: jboss.jca:service=DataSourceBinding,name=DefaultDS
Depends On Me: java.lang.SecurityException: Invalid authentication attempt, principal=null
any suggestion will be appreciated..
thanks and regards
VD
Edited by: vikrant dixit on १९ फ़रवरी, २००९ ९:१६ अपराह्नhello all,
do anyone have any suggestion????
thanks and regards
VD -
Using an EJB as a source for a Model
Hi,
Before starting with this post content it might be helpful to give you the desired output of what I am trying to do. Basically I need to have an HTML table that is populated from an EJB.
The current proposed solution is as follows: the Model that is associated with a TiledView will be used as client for the EJB. The Model will make use of the methods in the EJB to get different java.util.Collection objects for different Helper classes based on the find criteria.
For example, if the EJB represent a book and there is a home method to retrieve a list of books based of the book category. In this case the Model will act as a client of the EJB, retrieve the list of books and use the different methods in the Model, such as insert and retrieve, to get the list of books and to add a book up on request.
I know that my post might not be clear. But as I said, all that is needed is to have a TiledView that displays books information, which are retrieved from an EJB, and allow a user to select a book to display its information.
My suggested solution could be completely wrong, not visible and reflect a bad design. Please if any one went through such a situation give me a hint.
Regards,
Basil MahdiBasil,
This is some material I snipped from an internal Sun forum I posted to regarding a simple EJB Jato integration example.
I hate to give just any EJB JATO example because frankly there are so many different use cases with EJBs that no one example will match up against your needs. You can use an EJB
- in a Custom Model Operation you can encapsulate an EJB Method invocation
- in a Custom Command you can encapsulate any arbitrary code include calling an EJB
- as the backingstore for a CustomModel
- use a BeanAdapterModel to adapt to the value/transfer beans which are uses as parameters or return values of EJB methods
- use an ObjectAdapterModel to adapt an EJB directly by assigning the EJB reference in setObject() in the constructor of the OAM
As you can see, an EJB is just another business object API...its just that you acquire the reference with a few lines of ugly JDNI and Home interface APIs.
Nevertheless, here is some guidance. I would like to reinforce that there is no direct solution for adapting an EJB from BAM; EJBs are not JavaBeans. What is a solution is to have the parameters or return values of your EJBs use value/transfer object patterns in the form of JavaBeans. The BAM may be used to adapt to these parameters or return value of the EJB.
In short, when using BAM in a tileview to work with an EJB, there is little difference than using BAM at any other time, you the developer, must manage/code the placement of the EJB parameters directly into the BAM or in a scoped attribute to be used by the BAM.
In another example, you may have a SLSB which models an employee called EmployeeSupport. You may have a transfer object (JavaBean) of type EmployeeRecord. You may have operations on the EJB including:
public EmployeeRecord findEmployee(String employeeID);
public EmployeeRecord[] findEmployees(String location);
public void updateEmployee(EmployeeRecord);
One could create a BAM in the studio called EmployeeModel
You would set the JavaBean class to EmployeeRecord
You would run the Design Action to bootstrap the properties of EmployeeRecord as fields on the model
Now you have a model which is ready to adapt to EmployeeRecord bean.
Feel free to add material to the EmployeeModel to make a richer API; for instance you could encapsulate some EJB'ish code in their to act as a service locator for a EmployeeSupprt SLSB.
protected static EmployeeSupport support;
static {
javax.naming.Context context = new javax.naming.InitialContext();
Object objref = context.lookup("ejb/EmployeeSupport");
EmployeeSupportHome home = (EmployeeSupportHome)
javax.rmi.PortableRemoteObject.narrow(objref,EmployeeSupportHome .class);
support = home.create();
public static EmployeeSupport getEmployeeSupport() {
return support;
If you really wanted to hide the EJB'ishness of the EmployeeSupport you could even wrap the behavior and handle exceptions, etc.
public static EmployeeRecord findEmployee(String employeeID) {
return getEmployeeSupport().findEmployee(employeeID);
public static EmployeeRecord[] findEmployees(String location) {
return getEmployeeSupport().findEmployees(location);
public static void updateEmployee(EmployeeRecord record) {
return getEmployeeSupport().updateEmployee(record);
You could even help the view developer latch EJB transfer objects into the model for adaption; saving them from the effort
public void adaptEmployee(String employeeID) {
setBean(findEmployee(employeeID));
public void adaptLocation(String location) {
setBean(findEmployees(location));
public void save() {
updateEmployee((EmployeeRecord)getBean());
Create a search ViewBean, place a text field on it for an EmployeeID and button labeled Find. Leave the EmployeeID model binding default (to use a DefaultModel memory model). Open the handle request event method on the viewbean for the Find button.
public void handleFindRequest....{
EmployeeModel model = .....;
model.adaptEmployee(getEmployeeIDChild().getValue());
// display Edit page which has fields for editing the employee record
Create an edit ViewBean, with editable fields bound to the EmployeeModel; add an button labeled update
public void handleUdpateRequest....{
EmployeeModel model = .....;
model.save();
// do whatever is next ....
Notice that the we are jumping across request boundaries in this example. Using just default model reference configurations, the EmployeeModel will be created brand new during the Update request and there will be no bean currently adapted. Most likely, you would want to have the model (and hence its adapted bean) stored in HttpSession across at least these related requests. In this case the model reference used by the search ViewBean would have "store in session" true. and the model reference in the edit ViewBean would have "look in session" true.
What we recommend is that someone who understands the business tier design take the responsibility to create a set of "business delegates" as JATO models. An advanced technique would be to encapsulate these models in a component library JAR which multiple web applications can reuse. As you can imagine, there are so many ways to do the same thing. You could just as easily make a CustomModel or SimpleCustomModel to adapt to your EJB. You can also, if your EJB uses primitives or JavaBeans (or graphs of JavaBeans) for all parameters, use the ObjectAdapterModel to directly connect to an EJB. -
Hi,
I am using jboss 4.2, java5.0 and Fedora Linux Enterprise Version 4.0 with kernel 2.6 and NPTL 2.3.4
I am using open source network chart generation API provided by geosoft ( http://geosoft.no/graphics/). This API generates chart into swing window.
I wrote the code to change this swing window into web browser compatible jpeg image. I used thread to generate the image. It is working fine, for one user and no other processes running on the application.
ISSUE:- When more than 5 users hit the application at the same time, some images get generated, some donot, there is no fixed trend to this image generation process.
I analyzed CPU timing, it is using 100% CPU and after the images are generated / not generated, the CU usage goes down to zero.
When I used the same code with Linux 9.0 (kernel 2.4, NPTL � 0.6), rest remain the same, it is working perfectly fine with more than 10 users, with all images being generated within 30 secs
Can somebody help me out to figure out whether it is a kernel issue / NPTL issue? Does it have something to do with thread processing?
Code for network chart generation :-
NetworkGenerator ntw=new NetworkGenerator();
BufferedImage img;
ntw.setVectRootNodes(vectRootNodes);
ntw.setHashChildNodeNames(hashNodeData);
ntw.setHashNodeRelation(hashNodeRelation);
ntw.setHashNodesCreated(hashNodesCreated);
ntw.setSupplyChainBean(supplyChainBean);
Thread t=new Thread(ntw);
t.setPriority(Thread.MAX_PRIORITY);
t.start();
try{
t.join();
catch(Exception e)
DebugManager.doDebug(className.toString(),e);
if(t!=null)
System.out.println(t.getState().name());
System.out.println(t.isAlive());
public class NetworkGenerator extends JFrame implements Runnable{
public void run()
//call the garbage collector
System.gc();
// Create the graphic canvas
window = new no.geosoft.cc.graphics.GWindow();
window.getCanvas().setSize(screenWidth,screenHt );
// Create the GUI
JPanel topLevel = new JPanel();
topLevel.setBackground(new Color(255,255,255)) ;
topLevel.setLayout (new BorderLayout());
getContentPane().add (topLevel);
topLevel.add (window.getCanvas(), BorderLayout.CENTER);
topLevel.setVisible(true);
// Create scene with default viewport
scene = new no.geosoft.cc.graphics.GScene(window, "My Scene"+ (new Date().getTime()));
no.geosoft.cc.graphics.GStyle style = new no.geosoft.cc.graphics.GStyle();
style.setForegroundColor (new Color (0, 0, 0));
style.setBackgroundColor (new Color (255, 255, 255));
style.setFont (new Font ("Arial", Font.BOLD, 10));
scene.setStyle (style);
int xPos=minY ;
int yPos=0;
int noofChild=vectRootNodes.size();
int dev=(screenHt -minY )/(noofChild+1);
int newDev=Math.round(dev-(dev/5));
//log.debug("---------noofChild-----------------------------------"+noofChild);
if(!hashNodesCreated.isEmpty())
for(int i=0;i<noofChild;i++)
yPos=minY +(dev*(i+1));
String nodeName = vectRootNodes.get(i).toString();
log.debug("root nodename===="+nodeName+" with ypos :"+yPos);
//log.debug("nodeName=="+nodeName);
//create root nodes
Node rootNode = createChildNode( nodeName,minY,screenHt,xPos, yPos ,newDev,1);
scene.add(rootNode);
log.debug("screenWidth ===="+screenWidth );
// if(screenWidth>minExtXval)
// minExtXval = screenWidth;
// w2 o
// * |
// * |
// * |
// * w0 o-------o w1
double w0[] = {0.0,screenHt ,0.0};
double w1[] = {screenWidth,screenHt,0.0};
double w2[] = {0.0,0.0,0.0};
scene.setWorldExtent (w0, w1, w2);
this.pack();
Thanks in advance.How do I do that as I checked for it in utilities and is not there? Thanks in advance
-
How to Struts and Spring in NetBeans using Jboss
Hi Every One,
I have a some basic Knowledge in Struts Spring and Hibernate. I already worked in it with Eclipse IDE in WebSphere Server...
But Now i want to How to Use Struts Spring and Hibernate in NetBeans using JBoss i need that Folder Structure like that Stuffs
Can Anybody Help Me for thisGoogle
-
Using Local EJB obect in web container that installed in on the same Web AS
we can use the local ejb object in the application that runs in same JVM.
The Web Container and EJB Container run in the same JVM when Web AS installed as Minimum Cluster Installation(one cluster node).
But, what happened if we install the Web AS as Large Cluster Installation? Can we still use the local ejb objects in the Web Container?
Best regards,
Raja
Message was edited by: Raja NasrallahHi Raja,
Yes you can. When you use local EJB objects there's no remote communication and the web container will find them in the EJB container of the local cluster node. For the application providers this is transparent - they shouldn't care about the configuration of the cluster.
Best regards,
Vladimir
PS: Please consider <a href="https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm#lostme">rewarding points</a> for helpful answers. -
When to use the EJB tier?
Could someone explain in simple and general terms when, say for a brand new application, you should or should not use the EJB tier over retaining everything in the web tier? Obviously it will depend on what the application is, but how so?
I generally use EJBs when i want propper transactional support in my webapps as you get lots of stuff thrown in ejbs thats saves me having to write code.
There are loads of reasons why you should / shouldnt use ejbs though so have a look at these for a bit more info.
When to use EJBs :
http://www.jguru.com/faq/view.jsp?EID=126400
or alternatively .....
When not to use EJBs
http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&f=11&t=006707
Hope thats helps.
Gaz. -
Using JBOSS JMS provider with XI
Hi,
I am connecting XI to a custom Java application developed on JBOSS app server. The custom application is developed with connectivity using JMS. I was told that JBOSS has a JMS provider used by the custom app. Has anyone done this before? Is it possible for XI to use JBOSS JMS provider? How difficult is this going to be for synchronous interface? Any information is greatly appreciated.
thanks.
James Changhi,
first deploy jboss-j2ee.jar,jms.jar,dom4j-full.jar..for deploying these jars into the xi follow this link
http://help.sap.com/saphelp_nw04s/helpdata/en/33/e6fb40f17af66fe10000000a1550b0/frameset.htm
then to make use of the JMS adapter follow this link,
http://help.sap.com/saphelp_nw04s/helpdata/en/4d/a3bc97ff55c742af7faed661635baf/frameset.htm
hope this will be useful.....
regards,
Sundararamaprasad -
Re: Tutorial: Using an EJB Project
I am a computer engineering student who is learning weblogic. I appreciate if
anyone can help me with my question on Using an EJB Project
This tutorial can be found in weblogic 8.1: go to workshop ->help->Tutorials and
samples-> Using an EJB project
On page 11, section: Create a web application, it asks to import a webapp file
that nowhere to be found in beahome. Where can I find webapp file for this
ejb example
Thanks very much,
JessicaHi Jessica,
If I'm understanding your question correctly you're running
the EJB tutorial that's being shipped with the 8.1 beta correct?
I just did a quick check on my installation of the pre-beta installer
and didn't see it there so it's possible there's a bug in the installer
or something. At any rate, I've attached a zipped up copy of that
tutorial code here. Hope that helps.
Michael Kovacs
Senior Software Engineer
BEA Systems
"Jessica " <[email protected]> wrote in message
news:3e9b0cfc$[email protected]..
>
I am a computer engineering student who is learning weblogic. Iappreciate if
anyone can help me with my question on Using an EJB Project
This tutorial can be found in weblogic 8.1: go toworkshop ->help->Tutorials and
samples-> Using an EJB project
On page 11, section: Create a web application, it asks to import a webappfile
that nowhere to be found in beahome. Where can I find webapp file forthis
ejb example
Thanks very much,
Jessica[EJBProject.zip] -
Why i canot deploy cd.jar when using JBoss on linux
Hi,friends
I have successfully deploy the interest.jar on my linux box.But when deploying cd.jar it tells me that "Could not deploy file:/usr/local/JBoss-2.4.3_Tomcat-3.2.3/jboss/tmp/deploy/Default/cd.jar,
Cause:org.jboss.ejb.DeploymentException: Bean com.web_tomorrow.cd.CDBean not found within this application."
The source directory is described as below:
src
|_com
| |_web_tomorrow
| |_cd
| | (CD.class,CDBean.class,CDHome.class,
| | CDCollection.class,
| | CDCollectionBean.class,
| | CDCollectionHome.class,
| | CDExistsException.class)
| |_jspcd
| |_utils()
|_MATA-INF
| (ejb-jar.xml,jboss.xml)
|_WEB_INF
On src directory
#jar -cvf cd.jar com/web_tomorrow/cd/*.class \
com/web_tomorrow/utils/*.class META-INF/
When i cp the cd.jar to deploy directory jboss automatically begin deploying the cd.jar and echo the above message and stop deploying.
Here is my configuration file:
[ejb-jar.xml]
<?xml version="1.0" encoding="Cp1252"?>
<ejb-jar>
<display-name>MusicCDs</display-name>
<enterprise-beans>
<entity>
<description>Models a music CD</description>
<ejb-name>CDBean</ejb-name>
<home>com.web_tomorrow.cd.CDHome</home>
<remote>com.web_tomorrow.cd.CD</remote>
<ejb-class>com.web_tomorrow.cd.CDBean</ejb-class>
<persistence-type>Container</persistence-type>
<prim-key-class>java.lang.String</prim-key-class>
<reentrant>False</reentrant>
<cmp-field><field-name>id</field-name></cmp-field>
<cmp-field><field-name>title</field-name></cmp-field>
<cmp-field><field-name>artist</field-name></cmp-field>
<cmp-field><field-name>type</field-name></cmp-field>
<cmp-field><field-name>notes</field-name></cmp-field>
<primkey-field>id</primkey-field>
</entity>
<session>
<description>Models a music CD collection</description>
<ejb-name>CDCollectionBean</ejb-name>
<home>com.web_tomorrow.cd.CDCollectionHome</home>
<remote>com.web_tomorrow.cd.CDCollection</remote>
<ejb-class>com.web_tomorrow.cd.CDCollectionBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<ejb-ref>
<ejb-ref-name>ejb/CD</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.web_tomorrow.cd.CDHome</home>
<remote>com.web_tomorrow.cd.CD</remote>
<ejb-link>com.web_tomorrow.cd.CDBean</ejb-link>
</ejb-ref>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>CDBean</ejb-name>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
</container-transaction>
</assembly-descriptor>
</ejb-jar>
[jboss.xml]
<?xml version="1.0" encoding="Cp1252"?>
<jboss>
<secure>false</secure>
<container-configurations />
<resource-managers />
<enterprise-beans>
<session>
<ejb-name>CDCollectionBean</ejb-name>
<jndi-name>cd/CDCollection</jndi-name>
<configuration-name></configuration-name>
</session>
<entity>
<ejb-name>CDBean</ejb-name>
<jndi-name>cd/CD</jndi-name>
<configuration-name></configuration-name>
</entity>
</enterprise-beans>
</jboss>
I am frustrated now! Any help is greatly appreciated!
Best Regards!$(jboss_home)/log/server.log told me that i should have a look at Container.java first.So i openned it and found the following code snippet:
Logger.debug("Binding an EJBReference "+ref.getName());
if (ref.getLink() != null) {
// Internal link
Logger.debug("Binding "+ref.getName()+" to internal JNDI source: "+ref.getLink());
Container refContainer = getApplication().getContainer(ref.getLink());
if (refContainer == null)
throw new DeploymentException ("Bean "+ref.getLink()+" not found within this application.");
OK,the DeploymentException is thrown because the refContainer is null.
Have a look at getContainer method below:
public Container getContainer(String name)
return (Container)containers.get(name);
where,
containers is a HashMap which holds the mapping between ejbName and container.So the reason is the jboss cannot find corresponding container from the given parameter - name.Its value is ref.getLink()'s return value,com.web_tomorrow.cd.CDBean.
open the ejb-jar.xml,i found link is defined as below:
<ejb-ref>
<ejb-ref-name>ejb/CD</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.web_tomorrow.cd.CDHome</home>
<remote>com.web_tomorrow.cd.CD</remote>
<ejb-link>com.web_tomorrow.cd.CDBean</ejb-link> <- wrong
</ejb-ref>
After i changed it to <ejb-link>CDBean</ejb-link> the jboss can deploy cd.jar normally.
The problem itself isnot complicate but it demonstrated that the open source is good for you to fix the bug up!
BTW,in order to making it easy to fix the bug, the jboss binay version is built with debug infomation.So you can rebuid it without any debug infomation.
<target name="compile" depends="prepare">
<mkdir dir="${build.classes.dir}"/>
<javac srcdir="${src.dir}"
destdir="${build.classes.dir}"
debug="on" <- change it to "off"
deprecation="off"
optimize="on"
includes="org/**"
excludes="**/activation/**, **/*BeanInfo.java"
>
<classpath refid="classpath"/>
</javac>
</target>
Thanks for all your help! -
IllegalStateException in View (using JBOSS and ADF)
Hi:
I have a project using JBOSS and ADF. I have a form with the following code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<%@ page contentType="text/html"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://xmlns.oracle.com/adf/faces" prefix="af" %>
<%@ taglib uri="http://xmlns.oracle.com/adf/faces/html" prefix="afh" %>
<f:view>
<afh:html id="html">
<afh:head title="FisaSystem">
<meta http-equiv="Content-Type"
content="text/html; charset=windows-1252" />
<link rel="stylesheet" type="text/css" media="screen" title="screen" href="<%=request.getContextPath()%>/common/skins/fisaClassic/screen.css" />
</afh:head>
<afh:body id="body">
<h:form id="form">
<af:panelPage>
<af:showOneTab id="showOneTab" position="above">
<af:showDetailItem text="" id="showDetailItem">
<af:panelForm id="panelForm">
<af:inputText id="clasificationDescription" binding="#{clasificationManager.clasificationDescription}" required="true" />
</af:panelForm>
</af:showDetailItem>
</af:showOneTab>
<f:verbatim>
<div class="actions">
</f:verbatim>
<af:panelButtonBar>
<af:commandButton id="saveButton" text="#{internationalizationManager.saveButton}" action="#{clasificationManager.saveClasification}" />
<af:commandButton id="cancelButton" text="#{internationalizationManager.cancelButton}" action="#{clasificationManager.cancelClasification}" immediate="true" />
</af:panelButtonBar>
<f:verbatim>
</div>
</f:verbatim>
</af:panelPage>
</h:form>
</afh:body>
</afh:html>
</f:view>
the backing bean for that form i like this:
package com.fisa.efisa.document.manage.bean;
import java.util.Collection;
import oracle.adf.view.faces.component.UIXInput;
import oracle.adf.view.faces.component.UIXTable;
import oracle.adf.view.faces.context.AdfFacesContext;
import oracle.adf.view.faces.event.LaunchEvent;
import oracle.adf.view.faces.event.ReturnEvent;
import com.fisa.efisa.document.dto.EFPClasification;
import com.fisa.efisa.document.manage.common.CommonBackingBean;
import com.fisa.efisa.process.document.persistence.TdmmClasification;
import com.fisa.efisa.process.document.service.ServiceClasification;
import com.fisa.efisa.process.document.service.delegate.ServiceClasificationDelegate;
import com.fisa.efisa.process.engine.service.ServiceProcessEngine;
import com.fisa.efisa.process.engine.service.delegate.ServiceProcessEngineDelegate;
import com.fisa.util.Action;
import com.fisa.util.message.FTransactionMessage;
import com.fisa.util.message.Field;
import com.fisa.util.message.FisaMessage;
public class ClasificationBackingBean extends CommonBackingBean {
private final String CLASIFICATION_IDENTIFIER = "clasification";
ServiceClasification serviceClasification;
ServiceProcessEngine serviceProcessEngine;
UIXTable clasificationTable;
UIXInput clasificationDescription = new UIXInput();
public ClasificationBackingBean() {
serviceClasification = new ServiceClasificationDelegate();
serviceProcessEngine = new ServiceProcessEngineDelegate();
public Collection getClasificationList() {
return serviceClasification.findAllClasification(getFisaUserData());
public String addClasification() {
return ADD_OUTCOME;
public String editClasification() {
TdmmClasification row = (TdmmClasification) this.clasificationTable.getSelectedRowData();
if (row != null)
storeObjectInRequest(this.CLASIFICATION_IDENTIFIER, row.getClasificationId());
else
return null;
return EDIT_OUTCOME;
public String saveClasification() {
return LIST_OUTCOME;
public String deleteClasification() {
if (this.clasificationTable.getSelectedRowData() != null)
return CONFIRM_DELETE_KEY;
return null;
public void handleConfirmDeleteReturn(ReturnEvent event) {
if (event.getReturnValue() != null) {
AdfFacesContext.getCurrentInstance().addPartialTarget(this.clasificationTable);
public void handleConfirmDeleteLaunch(LaunchEvent event) {
Object row = this.clasificationTable.getSelectedRowData();
if (row != null)
event.getDialogParameters().put(DELETE_OBJECT_KEY, row);
public String cancelClasification() {
return LIST_OUTCOME;
public UIXTable getClasificationTable() {
return clasificationTable;
public void setClasificationTable(UIXTable clasificationTable) {
this.clasificationTable = clasificationTable;
public UIXInput getClasificationDescription() {
if (this.getClasificationFromRequest() != null)
clasificationDescription.setValue(this.getClasificationFromRequest().getDescription());
return clasificationDescription;
public void setClasificationDescription(UIXInput clasificationDescription) {
this.clasificationDescription = clasificationDescription;
private EFPClasification getClasificationFromRequest() {
Long rowId = null;
if (retrieveObjectFromRequest(this.CLASIFICATION_IDENTIFIER) != null) {
rowId = (Long) retrieveObjectFromRequest(this.CLASIFICATION_IDENTIFIER);
FisaMessage fisaMessage = new FisaMessage();
fisaMessage.setHeader(getMessageHeader());
FTransactionMessage transactionMessage = new FTransactionMessage();
transactionMessage.setFtmApplicationId(getApplicationId());
transactionMessage.setFtmSourceSystemId(getSystemId());
transactionMessage.setFtmSubSystemId(getSubsystemId());
transactionMessage.setFtmBusinessTemplateId(getClasificationBtId());
EFPClasification efpClasification = new EFPClasification(transactionMessage);
Field field = new Field();
field.setValue(rowId.toString());
transactionMessage.addField(efpClasification.CLASIFICATION_ID, field);
transactionMessage.setFtmActionId(Action.QUERY_LIVE);
transactionMessage.setBtDataKey(rowId.toString());
fisaMessage.getFTransactionMessages().put(getClasificationBtId(), transactionMessage);
fisaMessage = this.serviceProcessEngine.executeMessage(fisaMessage);
transactionMessage = fisaMessage.getFTransactionMessages().get(getClasificationBtId());
efpClasification = new EFPClasification(transactionMessage);
return efpClasification;
return null;
And this is my faces-config
<?xml version="1.0"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>client</param-value>
<!--param-value>server</param-value-->
</context-param>
<context-param>
<param-name>
oracle.adf.view.faces.USE_APPLICATION_VIEW_CACHE
</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>
oracle.adf.view.faces.ENABLE_DMS_METRICS
</param-name>
<param-value>false</param-value>
</context-param>
<context-param>
<param-name>
oracle.adf.view.faces.CHECK_FILE_MODIFICATION
</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>
oracle.adf.view.faces.CHANGE_PERSISTENCE
</param-name>
<param-value>session</param-value>
</context-param>
<filter>
<filter-name>adfFaces</filter-name>
<filter-class>
oracle.adf.view.faces.webapp.AdfFacesFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>adfFaces</filter-name>
<servlet-name>faces</servlet-name>
</filter-mapping>
<!-- Faces Servlet -->
<servlet>
<servlet-name>faces</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<!-- resource loader servlet -->
<servlet>
<servlet-name>resources</servlet-name>
<servlet-class>
oracle.adf.view.faces.webapp.ResourceServlet
</servlet-class>
</servlet>
<!-- Faces Servlet Mappings -->
<servlet-mapping>
<servlet-name>faces</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>resources</servlet-name>
<url-pattern>/adf/*</url-pattern>
</servlet-mapping>
<!-- Welcome Files -->
<welcome-file-list>
<welcome-file>index.jspx</welcome-file>
</welcome-file-list>
<!-- ADF Faces Tag Library -->
<taglib>
<taglib-uri>http://xmlns.oracle.com/adf/faces</taglib-uri>
<taglib-location>/WEB-INF/af.tld</taglib-location>
</taglib>
<taglib>
<taglib-uri>http://xmlns.oracle.com/adf/faces/html</taglib-uri>
<taglib-location>/WEB-INF/afh.tld</taglib-location>
</taglib>
<!-- Faces Core Tag Library -->
<taglib>
<taglib-uri>http://java.sun.com/jsf/core</taglib-uri>
<taglib-location>/WEB-INF/jsf_core.tld</taglib-location>
</taglib>
<!-- Faces Html Basic Tag Library -->
<taglib>
<taglib-uri>http://java.sun.com/jsf/html</taglib-uri>
<taglib-location>/WEB-INF/html_basic.tld</taglib-location>
</taglib>
<login-config>
<auth-method>BASIC</auth-method>
</login-config>
</web-app>
As you see there's nothing really weird about this at all; if i use this page as displayed, i click on any of the buttons and everything works fine. But, if i add any other property to the clasificationDescription adf:inputText (a label for example), then it crashes with this error:
java.lang.IllegalStateException: Invalid index
oracle.adf.view.faces.bean.util.StateUtils.restoreKey(StateUtils.java:57)
oracle.adf.view.faces.bean.util.StateUtils.restoreState(StateUtils.java:129)
oracle.adf.view.faces.bean.util.AbstractPropertyMap.restoreState(AbstractPropertyMap.java:94)
oracle.adf.view.faces.bean.FacesBeanImpl.restoreState(FacesBeanImpl.java:247)
oracle.adf.view.faces.component.UIXComponentBase.restoreState(UIXComponentBase.java:761)
oracle.adf.view.faces.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:749)
oracle.adf.view.faces.component.TreeState.restoreState(TreeState.java:80)
oracle.adf.view.faces.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:743)
oracle.adf.view.faces.component.TreeState.restoreState(TreeState.java:80)
oracle.adf.view.faces.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:743)
oracle.adf.view.faces.component.TreeState.restoreState(TreeState.java:80)
oracle.adf.view.faces.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:743)
oracle.adf.view.faces.component.TreeState.restoreState(TreeState.java:80)
oracle.adf.view.faces.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:743)
oracle.adf.view.faces.component.TreeState.restoreState(TreeState.java:80)
oracle.adf.view.faces.component.UIXComponentBase.processRestoreState(UIXComponentBase.java:743)
javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:1019)
oracle.adfinternal.view.faces.application.StateManagerImpl.restoreView(StateManagerImpl.java:330)
com.sun.faces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:228)
oracle.adfinternal.view.faces.application.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:232)
com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:157)
com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:90)
javax.faces.webapp.FacesServlet.service(FacesServlet.java:197)
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._invokeDoFilter(AdfFacesFilterImpl.java:367)
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl._doFilterImpl(AdfFacesFilterImpl.java:336)
oracle.adfinternal.view.faces.webapp.AdfFacesFilterImpl.doFilter(AdfFacesFilterImpl.java:196)
oracle.adf.view.faces.webapp.AdfFacesFilter.doFilter(AdfFacesFilter.java:87)
org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
What can be happening ???This forum is only for questions directly related to the Sun Web Server. I think you should post your questions in the jboss forums. Alternative, you could use one of the sun products and then we would be able to help you ;)
-
hi,
can anyone provide some sample code or some info on how to write a JMX client in java(stand alone java program) which invokes a method in JMX service(using jboss API's)
thanksHi,
I recently had a similar problem, the PortableRemoteObject.narrow(...) is not implemented to cater for ejb3 in earlier versions of JBoss - including JBoss4.x. I deployed my ejb3 on JBoss5 and everything works well.
Another alternative is to use a standalone client...it worked well for me!
Hope this helps. -
How to run jsp and servlet using JBOSS server
Dear Friend,
I have JBoss application server and Eclipse id
now i want to run JSP and Servlet but i am not getting the place where to place my servlet class file to run it .
before that i run jsp and servlet using tomcat5.0 but in that i place my servlet class in WEB-INF/classes folder and do corresponding entry in web.xml file and run it through browser.
now i want to use JBOSS how it is possible
PLZ Help meIs the servlet class defined in a package.? If servlet class package is servlets., copy the servlet to
WEB-INF/classes/servlets directory.
Maybe you are looking for
-
How to delete just one page in Pages 4.3
Hello I am having an issue with trying to delete just one page out of the 47 pages that I have created. If I try to delete page 12 it will delete 12-47 instead of just page 12. I also cant seem to move or adjust the yellow box in thumnails in order t
-
How do I find music gifted to me?
I gifted a single song to my girlfriend but I don't see anywhere in iTunes for accessing music gifted to you... If you have to click on an email then I am truly disappointed in Apple for this 90's functionality.
-
Upgrading to Mac OS X lion - problems having a bootcamp partition?
I was just wondering if i should delete my bootcamp partition running windows 7 before i install Mac OS X Lion? Btw, the format of the partition is NTFS (if this is at all relavent).
-
NOKIA 5130 -UNABLE TO CONNECT TO GPRS CONNECTION
I have bought new Nokia 5130 Express Music handset on 26 Dec 2009 and Reliance GSM post paid connection. I have got settings from reliance from GPRS, WAP and MMS setting. The problem faced is whenever, I connect to opera mini browser, it connecting f
-
Change COMIM-NOAUS (BQPIM-NOAUS) No box listing sources of supply
Hi experts! I am using the exit EXIT_SAPLMEQR_001 / ZXM06U52 where I change the vendor and the inforecord by automatic source allocation using tcode ME56. Any way, the system display the purchasing source list because the field COMIM-NOAUS is initial