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

Raymond Ou

Ranch Hand
+ Follow
since Jun 03, 2003
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 Raymond Ou

Dear all,

I am new to log4j, and I download log4j and struts then use the following configuration:
<
"log4j.properties"
log4j.rootLogger=WARN, stdout
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=[%5p] %d{mm:ss} (%F:%M:%L)%n%m%n%n
log4j.logger.org.apache.struts=DEBUG

In my actionform named "CalculatorForm"
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
...
private static Log log = LogFactory.getLog(CalculatorForm.class);
...
log.debug("This is a test");
>

The last statement do not print on the console, however system log such as following appear.
<
[DEBUG] 34:18 (PropertyMessageResources.java:loadLocale:269)
loadLocale(en)
>

Kindly please advise. Thanks!

Raymond Ou
Thanks both of you! I will try your suggestions.

Raymond
17 years ago
Hi there,

I am new to entitybean, and I generated entity beans with from Oracle 9i with EJB/RDB Mapping, the localobject of one of my entitybean is Car_carrierLocal and its property in ejb-jar.xml is <local>tpasdev.Car_carrierLocal</local>.

So how do I lookup this object in my servlet? I tried the following lookup but failed:

Object homeObject = initCtx.lookup("java:comp/env/tpasdev/Car_carrierLocal");
CarrierHome = (Car_carrierLocalHome) javax.rmi.PortableRemoteObject.narrow(homeObject, TPAControllerHome.class);
CarrierRemote = CarrierHome.create("AAA");

Thanks!
Raymond Ou
17 years ago
Thanks, Kyle!

After create a datasource jdbc/Default on server, it works. But still can't figure out why the sessionbean can work without this datasource, on the other hand enterprisebean needs it. Anyway, thanks a lot!

