Friday, July 25, 2008

Could not instantiate bean class Is it an abstract class?

Ran into an interesting error this afternoon. I have a base class which is abstract and when i deployed my app I received the above error.

The fix is simple add abstract=”true” to your bean defination:

Hey Presto!

Spring Hibernate hbm2ddl.auto & Annotations

Spent Yesterday and today drawing up a schema for www.justcars.ie Ireland’s newest and hottest place to source your car.

To create this schema I wanted to get hibernate generate it via the POJOs I create. I am using annotations. So here is what i did:

Step One:

Create the POJO:

@Entity
public class Manufacteur {

@Id
private Integer manufacteurlId;

…..

}

Make sure you import javax.persistence.*; & not the more intuitive sounding hibernate one .

Step Two:

I am using a hibernate.cfg.xml for neatness:



org.gjt.mm.mysql.Driver
yourPassword
jdbc:mysql://localhost:3306/YourScehma
YourUsername
jYourScehma
org.hibernate.dialect.MySQL5Dialect
true
true
create-drop



Change the pieces in bold as appropriate.

Step Three servlet:

Ensure your session factory bean if you are using annotations is using the AnnotationSession otherwise you will get an “Annotation Instance required ” exception.

Point the session factory to your hibernate.cfg.xml

/WEB-INF/hibernate.cfg.xml
true

Step Four:

Depoly & hey Presto hibernate is creating your schema! :)

Required extension “ant” not found Spring 2.0

Having this problem! It’s caused me untold trouble. Anyway the problem is actually in the spring distribution. Unzip the commons-attributes-compiler.jar, open the MANIFEST.MF and remove lines with a space and text.

Example:

ant-Implementation-URL: http://www.ibiblio.org/maven/ant/jars/ant-1.5.
jar

Should be replaced with:

ant-Implementation-URL: http://www.ibiblio.org/maven/ant/jars/ant-1.5.jar

There is quite a few of these to be fixed.

Save the file.

Rezip and ensure the .jar extension

Hey Presto!

The input type of the launch configuration does not exist

Trying to run a JUnit test case & getting this error?

Right click on the folder in which you have located the test case and under build path - select use as source folder

Hey Presto!

Thursday, July 24, 2008

Increasing simeltaneous connections on oracle XE

If you've set up an oracle server, you may find you need to allow more simeltaneous connections (during heavy testing or data migration for example).

Connect as the system user and issue the following command:
alter system set processes=100 scope=spfile;
where 100 is the number of processes allowed.

You may also want to alter the permissions of the users concerned with the tests:

ALTER USER USERNAME QUOTA UNLIMITED ON USERS;

