Win a copy of Java by Comparison (eBook) this week in the Java in General forum!

Patrick Mugabe

Ranch Hand
+ Follow
since Jan 08, 2002
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 Patrick Mugabe

Hi.

Has anyone successfully tested messaging using glassfish's embedded container on version 3.1 or 3.01?
As I was building my project, I could test my session beans and persistence but my tests stopped working the moment I introduced queues. Basically the testsuite fails to create the EJB container (EJBContainer.createEJBContainer()) and gives the following error:

No EJBContainer provider available, Returned null from createEJBContainer call

To test my theory I deleted the Producer and Consumer and removed the xml references on the project and the tests work. Is there an issue with queues/topics when testing with the embedded container OR has anyone successfully tested this.
Maybe there are additional properties to be passed to EJBContainer.createEJBContainer() when dealing with queues???

Thanks
7 years ago
I am responding to an old post but I thought there could be someone experiencing the same problem.
I had the same problem recently where the glassfish console would go blank after the login screen. I upgraded to the jdk1.6.0_23. However, I still had the problem as I as launching it from Netbeans IDE. I had to change the java executable path on the glassfish server properties to point to the upgraded version for my jdk and it worked. NOTE: Remember to change the JAVA_HOME path as well.
7 years ago
I had the same problem recently and I upgraded to the jdk1.6.0_23. However, I still had the problem as I was launching it from Netbeans IDE. I had to change the java executable path on the glassfish server properties to point to the upgrade I installed for my jdk and it worked.
7 years ago
Hi ranchers,

I passed SCBCD (310-091) exam yesterday. The exam is really tricky but with the right preparation you will pass.
I made a mistake of purchasing a voucher early and never got time to read because of work pressure then in the last 2 months I had to do a lot of reading so as to write before the voucher expired. I used O'Reilly's book, tried a lot of examples and used Glassfish App server. I urge those who want to write to practice a lot because you understand the concepts better. I also relied on the SPEC (boring to read but MUST read). I found the exam quite challenging but the time allocation is good. There is plenty of time so you are not under pressure when you sit for the exam.
Also I think the key thing is NOT only to pass the exam but to understand the concepts and be able to apply them given a problem in a work situation.
Thanks to all the ranchers and those who post their studying experience. It gave me confidence that I can DO IT.
[ October 15, 2008: Message edited by: Patrick Mugabe ]
I think it adds a lot of value to anyone who is preparing for the exam. I also think you got a high score considering that the pass mark is 61%.
Please share with us how you prepared for the exam and your experience with the actual exam.

Congrats.
Hi all,

I am happy that I passed the SCJP 1.5 exam. Just want to encourage those who are still to write to go through the K&B book, take the practice questions at the end of each chapter and thoroughly go through the 2 minute drills a day before the exam. They helped me a lot. Also take the practice exams that come with the book and you will be OK. I couldn't afford Whizlabs and I know there are more like me.
10 years ago
Hi,

My client program accesses webservices through glassfish. There are instances where I get EJBException errors on the client side but there are no errors reported on the code and if I use the same data it works.
As an example I try to add a person's details and it throws an EJB Exception then I try again and it adds. I am new to EJB3 and I am not sure what the problem could be. Can anyone give me pointers or advise?
I am getting the following error on glassfish when I try to list records in one of my DB tables.

