November 2007 - Posts
It's only been two days passed but I already feel bored. My final pay is on-hold until next month and I don't really have anything to spend my time with but my books, laptop and PSP. But I don't want those right now.. I'm still stuck on dial-up, no movies that I can download.
I've been browsing through Jared Odulios blog and I saw one of his posts, http://jaredtech.blogspot.com/2007/07/rp-software-group-slams-poaching-by.html and I couldn't help but laugh. It brought to me Melvin Dave's podcast here in devpinoy. I really like these java people's attitudes towards technology, economic situation and all.
I'll be starting on December 3 on my new job. Best of luck for me! I hate going through the whole pre-employment process like medical checkups, NBI clearance, etc. I really hate paper works!
I couldn't get started on any of my personal projects, I think I really lost the drive right now. Two weeks to go and I need to find a new place to live in(apartment, anyone?). So many things in mind, I wish I saved enough for my vacation...
I'm having a terrible headache right now... I guess I have to turn off my machine for now. Laterz...
Before I was enlightened, I thought that a computer uses the swap/virtual memory to store newly opened applications that the RAM could no longer hold. I think that is partially correct. But I learned that a better way of thinking of this is that when your applications goes idle, the memory that the idle application uses is then swapped into the hard disk/virtual memory. In Mastering EJB, 3rd edition, this was termed as Context Switching.
This is important in the EJB world as this concept is used for Stateful Session Beans, which hold a lot of data/resources.
It's so hard to learn new technologies in such a low-end machine. I have 512 MB of RAM in my laptop of 1.8Ghz clock speed, 32MB of which is for the on-board video card. It uses about 350MB upon startup running Avas antivirus and who knows what else is running on the background?
I'm having no problems when I use eclipse and tomcat, that's fine. I think netbeans is somehow even more memory efficient... Just my observation. The problem is when I start BEA Weblogic Server, which is really a resource hungry monster... It eats about 350+ MB of RAM. Not to mention I still have to leave some PDF files open while I'm doing development.
I remember my highschool days when everybody was running on pentium II and III and I was stuck on a 133Mhz machine. I still laugh whenever I remember how my [...] games crashed back then... Lolz!
Anyway, VB 6 and Visual Studio 6 was a very friendly environment for my machine that time. I was able to code a few C programs, somehow. It was also where I first learned HTML, and first used Java applets and Flash.
I guess it will be part of my goal next year to be able to buy a new machine for learning purposes. Right now, Linxie-II will do just fine...
Ok, my server's done loading. Laterz!
While I was reading a tutorial in
EJB today and I read a portion on how a Servlet uses an EJB through JNDI, it
reminded me on how I did connection pooling in Tomcat before in one of my
previous projects.
//Looking up an EJB , from RoseIndia
example by Deepak Kumar
public void init(ServletConfig config) throws ServletException{
//Look up home interface
try {
InitialContext ctx = new InitialContext();
Object objref = ctx.lookup("TestSessionBean");
testSessionBean = (TestSessionBeanHome)PortableRemoteObject.narrow(objref,
TestSessionBeanHome.class);
} catch (Exception NamingException) {
NamingException.printStackTrace();
}
//The way I did Connection pooling
before
public static
Connection getConnectionFromPool()
{
ResourceBundle resourceManager =
ResourceBundle.getBundle(RESOURCE_PROPERTIES);
String dbResource =
resourceManager.getString("dbresource");
Connection conn = null;
try
{
Context ctx = new
InitialContext();
DataSource dataSource
= (DataSource)ctx.lookup("java:comp/env/" + dbResource);
conn =
dataSource.getConnection();
}
catch(NamingException nex)
{
//nex.printStackTrace();
//conn =
DataSourceManager.getConnection();
ConnectionBrokerManager.init();
conn =
ConnectionBrokerManager.getConnection();
}
catch(SQLException sqlex)
{
sqlex.printStackTrace();
}
System.out.println("Got Connection:
" + conn.toString() );
return conn;
}
I wasn't able to answer how I
did connection pooling in one of my job interviews before. It amazes me how things
like this is helping me to better understand things now. The name you specify
in ctx.lookup() should be configured in your
container. In tomcat, it's usually in web.xml or context.xml for your
datasource. For EJB's there's ejb-jar.xml and an additional
weblogic-ejb-jar.xml if you're using weblogic.
Additional Resources:
javax.naming.InitialContext
javax.naming.Context
I've been messing around with EJB and Weblogic these past few days. As of this time, I haven't really written any EJB's yet. I'm targeting version 2.1 since I think it would take some time before adaptation of EJB 3.0 would be widespread. I have to admit that I am going through a really painful process right now because I'm actually doing this so I could say something on my coming interview a few days from now (I passed the technical exam already, yeeeey!).
If you're reading this and you're curious about my life, well, I have to say I pushed my luck too far and lost both the opportunity local and abroad(hehehe). This thing I'm doing now(EJB) is a requirement for the job(one of the many jobs) I'm applying for. But they say when one door closes, two others open. So really, no hard feelings on that
I've been following a tutorial here. Unfortunately, I've been stuck on item number 7(refer to the tutorial) since I'm not all that familiar with Weblogic. I'm using weblogic 10.0 server btw. The weblogic installer didn't ask me for a username and password for the console app. So when I try to login in the console app, I get an error. I tried to search the internet until I bumped in this link, which actually advises to use the configuration wizard that you could run from the "start menu->bea products->tools". From there you can create a weblogic domain and the rest is self explanatory.
This should create a User Project in your C:\bea\user_projects\domains directory with a directory that would reflect the name you specified using the Configuration wizard.
I was now able to launch the admin console by invoking http://localhost:7001/console/. If you noticed, 7001 is the listener port unlike in tomcat which is 8080. I don't know if this is really the default for BEA or other application servers.
Now it's time for me to go home and continue wrestling with this tomorrow and finally write my first EJB!
Trivia: The console app in weblogic is somehow similar to tomcat's manager app which you can access by invoking in your browser the url like http://localhost:8080/manager.html