This week's book giveaway is in the Server-Side JavaScript and NodeJS forum.
We're giving away four copies of Micro Frontends in Action and have Michael Geers on-line!
See this thread for details.
Win a copy of Micro Frontends in Action this week in the Server-Side JavaScript and NodeJS forum!

Chad Foor

Greenhorn
+ Follow
since Jul 03, 2007
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Chad Foor

Hi,

I have a situation where I'm trying to display a simple ArrayList<MyRecord> within an <h:dataTable> outtput:

<h:dataTable value="#{form.queryBean.Records}" var="item">
...
<h:column>
<h:outputText value="#{item.firstValue}"/>

<h:outputText value="#{item.secondValue}"/>
...
</h:column>

(This works fine.)

However, I have a new situation now where I want to bind a nested <h:panelGrid> and define this within the MyRecord class.


So, instead of MyRecord being some simple bean with primitive objects and appropriate getters / setters, it now contains this embedded HtmlPanelGrid object:

public class MyRecord
{
private String firstValue;
private String secondValue;

private HtmlPanelGrid myPanel;

// appropriate getters and setters ...

public HtmlPanelGrid getMyPanel()
{
// set up and declare a list of children nodes inside here to be displayed back... This will
// be a collection of <h:outputText> and <h:commandLink> children...
}

}

...................

What I'd like to do is this: (modified from the original)

<h:dataTable value="#{form.queryBean.Records}" var="item">
...
<h:column>
<h:outputText value="#{item.firstValue}"/>

<h:outputText value="#{item.secondValue}"/>

<h:panelGrid binding="#{item.myPanel}"/>

</h:column>

</h:dataTable>

...and call it done.

JSF 1.2 barfs on this declaration because it is trying to evaluate "item" here prematurely. (This dataTable is being built
after certain events happen on the form itself and is rendered appropriately once the data gets populated.) It makes sense to
do this inner binding in the application that I'm working with.

The question is - How do I get the appropriate syntax to work ? I've tried using the 'rendered' attribute, but JSF 1.2 seems to
ignore it when it's embedded like this. (rendered set within the parent <h:dataTable> tag.)


What am I doing wrong here ?

Appreciate any inputs.

Thanks,
Chad

11 years ago
JSF
Hi,

I've got the following scenario:

A simple, stateless session bean that's deployed to a JBoss-4.2.2-GA server. The relevant EJB-Jar.xml syntax is listed like so -
...
<enterprise-beans>
<session>
<display-name>AdviceBean</display-name>
<ejb-name>Advisor</ejb-name>
<home>headfirst.AdviceHome</home>
<remote>headfirst.Advice</remote>
<ejb-class>headfirst.AdviceBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Bean</transaction-type>
<security-identity>
<description/>
<use-caller-identity/>
</security-identity>
</session>
</enterprise-beans>
...

I have a client application that lives on a different box that has the
following JNDI code:

public void initializeReferences()
{
Hashtable myEnv = new Hashtable();

myEnv.put(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
myEnv.put
(Context.URL_PKG_PREFIXES, "org.jboss.naming rg.jnp.interfaces");
myEnv.put
(Context.PROVIDER_URL, "jnp://com.myServer:1099");

try {
Context ic = new InitialContext(myEnv);

Object o = ic.lookup("Advisor/remote");

AdviceHome home = (AdviceHome)PortableRemoteObject.narrow( o, AdviceHome.class);
advisor = home.create();

...

the problem with this setup (although it works when I have both the session bean and client running on the same box) doesnt work when I separate the two.

I have the client code as part of a web application trying to do this lookup running under Tomcat. (But again, on another box.)


I've trapped each line of the client code and the naming exception I'm getting is when the client tries to do ic.lookup("Advisor/remote");

I've tried several variations of this JNDI name and the references I see under JBoss aren't too helpful.

Can someone help ?



}
12 years ago
doh. Thanks. I feel silly now.
12 years ago
JSF
Hi,

I have a situation where I have an index.jsp with teh following declarations:

<h:datatable id="tiger" rows="10" ...>
...
</h:datatable>

<h:commandButton id="alterMe" actionListener="#{myForm.togglePagination}"/>

In the backing bean, I have the code for the actionListener as follows:

void togglePagination(ActionEvent e)
{


}

What I'm trying to do is modify the <h:dataTable> element from the command button declared in the actionListner to re-set the rows="10" to something else.

Ideally, get a reference to something like:

HtmlDataTable myPointer = (HtmlDataTable)e.getComponent.getAttributes("tiger");
myPointer.Rows = 80;

or some variation. I can find the id of the command button easily enough, but in this case the command button is a sibling of the datatable element as it's laid out on the page. (It's not a child declared inside.)

How might I go about setting this up ?

Apprciate any advice.

Thanks,
Chad
12 years ago
JSF
I have the following problem with JBoss handling a deployment that I'm rather stumped on how to fix.

I'm trying to deploy an EJB tier / persistence set of classes and business logic as a .jar written with EJB3 and using Hibernate as my persistence provider.

The database that my classes are mapped to are in Sybase15.

Enclosed are the jboss-ds.xml and META-INF/persistence.xml files.

-----jboss-ds.xml-----------
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>java:/ChadbertApp</jndi-name>
<connection-url>jdbc:sybase:Tds:corporatedb.fictional.db.com:7001/toaster</connection-url>
<driver-class>com.sybase.jdbc3.jdbc.SybDriver</driver-class>
<user-name>productionUser</user-name>
<password>password</password
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>5</idle-timeout-minutes>
</local-tx-datasource>
</datasources>
----------------------------
-----persistence.xml--------
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

<persistence-unit name="ChadbertAppDataTierPU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>java:/ChadbertApp</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hibernate.dialect" value="SybaseDialect"/>
<property name="hibernate.connection.url"
value="jdbc:sybase:Tds:corporatedb.fictional.db.com:7001/toaster"/>
<property name="hibernate.connection.driver_class"
value="com.sybase.jdbc3.jdbc.SybDriver"/>
<property name="hibernate.connection.username" value="productionUser"/>
<property name="hibernate.connection.password" value="password"/>


</properties>
</persistence-unit>
</persistence>
----------------------------

When I try to deploy this to JBoss-4.2.1-GA app server, I get the following error list.

09:28:00, 021 INFO [JmxKernelAbstraction] jboss.jca:ChadbertApp, service=DataSouceBinding
09:28:00, 021 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.stateless.StatelessContainer
09:28:00, 382 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=ChadbertAppDataTier.jar, name=ClassificationEJBBean, service=EJB3 with dependencies:
09:28:00, 382 INFO [JmxKernelAbstraction] persistence.units:jar=ChadbertAppDataTier.jar,unitName= ChadbertAppDataTierPU
09:28:00, 412 INFO [EJB3Deployer] Deployed:file:/C:/jboss4.2.1.GA/server/default/deploy/ ChadbertAppDataTier.jar
09:28:00, 412 ERROR [URLDeploymentScanner] Incomplete Deployment listing:

--- Incompletely deployed packages ---
org.jboss.deployment.DeploymentInfo@fcd2bd5a { url=file:/C:/jboss-4.2.1.GA/server/default/deploy/ jboss-ds.xml }
deployer: org.jboss.deployment.XSLSubDeployer@1ef45e0
status: Deployment FAILED reason: Invalid character ':' in value part of property; - nested throwable: (javax.management.MalformedObjectNameException: Invalid character ':' in value part of property)
state: FAILED
watch: file:/C:/jboss-4.2.1.GA/server/default/deploy/jboss-ds.xml
altDD: null
lastDeployed: 1197469679691
lastModified: 1197469679671
mbeans:

--- MBeans waiting for other MBeans ---
ObjectName: persistence.units:jar=ChadbertAppDataTier.jar, unitName=ChadbertAppDataTierPU
State: NOTYETINSTALLED
I Depend On:
jboss.jca:name=ChadbertApp, service=DataSourceBinding

ObjectName: persistence.units:jar=ChadbertAppDataTier.jar, unitName=ChadbertAppDataTierPU
State: NOTYETINSTALLED
I Depend On:
jboss.jca:name=ChadbertApp, service=DataSourceBinding
Depends On Me:
jboss.j2ee:jar=ChadbertAppDataTier.jar, name=ClassificationEJBBean, service=EJB3

ObjectName: jboss.j2ee:jar=ChadbertAppDataTier.jar, name=ClassificationEJBBean, service=EJB3
State: NOTYETINSTALLED
I Depend On:
persistence.units:jar=ChadbertAppDataTier.jar, unitName=ChadbertAppDataTierPU

--- MBEANS THAT ARE THE ROOT CAUSE OF THE PROBLEM ---
ObjectName: jboxx.jca:name=ChadbertApp, service=DataSourceBinding
State: NOTYETINSTALLED
Depends On Me:
persistence.units:jar=ChadbertAppDataTier.jar, unitName=ChadbertAppDataTierPU
persistence.units:jar=ChadbertAppDataTier.jar, unitName=ChadbertAppDataTierPU

--------------------------------------------

I'm hoping someone can help point me in the right direction on what to do
here.

Appreciate any advice.

Thanks,
Chad
12 years ago
Hi,

I have a problem with hibernate (I think) when I try to deploy to a JBoss 4.2.1 GA app server.

What I'm trying to do - have JBoss run the EJB (dao) tier + Entity beans on a dedicated server (separate from web client apps.)

I developed a series of stateless session beans to talk to an auto-built set of Enitity objects by Netbeans 5.5.1. (Using a pre-existing database built with Sybase 15.) On the setup, I told Netbeans that I was using Hibernate for handling the persistence.)