Where USERNAME is the user's name and USERS is the user's tablespace (default is USERS).
(This information is visible in the SQL section of a user's properties in SQL Developer)

Installing Oracle 10.2 Express Edition (SUSE 10.3)

Was given a linux server (SUSE 10.3) in work (Dell PowerEdge300SC 512MB RAM) and asked to install Oracle 10.2 XE (oracle-xe-10.2.01.1-1.0.i386.rpm)
Here's a list of some of the problems and solutions I encountered:

P1. Need to be root to perform the install.
S1. In your terminal window type "su -"
You will be prompted for your root password.
Provided you enter it correctly you will now be root.

P2. Now that you've changed user you may not be able to find where you downloaded everything!
S2. The home directory of your previous user is located at /home/username
So type cd /home/username to navigate to it.

P3. Some dependencies may not be present for the install to go ahead - i had the following issue
"Failed dependencies:
libaio >= 0.3.96 is needed by oracle-xe-10.2.01.1-1.0.i386.rpm
S3. Searched RPM repositories for this, got a higher version 0.3.104. I saved this in the same directory as the oracle install and ran
rpm -ivh libaio-0.3.104-74.i586.rpm

That ran successfully, so once again I tried to run the oracle installer
rpm -ivh oracle-xe-10.2.01.1-1.0.i386.rpm.

P4. Got another problem - insufficient swapsize (Machine's was set to 1019, needed 1024, so close but yet so far)
This system does not meet the minimum requirements for swap space. Based on the amount of physical memory available on the system, Oracle Database 10g Express Edition requires 1024 MB of swap space. This system has 1019 MB of swap space. Configure more swap space on the system and retry the installation.
error: %pre(oracle-xe-10.2.01.1-1.0.i386) scriplet failed, exit status 1
error: install: %pre scriptlet failed (2), skipping oracle-xe-10.2.01.1-1.0.


S4: It may suit you to alter the swap partition, ideally if you're installing SUSE / linux from scratch before reading this, make sure to read the advised swap file sizes - around double the size of your ram so 512 ram, 1024 swap.
This didn't suit me as the partitions on this particular machine were all over the place. After much trying to rejig the partitions I found this option:
Adding a swapfile (Thanks to http://www.redhat.com/docs/manuals/linux/RHL-8.0-Manual/custom-guide/s1-swap-adding.html)

1. At a shell prompt as root, type the following command with count being equal to the desired block size:
dd if=/dev/zero of=/swapfile bs=1024 count=65536 (64MB swap file, I doubled that last number)
2. Setup the swap file with the command:
mkswap /swapfile
3. To enable the swap file immediately but not automatically at boot time:
swapon /swapfile

The red hat link suggests you can enable it at boottime (I havent done this yet, perhaps I'll need it when I reboot)

4. To enable it at boot time, edit /etc/fstab to include
/swapfile swap swap defaults 0 0

A step by step guide to using impdp over NETWORK LINK

A step by step guide to using oracle's impdp datapump over NETWORK LINK
by a novice non linux user

OK there are plenty of web results for how to use impdp but none of them singularly gave a good end to end description of the process.

Some background
My project have been piggybacking on another project's DB for testing, and now want to move on to their own.
So we needed to copy all common data from the other project's DB.

Having set up a shiny new oracle install (see previous post) here's what I had to do.

First of all create a data link from your Db (the target/destination) to the old db (the source).
I tried doing this the way most of the websites suggested:
CREATE PUBLIC DATABASE LINK blahsyslink
CONNECT TO USERNAME IDENTIFIED BY PASSWORD
USING 'BLAH';


To go down that route, you need to have a 'BLAH' profile in tnsnames.ora
to look something like:
BLAH = (DESCRIPTION=(ADDRESS_LIST=(
ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.111)(PORT=1521)))
(CONNECT_DATA=(SID=serviceid))

)
ORA-39001: invalid argument value
ORA-39200: Link name "BA" is invalid.
ORA-12154: TNS:could not resolve the connect identifier specified

I bypassed this (rather gave up on trying it!) by describing the datalink as follows
(drop public database link blahsyslink might come in handy beforehand)
CREATE public DATABASE LINK blahsyslink
CONNECT TO USERNAME IDENTIFIED BY PASSWORD USING
'(DESCRIPTION=(ADDRESS_LIST=(
ADDRESS=(PROTOCOL=TCP)(HOST=192.168.1.111)(PORT=1521)))
(CONNECT_DATA=(SID=serviceid))
)'
/

It should be public because users other than SYSTEM are the ones likely to be using it

Your next task is to create a directory where oracle can store the dump from the source machine while it is working:
CREATE DIRECTORY dmpdir AS '/opt/oracle'; < this was on other sites, didn't work for me as the directory didn't exist
ORA-39002: invalid operation
ORA-39070: Unable to open the log file.
ORA-29283: invalid file operation
ORA-06512: at "SYS.UTL_FILE", line 475
ORA-29283: invalid file operation

fixed it by
Drop directory dmpdir
CREATE DIRECTORY dmpdir AS '/usr/lib/oracle/xe/app/
oracle/product/';
not necessarily the best choice of directory, but one that existed and not full of other files (i could clean it easily)

Finally grant write access to the user you wish to do the copying to that directory
GRANT read, write ON DIRECTORY dmpdir TO BLAH;