Best regards,
Raymond
17 years ago
Hi Kyle,
I do not create the "jdbc/Default" datasource on test server since it is a CMP jdbc. Moreover, I have the same jndi name in another EJB project which contain a seesionbean with CMP type, and this EJB project works fine.
Thanks!
Raymond
18 years ago
Hi there,
I encountered two problems while trying to use EJB to EDB Mapping, my wsad is 5.1 and the EJB is CMP type.
1. WSAD import all tables to ejb project even I only select one table.
2. After finish import, there is no error on rebuilding the project and generate deployment code. But there is an jndi not found exception thrown when I start the websphere test server, prompting jndiName="jdbc/Default" is not found, this name is for "defaultCMPConnectionFactory" which locate in "ibm-ejb-jar-bnd.xmi". However, there is no exception thrown if I use the same jndi name in another ejb project that contain sessionbean. Could anybody tell me how to fix this problem? Below is the error message:
[4/11/04 10:54:13:828 PDT] 3f17c56d EJBContainerI I WSVR0037I: Starting EJB jar: webspEntityBeanProject.jar
[4/11/04 10:54:14:281 PDT] 3f17c56d Helpers W NMSV0605W: A Reference object looked up from the context "java:" with the name "comp/PM/WebSphereCMPConnectionFactory" was sent to the JNDI Naming Manager and an exception resulted. Reference data follows:
Reference Factory Class Name: com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory
Reference Factory Class Location URLs: <null>
Reference Class Name: java.lang.Object
Type: JndiLookupInfo
Content: JndiLookupInfo: jndiName="jdbc/Default"; providerURL=""; initialContextFactory=""
Exception data follows:
javax.naming.NameNotFoundException: Context: localhost/nodes/localhost/servers/server1, name: jdbc/Default: First component in name Default not found. Root exception is org.omg.CosNaming.NamingContextPackage.NotFound: IDL mg.org/CosNaming/NamingContext/NotFound:1.0
at com.ibm.ws.naming.ipcos.WsnOptimizedNamingImpl.do_resolve_complete_info(WsnOptimizedNamingImpl.java:968)
at com.ibm.ws.naming.cosbase.WsnOptimizedNamingImplBase.resolve_complete_info(WsnOptimizedNamingImplBase.java:1398)
at com.ibm.WsnOptimizedNaming._NamingContextStub.resolve_complete_info(Unknown Source)
at com.ibm.ws.naming.jndicos.CNContextImpl.cosResolve(CNContextImpl.java:3491)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1519)
at com.ibm.ws.naming.jndicos.CNContextImpl.doLookup(CNContextImpl.java:1480)
at com.ibm.ws.naming.jndicos.CNContextImpl.lookupExt(CNContextImpl.java:1187)
at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory$1.run(IndirectJndiLookupObjectFactory.java:372)
at com.ibm.ws.security.util.AccessController.doPrivileged(AccessController.java:111)
at com.ibm.ws.naming.util.IndirectJndiLookupObjectFactory.getObjectInstanceExt(IndirectJndiLookupObjectFactory.java:221)
at com.ibm.ws.naming.util.Helpers.processSerializedObjectForLookupExt(Helpers.java:868)
at com.ibm.ws.naming.urlbase.UrlContextHelper.processBoundObjectForLookup(UrlContextHelper.java:152)
at com.ibm.ws.naming.java.javaURLContextRoot.processBoundObjectForLookup(javaURLContextRoot.java:397)
at com.ibm.ws.naming.urlbase.UrlContextImpl.lookup(UrlContextImpl.java:1278)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:194)
at com.ibm.ws.naming.java.javaURLContextRoot.lookup(javaURLContextRoot.java:135)
at javax.naming.InitialContext.lookup(InitialContext.java:360)
at com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanClassExtensionImpl.lookup(Unknown Source)
at com.ibm.ws.ejbpersistence.beanextensions.ConcreteBeanClassExtensionImpl.getConnectionFactory(Unknown Source)
at com.ibm.ws.ejbpersistence.beanextensions.PMModuleCookieImpl.beanInstall(Unknown Source)
at com.ibm.ws.ejbpersistence.beanextensions.PersistenceManagerImpl.beanInstall(Unknown Source)
at com.ibm.ejs.container.EJSContainer.loadBeanMetaData(EJSContainer.java:1367)
at com.ibm.ejs.container.EJSContainer.getHomeWrapperCommon(EJSContainer.java:1012)
at com.ibm.ejs.container.EJSContainer.getHomeInstance(EJSContainer.java:934)
at com.ibm.ejs.container.EJSContainer.startBean(EJSContainer.java:913)
at com.ibm.ws.runtime.component.EJBContainerImpl.startBean(EJBContainerImpl.java:1301)
at com.ibm.ws.runtime.component.EJBContainerImpl.install(EJBContainerImpl.java:1034)
at com.ibm.ws.runtime.component.EJBContainerImpl.start(EJBContainerImpl.java:1508)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:418)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.fireDeployedObjectStart(DeployedApplicationImpl.java:787)
at com.ibm.ws.runtime.component.DeployedModuleImpl.start(DeployedModuleImpl.java:354)
at com.ibm.ws.runtime.component.DeployedApplicationImpl.start(DeployedApplicationImpl.java:575)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.startApplication(ApplicationMgrImpl.java:271)
at com.ibm.ws.runtime.component.ApplicationMgrImpl.start(ApplicationMgrImpl.java:249)
at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:536)
at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
at com.ibm.ws.runtime.component.ApplicationServerImpl.start(ApplicationServerImpl.java:125)
at com.ibm.ws.runtime.component.ContainerImpl.startComponents(ContainerImpl.java:536)
at com.ibm.ws.runtime.component.ContainerImpl.start(ContainerImpl.java:413)
at com.ibm.ws.runtime.component.ServerImpl.start(ServerImpl.java:183)
at com.ibm.ws.runtime.WsServer.start(WsServer.java:128)
at com.ibm.ws.runtime.WsServer.main(WsServer.java:225)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41)
at java.lang.reflect.Method.invoke(Method.java:386)
at com.ibm.ws.bootstrap.WSLauncher.main(WSLauncher.java:94)
at com.ibm.etools.websphere.tools.runner.api.ServerRunnerV5$1.run(ServerRunnerV5.java:97)

