Benjamin Weaver

Ranch Hand
+ Follow
since Apr 08, 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 Benjamin Weaver

I would like to know whether Java's new fork/join parallel processing functionality is meant to replace Java multithreading, or, rather, supplement it.

I ask because somewhere I read a statement to the effect that functional languages (Haskell, Clojure) represent a more 'reliable' way to achieve the benefits of multithreading than concurrent multithreading itself.

I can at least partially understand this reasoning if it is in fact correct: why not divide into many processes what would have been divided into threads if common resources might be controlled by the process that forks and joins others?
But I could also understand how multithreading might be done on EACH parallel process. By this thinking the result of using fork/join functionality in combination with multithreading would be a multitude of multi-threaded processes.

So, at least in practice, are the two meant, or enabled, to be combined? or does fork/join functionality in Java 1.7 effectively replace concurrency and multithreading in Java?

Any perspective are greatly appreciated! Thanks in advance.

Hi all,

I am SJCP as of 05/2000. That's 13 years ago (70%). Things have moved on in Java. Even though I use Java all the time and write in it fluently, I now (reluctantly) realize my Java skills are insufficient and out-of-date.

I am looking for a book or website to learn Java in-depth through 1.7. These sources need not begin with elementary Java (although they could start with fundamentals); they have to cover all aspects of core Java thoroughly.

A good book I have found is Effective Java, by Joshua Bloch. But useful as this book is, I want one which systematically and rigorously reviews core features of the language. For example, I understand pretty well basic interface definition, use them all the time, and when to use an interface as opposed to an abstract class. I could write an interface without having to look up how to do this. But, for example, I did not understand questions about how to extend interfaces that make use of generics in their signatures. Also, for example, I need to learn in detail the new concurrency model.

I would like, for example, a thorough detailing of Garbage Collection.

It could well be a prep specifically for the Oracle Java certification exams, but need not be.

Any ideas about books, websites, forums (other than this great one!), etc. are welcome and appreciated!



I am a MongoDB newbie trying to understand this database.

If collections are not schema-fixed, that is, if documents can vary with regard to number and kind of field, why would one ever have more than 1 collection per database? What is the advantage of having multiple collections in one database?

Any perspectives are greatly appreciated!
9 years ago
Thanks a lot, Bear and Ulf. These observations are very helpful.

Ben
9 years ago
I have a fair amount of experience in Java/JVM programming but just about two days' worth using the Android 4 platform, with ADT on Eclipse. It is a very interesting platform.

The number of participants on this platform might be indicative but nevertheless I will ask my questions:

1. Will demand for apps written on the Android platform (the Java + XML layouts, etc.) continue or increase, or will (somehow) HTML 5 pages
replace Android-specific apps?

2. Will cpu-intensive operations continue to be crunched on phones using the Dalvik interface, or might they be farmed off to be done elsewhere on the grid with increasing frequency in the future?

Any perspectives, however brief, are greatly appreciated!

Ben Weaver
9 years ago
Tim, thanks for these detailed instructions. Just what I was looking for, with steps that I would not readily have figured out.
Pardon if this is elementary.

I would like to copy an eclipse project to a different project name. Everything in the project will stay the same, except for the project name itself and the project folder.
I would like to rename the folder holding the project to the new project name.

The project has been developed in Eclipse Helios (3.6.2), java jdk1.6.0_35. The project uses maven 3.04/m2Eclipse. I will want to check in the new copy of the project
into Subversion. Ideally I would like to leave the copy in the same workspace as the original.

1. What is the best procedure for copying such a mavenized project error free?

A related question, so I can understand how the process works--
2. What exactly (which config and other files saved under the hood by Eclipse) defines an Eclipse project?

Thank you, Siitesh, this is excellent, just the kind of advice I was looking for.

I will try a free-standing instance. Interesting about build.xml; I will look into using that.

Ben Weaver
9 years ago
I am a JBoss newbie. I have now cut my teeth on deploying to JBoss 5.1.0.GA.

I now want to set up a JBoss 5.1.0.GA instance for development in combination with Eclipse Helios (+ Maven).


My goal is to be able to hot-step/debug through Java code while running the server in a development environment.

What is the best way to achieve this environment?

1. using a JBoss plugin to Eclipse (JBoss Tools?)?

or

running a free standing JBoss instance, referencing it in Eclipse, and running it that way?


These two options would seem similar to those available for Eclipse development on Tomcat.


And is there a decent JBoss 5.1 server or Eclipse plugin to run on Windows XP? otherwise I'll use something that will run on Linux.
9 years ago
Thank you very much Tim, this was an extremely helpful answer.
This helped loads

I also found a good web page for this:
http://www.mkyong.com/maven/how-do-use-maven-to-create-a-dynamic-web-project-in-eclipse/


One thing I notice I am still getting is this file, called 'maven' which is deposited in my META-INF directory. I delete it after expanding the war, but I'll admit it's annoying.