javax.ejb.EJBException
Unable to complete container-managed transactionnested exception is: javax.transaction.SystemException javax.transaction.SystemException at com.sun.enterprise.distributedtx.J2EETransaction.commit(J2EETransaction.java:463) at com.sun.enterprise.distributedtx.J2EETransactionManagerOpt.commit(J2EETransactionManagerOpt.java:358) at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3736) at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3515) at com.sun.ejb.containers.WebServiceInvocationHandler.invoke(WebServiceInvocationHandler.java:187) at $Proxy394.addCompany(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at com.sun.enterprise.webservice.InvokerImpl.invoke(InvokerImpl.java:68) at com.sun.enterprise.webservice.EjbInvokerImpl.invoke(EjbInvokerImpl.java:75) at com.sun.xml.ws.server.InvokerTube$2.invoke(InvokerTube.java:132) at com.sun.xml.ws.server.sei.EndpointMethodHandler.invoke(EndpointMethodHandler.java:241) at com.sun.xml.ws.server.sei.SEIInvokerTube.processRequest(SEIInvokerTube.java:74) at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:559) at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:518) at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:503) at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:400) at com.sun.xml.ws.api.pipe.helper.AbstractTubeImpl.process(AbstractTubeImpl.java:70) at com.sun.enterprise.webservice.MonitoringPipe.process(MonitoringPipe.java:134) at



This is just part of the stacktrace.

Any idea what causes this or how it can be fixed?
10 years ago
The webservice returns data but in some instances it returns null then when you call it for the second time it returns data which is why I thought it might be the Connection pool.
Another error I just got now is:
Error in allocating a connection. Cause: java.lang.RuntimeException: Got exception during XAResource.start

but this doesn't happen all the time. It's an on off thing.
10 years ago
Hi,

I am calling webservices deployed on glassfish. Sometimes I call a webservice that lists data and it returns a null, call it again and it returns data. What could be the cause for that.
Below is my code for the connections. I am using a connection pool set up on glassfish. Are there any flaws in my code? Please assist.

private static InitialContext getContext() throws NamingException{
if(ctx == null)
ctx = new InitialContext();
return ctx;
}

private static DataSource getDataSource(String name) throws NamingException{
if(ctx == null){
DB_connection.getContext();
}
switch(defaultNum){
case MASTER:
if(dsMaster == null){
dsMaster = ds = (DataSource)ctx.lookup(name);
}
break;
case WEB:
if(dsWeb == null){
dsWeb = ds = (DataSource)ctx.lookup(name);
}
break;
case BIG_BLUE:
//Not is use for now
break;
}
return ds;
}
/**
* @return Connection for MasterDB
* @throws SQLException
*/
protected static Connection openMasterDatabase() throws SQLException{
defaultNum = MASTER;
try {
getDataSource(JNDI_MASTER);
if(dsMaster != null){
conn = dsMaster.getConnection();
}
}
catch (NamingException e) {
e.printStackTrace(System.err);
}
return conn;
}

/**
* @return Connection
*/
public static Connection openWebAppsDatabase() throws SQLException{
defaultNum = WEB;
try {
getDataSource(JNDI_WEB);
if(dsWeb != null){
conn = dsWeb.getConnection();
}
}
catch (NamingException e) {
e.printStackTrace(System.err);
}
return conn;
}
10 years ago
I am getting the following error:

Error in allocating a connection. Cause: In-use connections equal max-pool-size and expired max-wait-time. Cannot allocate more connections.

How best can I resolve it. Does glassfish manage the closing of connections or this has to be done inside the calling code
10 years ago
Hi,

Thanks for the response. I am using javax.mail.Session
10 years ago
Hi Ranchers,

I am getting the following error message.

javax.naming.NameNotFoundException: No object bound to name java:comp/env/mail/Notification

I set up a java mail Session resouce with a JNDI name mail/Notification.

In my code I am getting the Session using:

Context ic = new InitialContext();
mailSession = (Session)ic.lookup("java:comp/env/mail/Notification");

I have also tried to just use mail/Notification but then it gives the error com.sun.enterprise.deployment.MailConfiguration cannot be cast to Session.

Can anyone assist. I can't see where I am going wrong.
[ May 08, 2007: Message edited by: Patrick Wegono ]
10 years ago
I am also in need of this information mentioned in this post.For anyone who got this study material for scjp java 5 exam, please forward to patmuga@gmail.com
How easy/difficult is it to move from EJB 2.0 to EJB 3.0. Does EJB 2 provide any foundation or EJB 3 is a totally new dimension?