Win a copy of OCP Java SE 8 Programmer II Exam Study Guide this week in the OCP forum!

swapnel surade

Ranch Hand
+ Follow
since Mar 05, 2009
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 swapnel surade

Following response I received from indt pdfc guys

this problem is known and will be fixed in the next version of i-net PDFC which is currently slated for the end of this month. The problem is the usage of FileChannels in the parser, which are not instantly released by Java. the next version doesn't use this type of file access anymore
5 years ago
I've checked the api but there is nothing for to release the resorces.
IResultHandler.finish used to tell the result handler that no more error messages to add in handler.
5 years ago
I tried system.gc() also, waited for more than few minutes but files were still there.
5 years ago
I'm not passing any stream to the api, just passing file object.
batchRunner.runComparison(file1,file2);

Above method is getting called from my code

below is main method


5 years ago
Hello,

I'm using pdfc api to compare 2 pdf files. After comparison want to delete those files. When I used delete() method its not deleting those files and returning false.
When my code is running i tried to remove those files manually but following error message given by windows
"the action cannot be completed because the file is open in java tm platform se binary"

I think pdfc api is not closing the stream properly thats why files are not getting deleted.

Is there any way to delete files if any other api is using the streams for that file ?
5 years ago
Hello,

I'm using POI API to read and create the excel file. Currently file is getting created but its not as viewable as the old file.
In new file its not taking proper column width so its not look like old file.
What should be done to overcome such problem.

Thanks
6 years ago
Hello,

I have standalone application , using spring ioc in that app.
This app is executed using command prompt. When user press ctrl+c or close the command prompt, I have to add shutdown hook.
So that i can call my customised bean method.
Is it possible to achieve this functionality using spring 2.0.

while searching I got following method which is called as
context.registerShutdownHook()

but how method mentioned above will call my method.

I've to use spring 2.0 only.

Thanks
6 years ago
Hi,

When i get the string its look like this
1st string : Text "‐000001875‐0/000" was changed to "‐000001893‐0/000"
but when i print or use this string for comparison its look like this
2nd string : Text "?000001875?0/000" was changed to "?000001893?0/000"

I checked the charset format for 1st string it is showing CP1252 and i'm not getting hyphen '-' its a different char than hyphen.

When i convert this string into UTF-8 or 16 then special character is converted to '?'

I should get hyphen in second string.

Following is the code snippet


In above code when i get value from getDescription() method, I'm getting the special char. but when i used the getBytes("CP1252")
in that byte array its converting that special char into ?

am i using wrong charset ?


6 years ago
Hello,

Im using i-net PDF Content Comparer v1.10. after comparison when i try to read the difference string.
That string is having CP-1252 char format. but java recognize only utf format in this process I'm losing the characters.
What is the correct way to conversion from CP-1252 to UTF-16 or UTF-8 without losing the chars.

Thanks
6 years ago
using getRowNum() method can get the row count
6 years ago
Hello,

I'm using POI API to read the .xls file, but when I want to append new line in the file there is no method in api to append at the end of file.
I found HSSFSheet.createRow(int rownum) method but it requires the line number to insert, for that i have to traverse the excel sheet to get the last line number.
Is there any better option to append new row to end of the file ?
6 years ago
Hello,

Suppose there is a XML file


I have to print the whole A tag on the screen.
Is there any way to print these element as they appear in file.
Output should be like this


Hi,

I'm facing problem while loading the web page. I'm trying to load one external gwt javascript. At same time on onload event i'm calling one method.
Its working fine in Mozilla but for IE, method is getting executed first then javascript is loading. I have tried interval but still facing the same issue.
Following is the code snippet.

I want to load pctentrypoint/pctentrypoint.nocache.js this script
I'm calling loadPCTScreen(); method onLoad.






Thanks in advance.
Now I've tried the guava-r06.jar and guava-r08.jar but getting different exceptions as


