Jump to content


Check out our Community Blogs

dlinx90

Member Since 03 Apr 2012
Offline Last Active Aug 01 2012 01:19 AM
-----

Posts I've Made

In Topic: Nullpointerexception For Getastext In Propertyeditor

10 May 2012 - 05:02 AM

Thanks that works!

That's pretty basic Java. How did you get this far in hibernate and Spring without knowing the basics.


Google.

In Topic: Nullpointerexception For Getastext In Propertyeditor

10 May 2012 - 04:13 AM

That's the value returned by the default toString() method. Add a toString() method to the Document class that returns the String you want to see printed.


If I add toString to the getDocumentNumber method in the Document.java as such:

public String getDocumentNumber(){
		return documentNumber.toString();
	}

then i get the following error:
org.springframework.beans.InvalidPropertyException: Invalid property 'documentNumber' of bean class [testapp.domain.Document]: Getter for property 'documentNumber' threw exception; nested exception is java.lang.reflect.InvocationTargetException

And i cant add it to the getter in the DocumentRevision.java since it needs to return a Document type.

How should i do it?

In Topic: Nullpointerexception For Getastext In Propertyeditor

10 May 2012 - 03:29 AM

After adding this to the getAsText method it resolves the nullpointerexception:

	  if(getValue() == null){
    return null;
   }

But my problem is now how to be able to display the documentNumber as a String when I display the documentRevision table. Now it gets displayed as: testapp.domain.Document@1f93466.
What can i do to resolve this issue?

In Topic: Nullpointerexception For Getastext In Propertyeditor

10 May 2012 - 01:25 AM

what variable on line 59 has a null value? Find that variable and then find out why it does not have a valid non-null value.


It's this line:
return d != null ? String.valueOf(d.getDocumentNumber()) : "";
I'm guessing it's the "d" variable that has null value although I don't understand why. Does anyone know?

In Topic: Problem With Url Mapping In Spring Hibernate Wb Application

26 April 2012 - 06:45 AM

fixed it but now I'm back to this error :

HTTP Status 404 -

type Status report
message
description The requested resource () is not available.

I don't see why I'm not entering my controller.. could there be something wrong with my build?

<?xml version="1.0"?>
<project name="MIS" default="build" basedir=".">
<!-- Configure the build properties file which contains properties to access the Manager application -->
<property file="build.properties"/>

<!-- Configure the directory into which the web application is built -->
<property name="build.dir" value="${basedir}/build"/>

<!-- Configure source directory that contains the java code -->
<property name="src.dir" value="src"/>

<!-- Configure web directory -->
<property name="web.dir" value="WebContent"/>

<!--Configure the context path for the application -->
<property name="path" value="/mistest"/>

<!-- Add all the lib files inside the WebContent/WEB-INF/lib directory as well as the tomcat lib files to the classpath -->
<path id="master-classpath">
  <fileset dir="${web.dir}/WEB-INF/lib">
   <include name="*.jar"/>
  </fileset>
  <fileset dir="${appserver.lib}"> <!-- Apache Tomcat lib. ${appserver.lib} comes from the build.properties file -->
   <include name="servlet*.jar"/>
  </fileset>
  <pathelement path="${build.dir}"/>
</path>
<!-- Configure Catalina jars that are needed for tomcat -->
<path id="catalina-ant-classpath">
  <fileset dir="${appserver.lib}">
   <include name="catalina-ant.jar"/>
  </fileset>
</path>

<!--Configure the custom Ant tasks for the Manager application -->
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask">
  <classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="undeploy" classname="org.apache.catalina.ant.UndeployTask">
  <classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="start" classname="org.apache.catalina.ant.StartTask">
  <classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="stop" classname="org.apache.catalina.ant.StopTask">
  <classpath refid="catalina-ant-classpath"/>
</taskdef>
<taskdef name="reload" classname="org.apache.catalina.ant.ReloadTask">
  <classpath refid="catalina-ant-classpath"/>
</taskdef>
<!-- Executable Targets -->
<target name="init" description="Creates build directory">
  <mkdir dir="${build.dir}"/>
</target>

<target name="build" depends="init" description="Compiles the java files in the main source tree and creates a war file">
  <javac destdir="${build.dir}" debug="true" srcdir="${src.dir}">
   <classpath refid="master-classpath"/>
  </javac>
	    <war destfile="${build.dir}/${path}.war"
		 webxml="${web.dir}/WEB-INF/web.xml">
		 <fileset dir="${web.dir}">
			 <include name="**/*.*"/>
		    </fileset>
	    </war>
</target>

<target name="deploy" depends="build" description="Install web application">
  <deploy url="${tomcat.manager.url}"
    username="${tomcat.manager.username}"
    password="${tomcat.manager.password}"
    path="${path}"
    war="${build.dir}${path}.war"/>
</target>

<target name="undeploy" description="Remove web application">
  <undeploy url="${tomcat.manager.url}"
    username="${tomcat.manager.username}"
    password="${tomcat.manager.password}"
    path="${path}"/>
</target>

<target name="start" description="Start web application in Tomcat">
  <start url="${tomcat.manager.url}"
    username="${tomcat.manager.username}"
    password="${tomcat.manager.password}"
    path="${path}"/>
</target>

<target name="stop" description="Stop web application in Tomcat">
  <stop url="${tomcat.manager.url}"
    username="${tomcat.manager.username}"
    password="${tomcat.manager.password}"
    path="${path}"/>
</target>

<target name="reload" depends="deploy" description="Reload web application">
  <reload url="${tomcat.manager.url}"
    username="${tomcat.manager.username}"
    password="${tomcat.manager.password}"
    path="${path}"/>
</target>

</project>

to start the application in tomcat all i have to use is build+deploy

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download