if you're running leopard, then simply
chmod +x (script)
Thursday, 2 October 2008
Tuesday, 12 August 2008
Installing a Western Digital My Book
Ok, if you decide to go with one of these - for now forget the network drive. I couldn't get that to work with a Mac at all.
Instead, go with the USB version. I went with the 1TB My Book Essential usb.
Don't try anything clever like formatting it to a Journaled Mac Volume because it won't work. Simply reformat it as a Dos volume and rename it to whatever you want the drive to be called. Then start Time Machine, point Time Machine at the drive and let Time Machine format it for you.
Runs like a dream after that.
Instead, go with the USB version. I went with the 1TB My Book Essential usb.
Don't try anything clever like formatting it to a Journaled Mac Volume because it won't work. Simply reformat it as a Dos volume and rename it to whatever you want the drive to be called. Then start Time Machine, point Time Machine at the drive and let Time Machine format it for you.
Runs like a dream after that.
Saturday, 12 July 2008
Accessing Shared Folders from Vista in VirtualBox
Name your shared folder in VirtualBox - e.g. 'Shared1'.
In Windows Map a network drive to: \\vboxsvr\Shared1.
Anybody running Vista in VirtualBox on a Mac may have problems seeing shared folders.
There are a number of blogs and threads around describing tips and tricks to resolve the problem.
In my case the problem was quite simple - Windows Live OneCare was configured with my Wifi Network as Public which meant it blocked local networking. Just change it to Private, or Home and the problem is resolved.
In Windows Map a network drive to: \\vboxsvr\Shared1.
Anybody running Vista in VirtualBox on a Mac may have problems seeing shared folders.
There are a number of blogs and threads around describing tips and tricks to resolve the problem.
In my case the problem was quite simple - Windows Live OneCare was configured with my Wifi Network as Public which meant it blocked local networking. Just change it to Private, or Home and the problem is resolved.
Monday, 7 July 2008
Netbeans Fails to Open Projects after installing Plug-ins
This one is a beauty. I finally resolved it by adding plug-ins in in groups and isolating the actual plug-in that causes the problem.
The openoffice api (developer) causes a null pointer exception and stops any or all projects being opened/created and displayed in the project dialog.
The openoffice api (developer) causes a null pointer exception and stops any or all projects being opened/created and displayed in the project dialog.
Netbeans on Mac and Xalan Errors
With Netbeans 6.1 running on Java 6.x on an Intel Mac running Leopard, you will find that Netbeans may not start - reporting corruption due to Xalan (I forget the exact message).
As a checkpoint, do the following:
In a terminal shell, running which java will give the response
/usr/bin/java
ls -al /usr/bin/java shows the following symlink
lrwxr-xr-x 1 root wheel 74 9 May 21:25 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
now cd /System/Library/Frameworks/JavaVM.framework/Versions
and ls -al to give all the java versions:
This is what you should have to solve the netbeans problem. Do not update the symlinks to point to Java 1.6.
--
Now, if you are having the Xalan error you need to remove references to xalan from Netbeans.
cd $HOME/.netbeans
find 6.1 -name xalan.jar -print | xargs rm -f (RUN THIS AT YOUR OWN PERIL - STANDARD DISCLAIMERS APPLY)
Next, edit /Applications/Utilities/Java/Java Preferences.App and tell it that you want to use java6.
Finally, open Netbeans and in Project Properties -> Libraries, click on Manage platforms and add Java6.0
Then set your project in Project Properties -> Source, and Project Properties -> Libraries to use that platform.
As a checkpoint, do the following:
In a terminal shell, running which java will give the response
/usr/bin/java
ls -al /usr/bin/java shows the following symlink
lrwxr-xr-x 1 root wheel 74 9 May 21:25 /usr/bin/java -> /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
now cd /System/Library/Frameworks/JavaVM.framework/Versions
and ls -al to give all the java versions:
drwxr-xr-x 16 root wheel 544 6 Jul 09:29 .
drwxr-xr-x 11 root wheel 374 29 May 19:18 ..
lrwxr-xr-x 1 root wheel 5 9 May 21:25 1.3 -> 1.3.1
drwxr-xr-x 3 root wheel 102 14 Jan 05:12 1.3.1
lrwxr-xr-x 1 root wheel 5 21 Feb 16:22 1.4 -> 1.4.2
lrwxr-xr-x 1 root wheel 3 9 May 21:25 1.4.1 -> 1.4
drwxr-xr-x 8 root wheel 272 21 Feb 16:22 1.4.2
lrwxr-xr-x 1 root wheel 5 21 Feb 16:22 1.5 -> 1.5.0
drwxr-xr-x 9 root wheel 306 22 May 20:13 1.5.0
lrwxr-xr-x 1 root wheel 5 9 May 21:25 1.6 -> 1.6.0
drwxr-xr-x 11 root wheel 374 6 Jul 09:28 1.6.0
drwxr-xr-x 8 root wheel 272 9 May 21:25 A
lrwxr-xr-x 1 root wheel 3 6 Jul 09:29 Current -> 1.5
lrwxr-xr-x 1 root wheel 3 6 Jul 09:29 CurrentJDK -> 1.5
This is what you should have to solve the netbeans problem. Do not update the symlinks to point to Java 1.6.
--
Now, if you are having the Xalan error you need to remove references to xalan from Netbeans.
cd $HOME/.netbeans
find 6.1 -name xalan.jar -print | xargs rm -f (RUN THIS AT YOUR OWN PERIL - STANDARD DISCLAIMERS APPLY)
Next, edit /Applications/Utilities/Java/Java Preferences.App and tell it that you want to use java6.
Finally, open Netbeans and in Project Properties -> Libraries, click on Manage platforms and add Java6.0
Then set your project in Project Properties -> Source, and Project Properties -> Libraries to use that platform.
Tuesday, 19 February 2008
Implementing WebServices - Part I
Overview
I have recently been working on jax-ws webservices using Netbeans, Tomcat, and using Ant to build and deploy these systems.
Whilst much of what is involved is pretty straightforward, I could not find one single document that takes the developer through everything so have decided to write my own.
Requirement
Install Java
Install Netbeans
Install Tomcat
Using Netbeans develop a webservice that will deploy to Tomcat
Create a webservice client that can call the webservice
Environment
I am developing on a Dell Latitude 630, with 2GB RAM, and running Windows XP.
Step 1 – Install Java
Go to http://java.sun.com/javase/ and download the latest version of Java SE. I am running JDK 6 Update 4. Install Java and go with all the defaults
Step 2 – Install Netbeans
Go to http://download.netbeans.org/netbeans/6.0/final/ and download the latest version of Netbeans. I have gone with the ‘All’ bundle. Install Netbeans and go with all the defaults
Step 3 – Install Tomcat
Go to http://tomcat.apache.org/ and download ‘Tomcat v5.5’. From Binary distributions, select the Core->zip bundle. Extract the bundle to C:\apache-tomcat-5.5.25
Step 4 – Install JAX-WS
Go to https://jax-ws.dev.java.net/2.1.3/ and click on the link to download the binary. I am running JAX-WS RI 2.1.3. Double click on the downloaded binary and this will extract the contents into a sub-folder jaxws-ri.
If you look in jaxws-ri\lib you will see all the jars that we need for deploying to Tomcat
Step 5 – Copy JAX-WS jars to Tomcat
If necessary create the directory C:\apache-tomcat-5.5.25\shared\lib and copy all the jars from jaxws-ri\lib to C:\apache-tomcat-5.5.25\shared\lib. Tomcat will now support WebServices.
Step 6 – Configure Netbeans to work with Tomcat
Go to services and right click on Servers. Click on Add Server
Select Tomcat 5.5 from the list of available servers and click on Next
Click on the Browse button
Navigate to where you installed Tomcat and click on Open
Create a user for Tomcat by entering the username and password into the Username and Password fields (default admin, admin), and click on Finish
You will now see Tomcat in the list of available servers
Step 7 – Configure Tomcat to run on port 80
Navigate to C:\apache-tomcat-5.5.25\conf and edit server.xml
Change the Connector Port from 8080 to 80:
To:
Step 8 – Create the WorkSpace
Create the directory C:\Filing\Workspaces\examples in which all your projects will be stored.
Step 9 – Create the WebService Project
Right click in the Projects tab and click on New Project
Select Web->Web Application and click Next
Fill in the fields as follows, and click Finish:
Project Name: WebService One
Project Location: c:\Filing\Workspaces\examples
Server: Tomcat 5.5
Java EE Version: J2EE 1.4
Context Path: /WebService_One
Set Source Level to 1.4 - unchecked
Set as Main Project - unchecked
The WebService One project will open with the index.jsp page opened for edit.
Change the title and h1 body elements from JSP Page to WebService One
Click on the Save All icon in the toolbar
Right click on index.jsp in the projects screen and select Run File
The project will be deployed to the tomcat server. The server will start and the page will be displayed
Step 10 – Include the JAX-WS Jars in the Project Path to compile Web Services
Right click on the Project Name and select Properties from the pop-up menu
Click on Libraries
Click on ‘Add Jar / Folder’
Navigate to C:\apache-tomcat-5.5.25\shared\lib
Select jaxws-tools.jar and click Open
uncheck the Package
Right click on the WebService One project in the projects screen and select New->Web Service
In the WebService name enter ‘WSOne’
In the Package, enter ‘com.examples.webservices’
Click on Finish
Web Service WSOne will open in the Design Screen
Click on ‘Add Operation’
In the name field enter ‘getMessage’
Click on ‘Add’ to add a parameter and set the parameterName to ‘userName’
Click on OK.
Click on the Source tab to see the source that has been generated:
The generated web service source is as follows:
Step 12 – Compile and Run the WebService
Click on the Save All icon to save the new webservice
Right click on the WebServiceOne project and select Clean and Build
If you get an error at this point stating that WSGen cannot be found, then you have not included the jar file from tomcat/shared/lib in your build path (Step 10)
Created dir: C:\Filing\Workspaces\examples\WebService One\build\generated\wsgen\service
Created dir: C:\Filing\Workspaces\examples\WebService One\build\generated\wsgen\binaries
C:\Filing\Workspaces\examples\WebService One\nbproject\jaxws-build.xml:12:
taskdef class com.sun.tools.ws.ant.WsGen cannot be found
BUILD FAILED (total time: 0 seconds)
Right click on the project and select ‘Undeploy and Deploy’ (since the server is already running)
Expand the Web Service folder in the project screen and right click on the WSOne web service, click on Test Web Service
The browser will open to the web service
Click on the hyperlink to view the WSDL for this web service
The WSDL for this web service is
Step 13 – Modify the Web Service to return the message
Modify the getMessage method to return the message Hello ‘name“
I have recently been working on jax-ws webservices using Netbeans, Tomcat, and using Ant to build and deploy these systems.
Whilst much of what is involved is pretty straightforward, I could not find one single document that takes the developer through everything so have decided to write my own.
Requirement
Install Java
Install Netbeans
Install Tomcat
Using Netbeans develop a webservice that will deploy to Tomcat
Create a webservice client that can call the webservice
Environment
I am developing on a Dell Latitude 630, with 2GB RAM, and running Windows XP.
Step 1 – Install Java
Go to http://java.sun.com/javase/ and download the latest version of Java SE. I am running JDK 6 Update 4. Install Java and go with all the defaults
Step 2 – Install Netbeans
Go to http://download.netbeans.org/netbeans/6.0/final/ and download the latest version of Netbeans. I have gone with the ‘All’ bundle. Install Netbeans and go with all the defaults
Step 3 – Install Tomcat
Go to http://tomcat.apache.org/ and download ‘Tomcat v5.5’. From Binary distributions, select the Core->zip bundle. Extract the bundle to C:\apache-tomcat-5.5.25
Step 4 – Install JAX-WS
Go to https://jax-ws.dev.java.net/2.1.3/ and click on the link to download the binary. I am running JAX-WS RI 2.1.3. Double click on the downloaded binary and this will extract the contents into a sub-folder jaxws-ri.
If you look in jaxws-ri\lib you will see all the jars that we need for deploying to Tomcat
Step 5 – Copy JAX-WS jars to Tomcat
If necessary create the directory C:\apache-tomcat-5.5.25\shared\lib and copy all the jars from jaxws-ri\lib to C:\apache-tomcat-5.5.25\shared\lib. Tomcat will now support WebServices.
Step 6 – Configure Netbeans to work with Tomcat
Go to services and right click on Servers. Click on Add Server
Select Tomcat 5.5 from the list of available servers and click on Next
Click on the Browse button
Navigate to where you installed Tomcat and click on Open
Create a user for Tomcat by entering the username and password into the Username and Password fields (default admin, admin), and click on Finish
You will now see Tomcat in the list of available servers
Step 7 – Configure Tomcat to run on port 80
Navigate to C:\apache-tomcat-5.5.25\conf and edit server.xml
Change the Connector Port from 8080 to 80:
<!-- Define a non-SSL HTTP/1.1 Connector on port 8080 -->
<Connector port="8080"
maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set connectionTimeout value
To:
<!-- Define a non-SSL HTTP/1.1 Connector on port 80 -->
<Connector port="80" maxHttpHeaderSize="8192"
maxThreads="150" minSpareThreads="25" maxSpareThreads="75"
enableLookups="false" redirectPort="8443" acceptCount="100"
connectionTimeout="20000" disableUploadTimeout="true" />
<!-- Note : To disable connection timeouts, set connectionTimeout value
Step 8 – Create the WorkSpace
Create the directory C:\Filing\Workspaces\examples in which all your projects will be stored.
Step 9 – Create the WebService Project
Right click in the Projects tab and click on New Project
Select Web->Web Application and click Next
Fill in the fields as follows, and click Finish:
Project Name: WebService One
Project Location: c:\Filing\Workspaces\examples
Server: Tomcat 5.5
Java EE Version: J2EE 1.4
Context Path: /WebService_One
Set Source Level to 1.4 - unchecked
Set as Main Project - unchecked
The WebService One project will open with the index.jsp page opened for edit.
Change the title and h1 body elements from JSP Page to WebService One
Click on the Save All icon in the toolbar
Right click on index.jsp in the projects screen and select Run File
The project will be deployed to the tomcat server. The server will start and the page will be displayed
Step 10 – Include the JAX-WS Jars in the Project Path to compile Web Services
Right click on the Project Name and select Properties from the pop-up menu
Click on Libraries
Click on ‘Add Jar / Folder’
Navigate to C:\apache-tomcat-5.5.25\shared\lib
Select jaxws-tools.jar and click Open
uncheck the Package
Right click on the WebService One project in the projects screen and select New->Web Service
In the WebService name enter ‘WSOne’
In the Package, enter ‘com.examples.webservices’
Click on Finish
Web Service WSOne will open in the Design Screen
Click on ‘Add Operation’
In the name field enter ‘getMessage’
Click on ‘Add’ to add a parameter and set the parameterName to ‘userName’
Click on OK.
Click on the Source tab to see the source that has been generated:
The generated web service source is as follows:
package com.examples.webservices;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
/**
*
* @author johnd
*/
@WebService()
public class WSOne
{
/**
* Web service operation
*/
@WebMethod(operationName = "getMessage")
public String getMessage(@WebParam(name = "userName") String userName)
{
//TODO write your implementation code here:
return null;
}
}
Step 12 – Compile and Run the WebService
Click on the Save All icon to save the new webservice
Right click on the WebServiceOne project and select Clean and Build
If you get an error at this point stating that WSGen cannot be found, then you have not included the jar file from tomcat/shared/lib in your build path (Step 10)
Created dir: C:\Filing\Workspaces\examples\WebService One\build\generated\wsgen\service
Created dir: C:\Filing\Workspaces\examples\WebService One\build\generated\wsgen\binaries
C:\Filing\Workspaces\examples\WebService One\nbproject\jaxws-build.xml:12:
taskdef class com.sun.tools.ws.ant.WsGen cannot be found
BUILD FAILED (total time: 0 seconds)
Right click on the project and select ‘Undeploy and Deploy’ (since the server is already running)
Expand the Web Service folder in the project screen and right click on the WSOne web service, click on Test Web Service
The browser will open to the web service
Click on the hyperlink to view the WSDL for this web service
The WSDL for this web service is
<?xml version="1.0" encoding="UTF-8" ?>
<!--
Published by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.1-b03-.
-->
<!--
Generated by JAX-WS RI at http://jax-ws.dev.java.net. RI's version is JAX-WS RI 2.1.1-b03-.
-->
<definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://webservices.examples.com/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://webservices.examples.com/" name="WSOneService">
<types>
<xsd:schema>
<xsd:import namespace="http://webservices.examples.com/" schemaLocation="http://localhost:80/WebService_One/WSOne?xsd=1" />
</xsd:schema>
</types>
<message name="getMessage">
<part name="parameters" element="tns:getMessage" />
</message>
<message name="getMessageResponse">
<part name="parameters" element="tns:getMessageResponse" />
</message>
<portType name="WSOne">
<operation name="getMessage">
<input message="tns:getMessage" />
<output message="tns:getMessageResponse" />
</operation>
</portType>
<binding name="WSOnePortBinding" type="tns:WSOne">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
<operation name="getMessage">
<soap:operation soapAction="" />
<input>
<soap:body use="literal" />
</input>
<output>
<soap:body use="literal" />
</output>
</operation>
</binding>
<service name="WSOneService">
<port name="WSOnePort" binding="tns:WSOnePortBinding">
<soap:address location="http://localhost:80/WebService_One/WSOne" />
</port>
</service>
</definitions>
Step 13 – Modify the Web Service to return the message
Modify the getMessage method to return the message Hello ‘name“
package com.examples.webservices;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
/**
*
* @author johnd
*/
@WebService()
public class WSOne
{
/**
* Web service operation
*/
@WebMethod(operationName = "getMessage")
public String getMessage(
@WebParam(name = "userName") String userName)
{
return "Hello "+userName;
}
}
Subscribe to:
Posts (Atom)