The deployment seems to work except there's a hiccup that I dont quite understand how to 'fix'.

Here's the beginning of the stack trace when I try to deploy this on JBoss.
----------------------------
11:45:17, 483 INFO [EntityBinder] Bind entity com.chadproject.bo.Xpath on table XPATH
11:45:17, 653 WARN [ServiceController] Problem starting service persistence.units:jar=ChadProjectDataTier.jar, unitName=ChadProjectDataTierPU
org.hibernate.AnnotationException: Column name MODEL_ID of com.chadproject.bo.CPEntity not faound in JoinColumns.referencedColumnName
at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:306)
at org.hibernate.cfg.FkSecondPass(FkSecondPass.java:64)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:428)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:286)
----------------------------

I looked at the JoinColumns between the 2 tables the error was alluding to. The field MODEL_ID is defined / declared in both of them. I dont understand what Hibernate has a problem with here.

I'd appreciate any advice.

Thank you,
Chad
Hi,

I have a problem with hibernate (I think) when I try to deploy to a JBoss 4.2.1 GA app server.

What I'm trying to do - have JBoss run the EJB (dao) tier + Entity beans on a dedicated server (separate from web client apps.)

I developed a series of stateless session beans to talk to an auto-built set of Enitity objects by Netbeans 5.5.1. (Using a pre-existing database built with Sybase 15.) On the setup, I told Netbeans that I was using Hibernate for handling the persistence.)

The deployment seems to work except there's a hiccup that I dont quite understand how to 'fix'.

Here's the beginning of the stack trace when I try to deploy this on JBoss.
----------------------------
11:45:17, 483 INFO [EntityBinder] Bind entity com.chadproject.bo.Xpath on table XPATH
11:45:17, 653 WARN [ServiceController] Problem starting service persistence.units:jar=ChadProjectDataTier.jar, unitName=ChadProjectDataTierPU
org.hibernate.AnnotationException: Column name MODEL_ID of com.chadproject.bo.CPEntity not faound in JoinColumns.referencedColumnName
at org.hibernate.cfg.annotations.TableBinder.bindFk(TableBinder.java:306)
at org.hibernate.cfg.FkSecondPass(FkSecondPass.java:64)
at org.hibernate.cfg.AnnotationConfiguration.processFkSecondPassInOrder(AnnotationConfiguration.java:428)
at org.hibernate.cfg.AnnotationConfiguration.secondPassCompile(AnnotationConfiguration.java:286)
----------------------------

I looked at the JoinColumns between the 2 tables the error was alluding to. The field MODEL_ID is defined / declared in both of them. I dont understand what Hibernate has a problem with here.

I'd appreciate any advice.

Thank you,
Chad
12 years ago
I had to sanitize this a bit, but here's the start of the error stack trace that I'm getting when I try to deploy the EJB to a jboss-4.2.1 server.

-----------------------
13:24:56, 266 INFO [ConnectionFactoryBindingService] Bound ConnectionManager

'jboss.jca:service=DataSourceBinding, name=MyApp' to JNDI name 'java:MyApp'
13:24:45, 806 INFO [ConnecttionFactoryBindingService] Bound ConnectionManager

'jboss.jca:service=ConnectionFactoryBinding, name=JmsXA' to JNDI name 'java:JmsXA'

