Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link

Arun Kandregula

Greenhorn
+ Follow
since Dec 19, 2005
Worked as Application Engineer in Oracle Corporation for 3 years. Currently working as Software Dev Engineer in Seattle, WA.
Seattle
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 Arun Kandregula

This is my finding till now:

I can access the variable in side

// CODE with problem...


So I defined similar column collection in someCollection itself and i am able to access the columns like this :

//CODE with imperfect solution (working)




12 years ago
JSF
May I know how to display dynamic columsn in dataTabel.

I tried with Rich Faces.



Here is the problem : I didnt find a solution to display dynamic columns in standard JSF. So I resorted to richfaces.
But there, with the above tag, it is not recognizing the local variable priceTypeRow.

It throws below exception :

EV 14:22:52 ERROR ColumnsHandler - FOREACH_BAD_ITEMS
avax.servlet.jsp.JspTagException: FOREACH_BAD_ITEMS
at org.richfaces.iterator.SimpleForEachIterator.toForEachIterator(Simple
orEachIterator.java:135)
at org.richfaces.iterator.SimpleForEachIterator.supportedTypeForEachIter
tor(SimpleForEachIterator.java:98)
at org.richfaces.taglib.ColumnsHandler.prepare(ColumnsHandler.java:304)
at org.richfaces.taglib.ColumnsHandler.apply(ColumnsHandler.java:489)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.tag.jsf.ComponentHandler.applyNextHandler(ComponentH
ndler.java:314)
at com.sun.facelets.tag.jsf.ComponentHandler.apply(ComponentHandler.java
169)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.tag.jsf.core.ViewHandler.apply(ViewHandler.java:109)

at com.sun.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.j
va:64)
at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.j
va:131)
at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(Def
ultFaceletContext.java:310)
at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(Default
aceletContext.java:280)
at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.tag.ui.DefineHandler.applyDefinition(DefineHandler.j
va:64)
at com.sun.facelets.tag.ui.CompositionHandler.apply(CompositionHandler.j
va:131)
at com.sun.facelets.impl.DefaultFaceletContext$TemplateManager.apply(Def
ultFaceletContext.java:310)
at com.sun.facelets.impl.DefaultFaceletContext.includeDefinition(Default
aceletContext.java:280)
at com.sun.facelets.tag.ui.InsertHandler.apply(InsertHandler.java:68)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.jav
:49)
at com.sun.facelets.tag.CompositeFaceletHandler.apply(CompositeFaceletHa
dler.java:47)
at com.sun.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:
5)
at com.sun.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:248)
12 years ago
JSF
In Glassfish, I have created a global JNDI name :

JNDI name = jdbc/abcd .

And in my code, I tried to inject the resource with the same name:

@Resource(name="jdbc/abcd")
private static DataSource ds;

I assume that this will be interpreted as Environment Naming Context (ENC) name : java:comp/env/jdbc/abcd .

Fortunately I think Glassfish will automatically resolve ENC name to global JNDI name if a resource with the same Global JNDI name exists.

But what if I have :

@Resource (name="Some_Portable_JNDI_Name")
DataSource ds;

And still my global JNDI name on server is jdbc/abcd.

How to provide the mapping between ENC (java:comp/env/Some_Portable_JNDI_Name) and Global JNDI name (jdbc/abcd) in this case?

I think I have to provide this mapping in Glassfish specific deployment descriptor?
May I know waht is that and how to provide mapping?

I dont want to rely on mappedName property of @Resource annotation as that makes code difficult to port.
When creating a connection pool in Glassfish, I am confused with these two options:
javax.sql.DataSource and javax.sql.ConnectionPoolDataSource.

What is the difference between javax.sql.DataSource and javax.sql.ConnectionPoolDataSource ?

I thought every implementation of javax.sql.DataSource supports connection pooling. ( Not just javax.sql.ConnectionPoolDataSource )

Also, I read somewhere that some app servers like Glassfish will use ConnectionPoolDataSource regardless and expose just DataSource.

If we close the connection returned by (getConnection() of javax.sql.DataSource), wont that go back to connection pool ?

Let me put it this way :

What is the necessity of having javax.sql.ConnectionPoolDataSource, when javax.sql.DataSource itself supports pooling.
Am I assuming anything? Will every app server implements DataSource such a way that is supports pooling? Yes/No ?
Hi,

I am trying to inject a @Resource into Application Client.

Here is my ApplicationClient:



I am using GlassFish application Server and Oracle 10g database.

