File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Performance and the fly likes java.lang.OutOfMemoryError Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Performance
Bookmark "java.lang.OutOfMemoryError" Watch "java.lang.OutOfMemoryError" New topic
Author

java.lang.OutOfMemoryError

adi arrab
Greenhorn

Joined: Mar 17, 2008
Posts: 8
java.lang.OutOfMemoryError: Java heap space
at java.util.Properties$LineReader.<init>(Unknown Source)
at java.util.Properties.load(Unknown Source)
at org.exolab.castor.xml.util.resolvers.ByCDR.getProperties(ByCDR.java:69)
at org.exolab.castor.xml.util.resolvers.ByCDR.internalResolve(ByCDR.java:109)
at org.exolab.castor.xml.util.resolvers.AbstractResolverPackageCommand.resolve(AbstractResolverPackageCommand.java:63)
at org.exolab.castor.xml.util.resolvers.CastorXMLStrategy.resolvePackage(CastorXMLStrategy.java:153)
at org.exolab.castor.xml.util.resolvers.CastorXMLStrategy.getDescriptor(CastorXMLStrategy.java:125)
at org.exolab.castor.xml.util.resolvers.CastorXMLStrategy.resolveClass(CastorXMLStrategy.java:82)
at org.exolab.castor.xml.util.XMLClassDescriptorResolverImpl.resolve(XMLClassDescriptorResolverImpl.java:241)
at org.exolab.castor.xml.util.XMLClassDescriptorResolverImpl.resolve(XMLClassDescriptorResolverImpl.java:198)
at org.exolab.castor.xml.Validator.validate(Validator.java:119)
at org.exolab.castor.xml.Marshaller.validate(Marshaller.java:2594)
at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:826)
at org.exolab.castor.xml.Marshaller.staticMarshal(Marshaller.java:798)
at org.exolab.castor.xml.Marshaller.marshal(Marshaller.java:727)
at com.nationwide.nsc.firm.si.io.impl.SerializerImpl.serializeXml(SerializerImpl.java:130)
at com.nationwide.nsc.firm.si.input.DatFileType.stepsOnFileType(DatFileType.java:60)
at com.nationwide.nsc.firm.si.service.impl.FileInputControllerEventHandlerImpl1.process(FileInputControllerEventHandlerImpl1.java:70)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:310)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:182)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:149)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:106)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:89)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:171)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at $Proxy5.process(Unknown Source)
at com.nationwide.nsc.firm.si.service.FileInputControllerEventHandlerTest1.testProcess(FileInputControllerEventHandlerTest1.java:35)




I Changed the jvm heap size to

-showsplash
com.genuitec.myeclipse.blue.product.ide
--launcher.XXMaxPermSize
256m
-vmargs
-Xms256m
-Xmx1400m
-Duser.language=en
-XX ermSize=128M
-XX:MaxPermSize=256M



This is the Code i am running multiple times to insert records into the database


public void stepsOnFileType(long fileType, long fileDefInstanceId, String fileNameOriginal, String fileNameUnique,
long fileStatusTypeId, long interfaceInstanceId, long workStatusTypeId, String layoutSetName) throws Exception {

LayoutSetInfo lsi = layoutManager.getLayoutSetInfo(layoutSetName);
DataFileReaderImpl dfr = new DataFileReaderImpl(serializerDeserializerManager, lsi, fileNameOriginal);
Deserializer deserializer = serializerDeserializerManager.getDeserializer(lsi.getDetailLayout());
Serializer serializer = serializerDeserializerManager.getSerializer(lsi.getDetailLayout());

new CreateFileObject().newFileObject(fileDefInstanceId, fileType, fileStatusTypeId, fileNameUnique, fileNameOriginal);
long workInstanceId = workInstanceDao.insert();
new CreateWork().newWork(workStatusTypeId, workInstanceId, interfaceInstanceId, 10);
long i = 1;
for (Object detail = dfr.readDetail(); detail != null; detail = dfr.readDetail()) {
WorkItemDto workItemDto = new WorkItemDto();
workItemDto.setWorkInstanceId(workInstanceId);
workItemDto.setRawData(dfr.getRawData());
String xml = serializer.serializeXml(deserializer.deserialize(dfr.getRawData()));
workItemDto.setXmlData(xml);
workItemDto.setSequence(i);
i++;
workItemDto = workItemDao.insert(workItemDto);
//log.debug(workItemDto.toString());
}
}



and This is the insert method


public WorkItemDto insert(WorkItemDto workItemDto) {

/*if (log.isDebugEnabled()) {
log.debug(Debug.getCurrentMethod(Thread.currentThread().getStackTrace()));
log.debug(workItemDto.toString());
}*/

WorkItem workItem = new WorkItem();

WorkInstance workInstance = new WorkInstance();
workInstance.setId(workItemDto.getWorkInstanceId());
//this.getHibernateTemplate().save(workInstance);

String[] ignoreProperties = {"workInstanceId"};
BeanUtils.copyProperties(workItemDto, workItem, ignoreProperties);
workItem.setWorkInstance(workInstance);

Timestamp timestamp = new Timestamp(System.currentTimeMillis());
workItem.setCreateTs(timestamp);
workItem.setUpdateTs(timestamp);
this.getHibernateTemplate().save(workItem);

workItemDto.setId(workItem.getId());
workItemDto.setCreateTs(workItem.getCreateTs());
workItemDto.setUpdateTs(workItem.getUpdateTs());

return workItemDto;

}


I will be inserting a lot of rows I dont know where i am creating the object and storing them but this error never goes

for small number of records its working but for big number of records its giving the above error.
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
use the [CODE] tags, it will make your post easier to read,
you can edit (pencil and paper icon) the post,
select the source code,
click the CODE button below the edit area

garbage collection tuning

[ UD: fixed URL ]
[ June 03, 2008: Message edited by: Ulf Dittmer ]

Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java.lang.OutOfMemoryError