Now in the command line, on the machine you are copying to:
navigate to ORACLE_HOME/bin
and run the following command:
impdp BLAH DIRECTORY=dmpdir NETWORK_LINK=blahsyslink;

Enter BLAH's password (for local system) when prompted

Wednesday, July 23, 2008

Liquidlnf eclipse install

Ok so….. this is a plugin for eclipse that makes your GUI look all fancy..


Here is the link to its homepage:

https://liquidlnf.dev.java.net/


Step One:

Extract the liquid source jar to a location of your choice.


Step Two:

Import the source files into your project.


Step Three:

You will notice that the class SwingUtilities2.java is missing, you need to create it in your com folder. Create the directory structure com.sun.java.swing and place the class located here into it .


Step Four:

Simply import com.birosoft.*; into your main program.


Create a Windows Share

Just a quick note on setting up a shared folder with correct permissions.

Step One:


If this is a new folder to be shared create it somewhere on the network.

Right click on the folder you want to share and select "Sharing and Security"

Step Two:



Click "Share this folder". You should now enter a name for the share (please note that this is the share name which other computers will access the folder by)

Add a comment about the folder, its function on the network perhaps.

If you wish to restrict the number of users who can access the folder at one time set the limit using the "Allow this number of users" option.

Step Three:

Press the permissions button to setup correct folder permissions. what follows is a list of users who have acces to the folder.



If this is a share which everyone will be using (For example a share which contains a software pacakage or database) i would advise granting "everyone" full access.

To do this simply click "add" in the next screen type "everyone" and click "check names". then click ok. you will be returned to the list of users who may access the folder. Click on a user ("everyone") and in the panel below click "Full Control".

You can use this Add functionality to add only specific users to a folder. when doing this i would be careful to add "Domain Admins" to the user list and grant them full access. This will remove the problem of an employee leaving and thus nobody being able to access his/her personal folder on the network.

Step Four:

On a client machine you may access the share in many ways, the easiest being.

  • Map a drive to the share.
  • Start -> run. type \\servername\sharename.
Mapping the Drive probably the best course of action so to remove the need to manually access the share each time.

Hey

Im conor and will hopefully be providing some easy to use troubleshooting as the problems arise and are fixed.

Hello

Just a quick note to introduce myself, I'm David and I hope to publish some helpful step by step guides on SetupSteps.net!

"Network Path Not Found"

Very common problem with a windows network. Here is a guide to various solutions.

Step One:

Try to ping the server from a client machine using both the server name and ipaddress. Server name is likely to not work.

Next try to ping the server name and ip address from the server.

At this point i would also go to start -> administrative tools -> DNS. and check the error logs from the DNS to see if anything specific has happened in the last few minutes.

Step Two:

Go to start -> run. and type services.msc
this will bring up the list of services installed on your machine. Look for the TCP/IP Help service, ensure that this service is running.

Next you need to ensure that the Routing and Remote Acces service is disabled. right click on the service and view its properties. In startup type make sure disabled is selected.



Step Three:

Go to my network places -> right click on the local area connection and view its properties. The list provided should contain the following:

  • Client for microsoft networks
  • Network Load balancing
  • File and Printer sharing
  • Internet ProtoCol (TCP/IP)


One problem I have seen in the past is this list being populated by a device driver, if this is the case remove the driver from the list by clicking on it and uninstalling before continuing.

Now click TCP/IP settings and properties. If you are using static IP and gateways, ensure that they are correct. Click advanced and go to the WINS tab. In the netbios settings section, ensure that "enable NetBios over TCP/IP" is selected.

Step Four:

From a client machine go to start -> run. and then type \\severname



QuickFix:

If the network path is critical. attempt to ping the server from a client machine using the ip as in step one. If this works then remap the network drives to \\ip_address\sharename for the time being until the problem as a whole is fixed.

Welcome - SetupSteps.net

Welcome to SetupSteps.net where we'll hopefully give you quick guides to the tasks you're trying to do right now, written just after we've done those tasks. With no assumptions of knowledge or intermediate steps!

We hope you enjoy and it saves you hours of searching combining different other guides!