...
13:24:58, 318 INFO [PersistenceUnitDeployment] Starting persistence unit

persistence.units:jar=MyAppDataTier.jar, unitName=MyAppDataTierPU
13:24:58, 609 WARN [ServiceController] Problem starting persistence unit

persistence.units:jar=MyAppDataTier.jar, unitName=MyAppDataTierPU
javax.naming.NameNotFoundException: MyApp not bound
at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
at org.jnp...
at org.jboss.ejb3.entity.persistenceunitDeployment.start(PersistenceUnitDeployment.java:216)
...
13:24:59, 650 INFO [JmxKernelAbstraction] creating wrapper delegate for: org.jboss.ejb3.

stateless.StatelessContainer
13:24:59, 650 INFO [JmxKernelAbstraction] installing MBean: jboss.j2ee:jar=MyAppDataTier.jar,

name=ChadEJBBean, service=EJB3 with dependencies:
13:24:59, 650 INFO [JmxkernelAbstraction]
-----------------------------------


Anything helpful here ?

Chad
12 years ago
Here's a list of the configuration files I have so far.

---persistence.xml-----------
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" xmlns=...>
<persistence-unit name="myDataTierPU" transaction-type="JTA">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>MyApp</jta-data-source>
<properties>
<property name="hibernate.hbm2ddl.auto" value="update"/>
</properties>
</persistence-unit>
</persistence>
-----jboss-ds.xml--------------
<?xml version="1.0" encoding="UTF-8"?>
<datasources>
<local-tx-datasource>
<jndi-name>MyApp</jndi-name>
<connection-url>jdbc:sybase:Tds:myserver.proj.org:7001/dummyDatabase
</connection-url>
<driver-class>com.sybase.jdbc3.jdbc.SybDriver</driver-class>
<user-name>guestUser</user-name>
<password>guest</password>
<min-pool-size>5</min-pool-size>
<max-pool-size>20</max-pool-size>
<idle-timeout-minutes>5</idle-timeout-minutes>
</local-tx-datasource>
</datasources>
----------------------------
---jboss.xml----------------
<?xml version="1.0"?>
<jboss/>
----------------------------

I'll send a stack trace here shortly. This is what I have so far.

Again, appreciate your help.

Thanks,
Chad
[ December 03, 2007: Message edited by: Chad Foor ]
12 years ago
I have a situation where I've got the following:

1) JBoss 4.2.1 as the app server.
2) Development of an n-tier J2EE app using Netbeans 5.5.1
3) The back-end stuff: A Sybase-15 database my company had some
dba gurus set up / populate with data.

Ok, that being said. I've managed to create a JSF standalone app that
calls simple JDBC to the database just to test connectivity / proof of concept.

I'm now going through an effort to separate out the database logic and
create a proper J2EE solution. (all this in EJB3)

The steps I've taken so far in this effort :
1) Netbeans has a very nice tool that allows me to map all the database tables / relationships to their java object counterparts. (Took all the business objects and put them inside their own business object package.)

2) Created a simple set of DAO classes that references a combination of business objects created from item #1.

3) In the setup, told Netbeans that I'm having Hibernate to handle the persistence within JBoss.

4) Created a set of test EJB remote interfaces / beans to talk to the DAOs and implement the business logic.

Here's where I'm starting to get a little lost.

Netbeans created a jboss.xml file within its configuration files. Yet, that file has no content associated with it. (Looking at the literature, Netbeans says if you're going to use JBoss / WebLogic you got to provide this information. However, I'm not sure what goes in this file.)

I'm not bundling the application as a full-fleged EAR file. (Basically, I want to take the EJB portion and hosting this on a separate JBoss 4.2.1 server. Then, writing a set of web applications to talk to that server via a JNDI lookup where it will be housed from a different server. Essentially, I want to take my JSF app and re-factor the JDBC calls to deal with the EJBs directly.)

At this point, I'm not entirely sure whether this is an appropriate question for Netbeans 5.5.1 or JBoss. I havent put anything into JBoss.xml just yet.

When I bundle the .jar file and deploy to a JBoss 4.2.1 server, JBoss complains about not being able to find the persistence unit. So, I'm a little stuck here.

I'd appreciate any insights.