Thanks for the help.

Ben
I am new to using the m2eclipse plugin. I am using eclipse Helios 3.6.2. java: 1.6.0.31

I want to include various maven dependencies (.jar files) in my .war depolyment. I want these jars to end up in the war file under myApp/WEB-INF/lib.

Currently I can build the project using the traditional eclipse method: from the Tomcat option | Deploy to war file path. Eclipse is apparently building against my .m2 repository. But presently only my project classes are exported to the war.


1. By what steps do I select the maven dependencies in eclipse for export to WEB-INF/lib ?

2. Once these are set up, how can I run a maven command to build the war file from within eclipse that will export the dependencies? Should I run the command using maven or can I do it in eclipse?


For example, in a simple JDBC application connecting to say oracle, let's say I want to include the jta-1.0.1.jar in under WEB-INF/lib on deployment. I have an entry in my pom file for it, as a dependency. jta-1.0.1.jar needs to end up under myApp/WEB-INF/lib/.

Many thanks in advance!

My apologies:

In this rather badly designed code to which I am new, it turns out that someone had completely by-passed the hibernate config in the class I mentioned in my last reply.

Once I changed that configuration. Everything ran.


To refine my question:


Is it possible that hibernate configuration or code could be ultimately responsible for the connection error?

I copy the first 2 lines error again here:

java.sql.SQLException: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
...

This to me does look like a physical connection problem. But as I mentioned I am able to connect successfully using JDBC or a Hello World hibernate program.


I did notice this line a few lines down in the stack trace:
..
at ocao.adss.reallocator.OCAODataSource.getConnection(OCAODataSource.java:38)
..

I have assumed that this class is using the hibernate config. But if it is not, then perhaps that class is causing the problem.

I am new to Hibernate, but not to JDBC.

When attempting to run an elaborate Hibernate-enabled app in eclipse, I get the error copied below.

Below, I include copies of the error stack trace, a successful Hello World hibernate configuration, and my unsuccessful hibernate configuration.

--A test program using the same connection information (triple checked) hits the database successfully.

--The hello world Hibernate application with a simple hibernate.cfg.xml file also hits the database successfully.

--but my larger hibernate application fails to connect to the database.

THANKS IN ADVANCE FOR ANY AND ALL SUGGESTIONS!


The error produced by the large hibernate application is:

java.sql.SQLException: The Network Adapter could not establish the connection
at oracle.jdbc.driver.T4CConnection.logon(T4CConnection.java:412)
at oracle.jdbc.driver.PhysicalConnection.<init>(PhysicalConnection.java:531)
at oracle.jdbc.driver.T4CConnection.<init>(T4CConnection.java:221)
at oracle.jdbc.driver.T4CDriverExtension.getConnection(T4CDriverExtension.java:32)
at oracle.jdbc.driver.OracleDriver.connect(OracleDriver.java:503)
at java.sql.DriverManager.getConnection(Unknown Source)
at java.sql.DriverManager.getConnection(Unknown Source)
at ocao.adss.reallocator.OCAODataSource.getConnection(OCAODataSource.java:38)


The successful helloworld hibernate configuration is:

<?xml version='1.0' encoding='utf-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>
..CONNECTION INFO (USERNAME, PASSWORD, URL)..
<property name="hibernate.connection.pool_size">10</property>
<property name="show_sql">true</property>
<property name="dialect">org.hibernate.dialect.Oracle10gDialect</property>
<property name="hibernate.hbm2ddl.auto">update</property>
<!-- Mapping files -->
<mapping resource="contact.hbm.xml"/>
</session-factory>
</hibernate-configuration>


Now, here is my behemouth hibernate config that is yielding the connection timeout error above. (of course I suppose the problem could be in code):


<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<hibernate-configuration>
<session-factory>

<property name="hibernate.show_sql">true</property>
<property name="hibernate.query.factory_class">
org.hibernate.hql.ast.ASTQueryTranslatorFactory
</property>
<property name="hibernate.jdbc.batch_size">30</property>
<property name="hibernate.jdbc.use_streams_for_binary">
true
</property>
<!-- <property name="hibernate.default_schema">adss_prod</property> -->
<property name="hibernate.use_outer_join">true</property>
<property name="hibernate.cache.provider_class">
org.hibernate.cache.EhCacheProvider
</property>
<property name="hibernate.dialect">
org.hibernate.dialect.Oracle9Dialect
</property>
<property name="hibernate.connection.driver_class">
oracle.jdbc.driver.OracleDriver
</property>


...CONNECTION INFO (URL, USERNAME, PASSWORD)


<property name="hibernate.cglib.use_reflection_optimizer">
false
</property>
...MANY HBM MAPPING FILES LIKE THE ONE JUST BELOW

<mapping resource="wrtt/adkt/model/core/College.hbm.xml" />

</session-factory>
</hibernate-configuration>