Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

Ryan P. Kane

Greenhorn
+ Follow
since Jun 18, 2004
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 Ryan P. Kane

Hello,

I have a question about synchronization. I have a method that must be run synchronously, not just for the instance, but for all of my instances of this class that are in my pool. If I have a pool of java objects of class MyClass, and if I make tje non-static method on MyClass synchronized, calls to that method will only be synchronized on one instance from the pool, right? If it were a static method, I believe it would synchronize for all instances in the pool, but I don't want the method to be static. So to synchronize a method call when I have a pool of objects, is better to put a synchronize block in the method?

Thanks,
Ryan
9 years ago
Does anyone know if Weblogic's InitialContextFactory caches InitialContext objects? If not, is it really bad to have a caching mechanism that creates an InitialContext and never closes it?

Thanks,
Ryan
17 years ago
Thanks for the advice everyone. I actually got a break, and got hired with a consulting company in Columbus, OH. I'm quite anxious to start and get some actual work experience to support my qualifications. Thanks for the help!

Ryan
17 years ago
Hello all,

I have my BS in Computer Science and I recently grabbed my MS in CS too. In my MS program, I did a lot of projects with Java/J2EE, and that is what I would like to do with my life. I really enjoy working with J2EE, and I've been searching for a position as a Java/J2EE developer. The problem is that despite the fact that I have a Masters and my SCJP, I still have trouble getting my foot in the door with companies. I attribute this trouble to the fact that I lack industry development experience. I'm looking for advice on ways to get some good experience as a recent graduate. I have considered trying to find some telecommuting jobs doing Java/J2EE development, but I'm not sure that will be any easier. Please offer me your suggestions.

Thanks,
Ryan Kane
17 years ago
Thanks,
I may have left out an important detail though...
Does it make any difference if it is using Container Managed Persistance?

Thanks,
Ryan
Here's an example from an assignment I had to do for class last week. I used the env-entry to provide JDBC info, so I didn't have to hard code it.


In my java code, I did the following:



Hope that helps,
Ryan
[ August 05, 2004: Message edited by: Ryan P. Kane ]
Can the findByPrimaryKey method of the Home interface have a primitive as a parameter, or does it require an object? e.g.

public Course findByPrimaryKey(int courseID);

or

public Course findByPrimaryKey(Integer courseID);

Thanks,
Ryan
This has a lot to do with EJB, and I found out how to do it. In the deployment descriptor, you can specify parameters as follows:

<enterprise-beans>

<session>
<ejb-name>RegistrationStatus</ejb-name>
<home>srs.ejb.StatusHome</home>
<remote>srs.ejb.Status</remote>
<ejb-class>srs.ejb.StatusBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
<env-entry>
<env-entry-name>jdbcDriver</env-entry-name>
<env-entry-type>java.lang.String </env-entry-type>
<env-entry-value>COM.cloudscape.core.JDBCDriver</env-entry-value>
</env-entry>
<env-entry>
<env-entry-name>jdbcUrl</env-entry-name>
<env-entry-type>java.lang.String </env-entry-type>
<env-entry-value>jdbc:cloudscape:c:\jhu</env-entry-value>
</env-entry>

</session>

</enterprise-beans>

Then in your code, you can do the following:


[ July 27, 2004: Message edited by: Ryan P. Kane ]
OK, with paramName, that can be configured externally in web.xml. Yes the paramName is hard coded, but its value can be changed from the web.xml file thus preventing code changes. You recommend using JNDI, which is great, but doesn't solve my problem. Here's why:



So in the above example I have three things that I consider "hard coded". Number one is the url to the JNDI tree, number two is the INITIAL_CONTEXT_FACTORY value of "weblogic.jndi.WLInitialContextFactory", and number three is the DataSource with the value of "jhuDataSource". I'm new to EJB, but they are supposed to be distributable and configurable right?. I thought for sure there would be a way to supply these pieces of information to my EJB without hard coding, but now I'm not sure. In a servlet or JSP you use the web.xml file to supply parameters like these. Can you do this with EJB?

Ryan
I guess I need to further specify what I'm looking for. I used the JDBC parameters as an example, but I'm really just looking for a way to pass all sorts of configuration parameters to an EJB, not just JDBC specifics. Even if I create a Connection Pool and a DataSource, I'm still hard coding the JNDI context name into the code, and I'd like to avoid that. Is there something equivalent to config.getInitParam("paramName") in a servlet? I guess I could create a set method for the parameters, but then I'm reliant upon clients executing that set method prior to running any methods that might require the parameters.

Thanks for your help,

Ryan
Hello,

What's the easiest way to provide an EJB data like a JDBC driver, a database's URL, and a database's username and password without hard coding those parameters into the EJB? I think it has something to do with the <resource-ref> tag, but I am having a little trouble figuring this one out. I'm familiar with doing this in the Web Container with web.xml, but not with EJBs. Anyhow, if someone could help me out with an example, I'd really appreciate it. Thanks!

Ryan Kane
Dmitry,

I just finished doing a homework assignment using XSLT, and I had a question about the context node. In my xml document, there were person objects and project objects. Persons have an id, and projects have an idref to refer to a person as an assignment. What I needed to do was to create a report listing each person and the projects they were assigned to. It seems that when I used a template match to locate the persons, I couldn't call another template match from the person level context to locate a project because the context node was now located at the same level in the tree as project. I ended up getting around this by using xsl:for-each tags. I looped through each person, and from each person, I looped through the projects he/she were assigned to by comparing the id with the idref. This worked fine, but differently from doing a template match. Is there a reason why my template match was constrained by the current context, but the xsl:for-each wasn't? Sorry this question is so complex. Thanks,

Ryan
[ July 15, 2004: Message edited by: Ryan P. Kane ]
Thanks Jeanne,

My biggest problem was that I was using the default columns in the monitoring table. I added them all, and it made much more sense because it gave me the 'Curr Capacity' column, which made it clear that it was pooling. I was looking for that value in the 'Connections' column, but like you said, connections aren't shown there unless they are actual physical connections being used. Thanks again,

Ryan
Hello,

Just wondering if anyone could explain to me why after I set the initial number of connections for my Weblogic 8.1 connection pools to be 5, the monitor says there are 0 connections. I thought maybe it was because I was using Cloudscape, and the Cloudscape evaluation only allows 1 connection. However, I tried it with SQL Server, and I can connect, but the pool isn't opening 5 connections when I start the server.

Thanks,
Ryan
I think I found the solution to my own problem. A simple restart did the trick. The changes I made to my StudentInfo class were not noticed by the server. I had even unbound any previos instances of StudentInfo, but restarting reset everything, so that StudentInfo initially had the right methods. If someone can explain this to me in better detail, I'd appreciate it. Thanks,

Ryan