Thank you,
Raymond
18 years ago
Kyle, many many thanks!
I forgot to implement the carrierPCls as serializable! When I correct it, the program runs fine.
Kyle, you are very helpful!
Thanks again!
Raymond
18 years ago
Hi there,
I have a problem in calling a method in EJB from JSP, I am using WSAD5.1.1, below is my source:
Backend
public class CarrierDS{
..
public ArrayList findAllCarrier(){
Connection conn=null;
ArrayList rtnCol = null;
PreparedStatement stat = null;
CarrierPCls getPCls = null;
StringBuffer szSql = new StringBuffer();
ResultSet rs = null;
try{
conn=getConnection();
szSql.append("select carrier_cd, name from car_carrier where carrier_cd like 'AT%' order by carrier_cd");
stat = conn.prepareStatement(szSql.toString());
rs = stat.executeQuery();
rtnCol = new ArrayList();
while (rs.next()){
getPCls = new CarrierPCls();
getPCls.szCarrierCode = rs.getString("CARRIER_CD");
getPCls.szName=rs.getString("NAME");

rtnCol.add(getPCls);/**/
}
}catch (SQLException ex){
ex.printStackTrace();
}finally{
try {
if (rs != null) rs.close();
if (stat != null) stat.close();
if (conn != null) conn.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
}
return rtnCol;

}
..
}
public class CarrierPCls {
..
public String szName;
public String szCarrierCode;
..
}
public class TPAControllerBean implements javax.ejb.SessionBean {
..
public ArrayList getCarrierList()
{
ArrayList rtnCol = new ArrayList();
try{
rtnCol = new CarrierDS().findAllCarrier();
}catch (Exception ex) {
ex.printStackTrace();
}
return rtnCol;
}
..
}
public interface TPAController extends javax.ejb.EJBObject{
..
public ArrayList getCarrierList() throws RemoteException;
..
}
Frontend
Carrier.jsp
..
TPAController TPARemote=null;
TPAControllerHome TPAHome=null;
InitialContext initCtx = new InitialContext( );
Object homeObject = initCtx.lookup("java:comp/env/websp/TPAController");
TPAHome = (TPAControllerHome) javax.rmi.PortableRemoteObject.narrow(homeObject, TPAControllerHome.class);
TPARemote = TPAHome.create();
ArrayList resultCol= new ArrayList();
resultCol= TPARemote.getCarrierList();
if (resultCol!=null){
Iterator iteCarrier = resultCol.iterator();
while (iteCarrier.hasNext()) {
CarrierPCls tmpPCls = (CarrierPCls)iteCarrier.next();
out.println(tmpPCls.szCarrierCode + "-----" + tmpPCls.szName + "
");
}
..
[End of source]
There are no compile error and deployment error when I deploy the ejb. But if I call the carrier.jsp on browser, it throw an exception below:
Error 500: RemoteException occurred in server thread; nested exception is: java.rmi.MarshalException: Exception occurred in server thread; nested exception is: java.io.NotSerializableException
the stack list below:
[4/1/04 18:42:05:859 PST] 79deecc9 WebGroup E SRVE0026E: [Servlet Error]-[RemoteException occurred in server thread; nested exception is:
java.rmi.MarshalException: Exception occurred in server thread; nested exception is:
java.io.NotSerializableException]: java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.MarshalException: Exception occurred in server thread; nested exception is:
java.io.NotSerializableException
at com.ibm.CORBA.iiop.UtilDelegateImpl.wrapException(UtilDelegateImpl.java:690)
at javax.rmi.CORBA.Util.wrapException(Util.java:295)
at com.websp._TPAController_Stub.getCarrierList(_TPAController_Stub.java:257)
at org.apache.jsp._Carrier._jspService(_Carrier.java:136)
at com.ibm.ws.webcontainer.jsp.runtime.HttpJspBase.service(HttpJspBase.java:89)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:344)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.serviceJspFile(JspServlet.java:662)
at com.ibm.ws.webcontainer.jsp.servlet.JspServlet.service(JspServlet.java:760)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at com.ibm.ws.webcontainer.servlet.StrictServletInstance.doService(StrictServletInstance.java:110)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet._service(StrictLifecycleServlet.java:174)
at com.ibm.ws.webcontainer.servlet.ServicingServletState.service(StrictLifecycleServlet.java:333)
at com.ibm.ws.webcontainer.servlet.StrictLifecycleServlet.service(StrictLifecycleServlet.java:116)
at com.ibm.ws.webcontainer.servlet.ServletInstance.service(ServletInstance.java:283)
at com.ibm.ws.webcontainer.servlet.ValidServletReferenceState.dispatch(ValidServletReferenceState.java:42)
at com.ibm.ws.webcontainer.servlet.ServletInstanceReference.dispatch(ServletInstanceReference.java:40)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.handleWebAppDispatch(WebAppRequestDispatcher.java:974)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:555)
at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:200)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.doForward(WebAppInvoker.java:119)
at com.ibm.ws.webcontainer.srt.WebAppInvoker.handleInvocationHook(WebAppInvoker.java:276)
at com.ibm.ws.webcontainer.cache.invocation.CachedInvocation.handleInvocation(CachedInvocation.java:71)
at com.ibm.ws.webcontainer.cache.invocation.CacheableInvocationContext.invoke(CacheableInvocationContext.java:114)
at com.ibm.ws.webcontainer.srp.ServletRequestProcessor.dispatchByURI(ServletRequestProcessor.java:186)
at com.ibm.ws.webcontainer.oselistener.OSEListenerDispatcher.service(OSEListener.java:334)
at com.ibm.ws.webcontainer.http.HttpConnection.handleRequest(HttpConnection.java:56)
at com.ibm.ws.http.HttpConnection.readAndHandleRequest(HttpConnection.java:618)
at com.ibm.ws.http.HttpConnection.run(HttpConnection.java:439)
at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:593)
Caused by: java.rmi.MarshalException: Exception occurred in server thread; nested exception is:
java.io.NotSerializableException
at com.ibm.rmi.util.ProxyUtil.copyObject(ProxyUtil.java:470)
at com.ibm.CORBA.iiop.UtilDelegateImpl.copyObject(UtilDelegateImpl.java:789)
at javax.rmi.CORBA.Util.copyObject(Util.java:332)
at com.websp._TPAController_Stub.getCarrierList(_TPAController_Stub.java:254)
... 27 more
Caused by: java.io.NotSerializableException
... 31 more
P.S. If I change the ArrayList type to Collection in above code, there is a information message prompting "CHKJ2500I: java.util.Collection must be serializable at runtime (EJB 2.0: 7.10.5).". If I use ArrayList, this information message disappear.
Woo! A simple program cause me a lot of time.
Please help! Many thanks!
Raymond
18 years ago
Hi there,
I have create an ejb and want to access oracle table, can somebody tell me how to set the ejb deployment descriptior in wsad to allow my ejb lookup and get the connection?
Both of my WASD and WAS are 5.1, the oracle is 9i.
Thank you,
Raymond
18 years ago
Rufus and Gunther, thanks for your kindly reply.
Now I am using wsad to make j2ee packages, it really cost my computer a huge amount of memory.
18 years ago
Hi there,
Here I have create a simple EJB with implement class, home and remote interface, and I got the assembly toolkit. How can I make a jar and deploy to was.
Thanks!
Raymond
18 years ago
Hi,
I need some tutorial about websphere app server urgently, here is the tools I have:
Jbulder v6, websphere 5.1 trail version
Could anybody tell how to find some tutorial concerning develop an EJB in Jbuilder, deploy to websphere, and run jsp on frontend to test it?
Thanks very much!
Raymond
18 years ago
The "Return-Receipt-To" header works in outlook system of my company, but it is a "delivery receipt" other than a "read receipt" which I actually want, can somebody tell me how to implement it?
The header content of the mail with read receipt sent in outlook use "Return-Receipt-To":
Return-Receipt-To: abc@xyz.com
however when I set the same header with java mail API, the outlook send a "delivery receipt" instead
Raymond
18 years ago
The "Return-Receipt-To" header works in outlook system of my company, but it is a "delivery receipt" other than a "read receipt" which I actually want, can somebody tell me how to implement it?
The header content of the mail with read receipt sent in outlook use "Return-Receipt-To":
Return-Receipt-To: abc@xyz.com
however when I set the same header with java mail API, the outlook send a "delivery receipt" instead (
Raymond
18 years ago
I am working on a function that upload a flat file(for example, csv file) to Oracle, is it possible to filter some columns in the csv file?
My code is below:
create table tag_ext(
CC VARCHAR2(15),
DESCRP VARCHAR2(100),
IND_ID VARCHAR2(15),
DUMMY VARCHAR2(100),
CTRY_CD VARCHAR2(15),
AREA_CD VARCHAR2(2000)
)
organization external
(
type oracle_loader
default directory extdir
access parameters
(
records delimited by newline
badfile extdir:'t2.bad'
logfile extdir:'t3.log'
skip 27
fields terminated by ',' OPTIONALLY ENCLOSED BY '"'
missing field values are null
(
CC CHAR(15),
DESCRP CHAR(100),
IND_ID CHAR(15),
DUMMY CHAR(100),
CTRY_CD CHAR(15),
AREA_CD CHAR(2000)
)
)
location('ATT.csv')
)
reject limit unlimited
parallel 2;

Now, if I want to skip column 4 in csv file, what parameter should I add to the sql script?
PS: I am able to use sqlldr to perform this job by using "FIELD4 FILLER", but it is not working in the upper script
Thanks,
Raymond
18 years ago