Step 1.
-------
I created a connection pool with (just for testing) [ on Glassfish admin console http://localhost:4848] :

Name: abc
Datasource Classname: oracle.jdbc.pool.OracleDataSource
Resource Type: javax.sql.DataSource
URL : jdbc:oracle:thin:@localhost:1521:myservicename
user name: scott
password : tiger

Ping was successful.

Step 2
--------
I create JDBC > JDBC Resource.

JNDI Name: jdbc/abcd
Pool Name : abc (selected 'abc' from dropdown)


I have this CLASSPATH = javaee.jar; [ provided by Glassfish ]
appserv-rt.jar; [ provided by Glassfish ]
ojdbc14.jar; [provided by oracle ]

MANIFEST.MF has correct entry :
-------------------------------------
Main-Class: arun.di.ResourceInjectionDemo

I packaged my application client into c.jar. [c for client]

This is how I am invoking my application client:

C:\arun\ejb3practice\DI\ApplicationClient>appclient -client c.jar

Jun 24, 2009 12:26:11 AM com.sun.gjc.common.DataSourceObjectBuilder getDataSourc
eObject
SEVERE: RAR5099 : Wrong class name or classpath for Datasource Object
java.lang.ClassNotFoundException: oracle.jdbc.pool.OracleDataSource
at com.sun.enterprise.loader.EJBClassLoader.findClassData(EJBClassLoader
.java:738)
at com.sun.enterprise.loader.EJBClassLoader.findClass(EJBClassLoader.jav
a:628)

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

WARNING: RAR5038:Unexpected exception while creating resource for pool abc. Exce
ption : Class name is wrong or classpath is not set for : oracle.jdbc.pool.Oracl
eDataSource
Jun 24, 2009 12:26:11 AM com.sun.enterprise.connectors.ConnectionManagerImpl int
ernalGetConnection
WARNING: RAR5117 : Failed to obtain/create connection from connection pool [ abc
]. Reason : Class name is wrong or classpath is not set for : oracle.jdbc.pool.
OracleDataSource
Jun 24, 2009 12:26:11 AM com.sun.gjc.spi.base.DataSource getConnection
WARNING: RAR5114 : Error allocating connection : [Error in allocating a connecti
on. Cause: Class name is wrong or classpath is not set for : oracle.jdbc.pool.Or
acleDataSource]
Jun 24, 2009 12:26:11 AM com.sun.enterprise.appclient.MainWithModuleSupport <ini
t>
WARNING: ACC003: Application threw an exception.
java.sql.SQLException: Error in allocating a connection. Cause: Class name is wr
ong or classpath is not set for : oracle.jdbc.pool.OracleDataSource
at com.sun.gjc.spi.base.DataSource.getConnection(DataSource.java:115)
at arun.di.ResourceInjectionDemo.main(ResourceInjectionDemo.java:17)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
....


C:\arun\ejb3practice\DI\ApplicationClient>


I dont know why it is saying Caused by: java.sql.SQLException: Error in allocating a connection. Cause: Class
name is wrong or classpath is not set for : oracle.jdbc.pool.OracleDataSource.

I have ojdbc14.jar in my CLASSPATH.
C:\arun\ejb3practice\DI\ApplicationClient>set CLASSPATH
CLASSPATH=;C:\arun\softwares\Java\Java Kingdom\GlassFish\glassfish\lib\javaee.ja
r;C:\arun\softwares\Java\Java Kingdom\GlassFish\glassfish\lib\appserv-rt.jar;;C:
\oracle\product\10.2.0\db_1\jdbc\lib\ojdbc14.jar;



NOTE: Also, before starting the domain1 of Glassfish, I have copied ojdbc14.jar to glassfish\domains\domain1\lib\ext dir.

Please tell me where I am wrong.

Jeffry Kristianto Yanuar wrote:If we deploy an EJB, what is its JNDI name if we don't specify the JNDI name ?

Jeffry Kristianto Yanuar SCJP, SCJA, SCJD



Hi Jeffry,

By default, for GlassFish, JNDI name of an EJB is fully qualified name of the Remote bussiness interface.

In the above example, it would be "ejb3inaction.example.HelloUser".

JNDI names are not yet standardized in portable fasion by EJB spec yet. So even default JNDI names vary from app server to app server.

Thanks.
Arun.
Thank you Jai for your reply.

After doing some research, I succeeded in injecting @EJB into application client as follows:

1. I created a jar with MANIFEST.MF ( containing entry for Main-Class ) , client class, Remote interface class

2. I used appclient tool of Glassfish and invoked the ApplicationClient.

3. Client ran successfully.

I got the answer to this question. Weblogic by default delegates the concurrency/isolation strategy to database. As Oracle uses READ_COMITTED mode of isolation, it allows anyone to read comitted data. Hence no locks are being aquired by default by Weblogic server. Thank you for your reply.
Hi,
I am planning to clear SCDJWS this year end. For that I wanted to get some hands on practicals of web services. Many books are theoritical. Can this book "RESTful Web Services" help me in providing the practicals of web services.

Please suggest any good resources where i can get enough practice on writing and testing web services.
14 years ago
Infact, I spent nearly 7 to 8 months practising ejbs on Weblogic....in the exam...for one question I changed the answer last minute...gone...my score dropped from 94 to 92...so when i took my score sheet..iam not a happy man...but...now...i took it as a part of the game...
15 years ago
Oh! In subject..I posted my SCJP score instead of SCBCD. Do I need to say 'sorry' ?
15 years ago
Hey, today I cleared the SCBCD exam with 92%.
Regards,
Arun
SCJA, SCJP( 98% )
15 years ago
You are right.
B cannot be the answer.
We cannot call getEJBObject() in ejbCreate() of entity bean.
Hi All, (I am working with Weblogic 8.1)
For a CMP bean, when I tried to execute findByPrimaryKey(String), I see that
ejbActivate
ejbLoad
ejbStore

all three are being called.

Piece of code:

IBooksHome bh = (IBooksHome)PortableRemoteObject.narrow(home,arun.entity.booksCMR.IBooksHome.class);
IBooks book = bh.findByPrimaryKey("10001");

When I called home bussiness method...neither of those 3 are called , which is expected.
I know that finder methods, home bussiness methods are called on instances in the pool. Then ***WHY*** the instance is getting activated and being assigned to the EJBObject when I called findByPrimaryKey. WHY THOSE 3 METHODS ARE CALLED.

Please help me out .
Thanks in advance.
Arun.