java.lang.IllegalArgumentException: duplicate key: class javax.faces.convert.IntegerConverter
at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:62)
at com.google.common.collect.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:212)
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:198)
at org.richfaces.javascript.ClientServiceConfigParser.parseConfig(ClientServiceConfigParser.java:54)
at org.richfaces.application.ValidatorModule.createClientScriptService(ValidatorModule.java:68)
at org.richfaces.application.ValidatorModule.configure(ValidatorModule.java:62)
at org.richfaces.application.ServicesFactoryImpl.init(ServicesFactoryImpl.java:28)
at org.richfaces.application.InitializationListener.createFactory(InitializationListener.java:136)
at org.richfaces.application.InitializationListener.onStart(InitializationListener.java:110)
at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:152)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:106)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2129)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2105)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:300)
at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:603)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:369)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Aug 16, 2011 5:05:09 PM com.sun.faces.config.ConfigureListener contextInitialized
SEVERE: Critical error during deployment:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! duplicate key: class javax.faces.convert.IntegerConverter
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:379)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.IllegalArgumentException: duplicate key: class javax.faces.convert.IntegerConverter
at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:62)
at com.google.common.collect.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:212)
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:198)
at org.richfaces.javascript.ClientServiceConfigParser.parseConfig(ClientServiceConfigParser.java:54)
at org.richfaces.application.ValidatorModule.createClientScriptService(ValidatorModule.java:68)
at org.richfaces.application.ValidatorModule.configure(ValidatorModule.java:62)
at org.richfaces.application.ServicesFactoryImpl.init(ServicesFactoryImpl.java:28)
at org.richfaces.application.InitializationListener.createFactory(InitializationListener.java:136)
at org.richfaces.application.InitializationListener.onStart(InitializationListener.java:110)
at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:152)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:106)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2129)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2105)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:300)
at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:603)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:369)
... 16 more
Aug 16, 2011 5:05:09 PM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.sun.faces.config.ConfigureListener
java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! duplicate key: class javax.faces.convert.IntegerConverter
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4135)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4630)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! duplicate key: class javax.faces.convert.IntegerConverter
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:379)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225)
... 15 more
Caused by: java.lang.IllegalArgumentException: duplicate key: class javax.faces.convert.IntegerConverter
at com.google.common.collect.RegularImmutableMap.<init>(RegularImmutableMap.java:62)
at com.google.common.collect.ImmutableMap$Builder.fromEntryList(ImmutableMap.java:212)
at com.google.common.collect.ImmutableMap$Builder.build(ImmutableMap.java:198)
at org.richfaces.javascript.ClientServiceConfigParser.parseConfig(ClientServiceConfigParser.java:54)
at org.richfaces.application.ValidatorModule.createClientScriptService(ValidatorModule.java:68)
at org.richfaces.application.ValidatorModule.configure(ValidatorModule.java:62)
at org.richfaces.application.ServicesFactoryImpl.init(ServicesFactoryImpl.java:28)
at org.richfaces.application.InitializationListener.createFactory(InitializationListener.java:136)
at org.richfaces.application.InitializationListener.onStart(InitializationListener.java:110)
at org.richfaces.application.InitializationListener.processEvent(InitializationListener.java:152)
at javax.faces.event.SystemEvent.processListener(SystemEvent.java:106)
at com.sun.faces.application.ApplicationImpl.processListeners(ApplicationImpl.java:2129)
at com.sun.faces.application.ApplicationImpl.invokeListenersFor(ApplicationImpl.java:2105)
at com.sun.faces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:300)
at com.sun.faces.config.ConfigManager.publishPostConfigEvent(ConfigManager.java:603)
at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:369)
... 16 more
Aug 16, 2011 5:05:09 PM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Aug 16, 2011 5:05:09 PM org.apache.catalina.core.StandardContext start
SEVERE: Context [/jsfpractice] startup failed due to previous errors
Aug 16, 2011 5:05:09 PM com.sun.faces.config.ConfigureListener contextDestroyed
SEVERE: Unexpected exception when attempting to tear down the Mojarra runtime
java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.application.ApplicationFactory
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:894)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:319)
at com.sun.faces.config.InitFacesContext.getApplication(InitFacesContext.java:112)
at com.sun.faces.config.ConfigureListener.contextDestroyed(ConfigureListener.java:325)
at org.apache.catalina.core.StandardContext.listenerStop(StandardContext.java:4174)
at org.apache.catalina.core.StandardContext.stop(StandardContext.java:4778)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4675)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:785)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
at org.apache.catalina.core.StandardService.start(StandardService.java:519)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
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.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Aug 16, 2011 5:05:09 PM org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
SEVERE: The web application [/jsfpractice] created a ThreadLocal with key of type [null] (value [javax.faces.context.FacesContext$1@1a70b8]) and a value of type [com.sun.faces.config.InitFacesContext] (value [com.sun.faces.config.InitFacesContext@1de6817]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
6 years ago
JSF
but when i remove richfaces jar. application is deploying successfully. but as i add the richfaces jar, getting same error log.

Following jar is in my app
annotations-api.jar
batik-awt-util-1.6-1.jar
batik-ext-1.6-1.jar
batik-gui-util-1.6-1.jar
batik-util-1.6-1.jar
catalina-ant.jar
catalina-ha.jar
catalina-tribes.jar
catalina.jar
commons-beanutils-1.7.0.jar
commons-codec-1.3.jar
commons-collections-3.2.1.jar
commons-digester-1.6.jar
commons-el-1.0.jar
commons-fileupload-1.2.1.jar
commons-io-1.3.2.jar
commons-io-1.4.jar
commons-lang-2.4.jar
commons-logging-1.1.1.jar
commons-validator-1.3.1.jar
cssparser-0.9.5.jar
el-api.jar
guava-r06-site.jar
jasper-el.jar
jasper-jdt.jar
jasper.jar
jcommon-1.0.0.jar
jsf-api-2.1.1-b04.jar
jsf-impl-2.1.1-b04.jar
jsp-api.jar
jstl-1.1.2.jar
oro-2.0.8.jar
richfaces-components-api-4.0.0.Final.jar
richfaces-components-ui-4.0.0.Final.jar
richfaces-core-api-4.0.0.Final.jar
richfaces-core-impl-4.0.0.Final.jar
sac-1.3.jar
servlet-api.jar
standard-1.1.2.jar
tomcat-coyote.jar
tomcat-dbcp.jar
tomcat-i18n-es.jar
tomcat-i18n-fr.jar
tomcat-i18n-ja.jar
xml-apis-1.0.b2.jar
xmlParserAPIs-2.0.2.jar
6 years ago
JSF