Thank you,
Chad
12 years ago
I figured it out. What I was looking for was a ValueBinding item that allowed me to set a property in the helper class from the input form class. (Was pretty painless once I stared at the Managed Bean sections of my JSF texts.) (just didnt know what it was 'called' per se. )
12 years ago
JSF
I'm aware of being able to reference 'helper' bean directly in my JSP by
declaring a managed-bean in my faces-config.xml.

What I want to do is reference the 'helper' bean directly from my 'inputForm' bean. Both beans are declared as managed-beans in the faces-config.xml file.

'helper' bean contains the information I need to display a datatable. (something that I'd originally declared to get something working inside the 'inputForm' bean.) But now, I want to separate that code out into its own class(bean) into 'helper' and reference that directly.

I'm using JSF 1.1 here. The books I'm looking at only hint at the ability to do a dependency injection, which is what I want here, but do not show a concrete example of how to do this.

I'm looking for a good code example of how to do this.

Appreciate any help.

Thanks,
Chad
[ November 16, 2007: Message edited by: Chad Foor ]
12 years ago
JSF
Hi,

I have a situation where it makes sense in the code to have 2 session beans declared in faces-config.xml to talk to one another.

The basic form stuff is declared in a session bean I call 'inputForm' (alias) and a helper bean called 'helper'. It makes sense to not have a concrete instance of the helper bean declared as an object within inputForm per se, but rather I need it to be called from my JSP page(s) directly. I just need to have 2 internal variables set between both the session beans using getters / setters.

How can I accomplish this ? (if it's possible ?)

Appreciate any help.

Thanks,
Chad
12 years ago
JSF
Hello,

I've got the following situation - I've got an <h:dataTable> with 4 columns
rendering an ArrayList of values in my JSP. (This works great.)

What I want to do -
In the first column, I've set up a nested <h:dataTable> that renders exactly 2 columns, which gets exposed. I've already got it set up to where
I can get the inner datatable to show up. However, what I'd like to do is have that inner table be expanded (span) across the set of columns for that particular row...

Code looks like this in the JSP:

<h:dataTable columnClasses="list-left, list-left, list-left, list-left"
headerClass="list-header"
rowClasses="list-row-even, list-row-odd"
styleClass="list-background"
id="table"
rendered="#{form.renderGeneralResults}"
value="#{form.list}"
var="result">
<h:column>
<f:facet name="header">
<h:outputText value="Name"/>
</f:facet>
<h:commandLink value="#{result.entityName}"
actionListener="#{form.expandRow}"
rendered="#{result.renderGeneralToggle}"
title="#{result.identity}"/>
<%--
now for the nested table...
--%>

<h:dataTable rendered="#{result.renderExactToggle}"
value="#{result.exactResults}"
var="expand">

<h:column>
<f:facet name="header">
<h:commandLink value="#{result.entityName}"
actionListener="#{form.collapseRow}"
rendered="#{result.renderExactToggle}"
title="ID=#{result.identity}"/>
</f:facet>
<h:outputText value="#{expand.key}"/>
</h:column>
<h:column>
<h:outputText value="#{expand.value}"/>
</h:column>
</h:dataTable>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Street"/>
</f:facet>
<h:outputText rendered="#{result.renderGeneralToggle}"
value="#{result.Street}"/>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Street"/>
</f:facet>
<h:outputText rendered="#{result.renderGeneralToggle}"
value="#{result.Street}"/>

</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="Street"/>
</f:facet>
<h:outputText rendered="#{result.renderGeneralToggle}"
value="#{result.Street}"/>
</h:column>

</h:dataTable>
...

(the last 3 columns arent the real data itself, but that's not important
for the purpose of this question...)

I'm using JSF 1.1.

Basically, this code works fine, but again, I'd like to have that inner row exposed and stretch across the entire table instead of being treated like a single non-spanning column as it's originally layed out. (The actionListener for the command links toggle a pair of booleans that toggle between full and general views.)

Is there any way to do this ? .. I've already tried to add a separate column and declare it to be a 100% width, mess with the stylesheet reference(s) declared in the headerClass attribute of the outer table, but to no avail. (Also tried to mess with the 'rendered' attribute on the <h:column> tags themselves, but this doesnt work. )

Appreciate any insights.

Thank you,
Chad
12 years ago
JSF
Never mind, I figured it out. Basically just built my own custom converter class and registered it within faces-config.xml.

Didnt need to use <h:outputFormat> tag, just straight up <h:outputText>
13 years ago
JSF