premchand Singh

Ranch Hand
+ Follow
since Mar 12, 2012
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
2
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by premchand Singh

I have doubt in the signature of the two paths which is used as java secure file :

file:/dev/urandom
$
file:/dev/./urandom

can anybody please let me know what is the difference between them..

Thanks
Premchand
6 years ago
i removed the jar "jaxb-impl.jar" from the lib folder and the problem got resolved...
6 years ago
Hi am getting below error in my simple XML java application.

I have added below jars my project, it seems keeping or removing "jaxb-api-2.0.2" doesn't make any change in the exception.

jaxb-api-2.0.2
jaxb-libs
jaxb-ri
jaxb-xjc

2015/11/19 11:52:59.253 | java.lang.SecurityException: sealing violation: package com.sun.xml.bind is sealed
2015/11/19 11:52:59.253 | at java.net.URLClassLoader.getAndVerifyPackage(URLClassLoader.java:399)
2015/11/19 11:52:59.253 | at java.net.URLClassLoader.definePackageInternal(URLClassLoader.java:419)
2015/11/19 11:52:59.253 | at java.net.URLClassLoader.defineClass(URLClassLoader.java:451)
2015/11/19 11:52:59.253 | at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
2015/11/19 11:52:59.253 | at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
2015/11/19 11:52:59.253 | at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
2015/11/19 11:52:59.253 | at java.security.AccessController.doPrivileged(Native Method)
2015/11/19 11:52:59.253 | at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
2015/11/19 11:52:59.253 | at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
2015/11/19 11:52:59.253 | at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
2015/11/19 11:52:59.253 | at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
2015/11/19 11:52:59.253 | at com.sun.xml.bind.DefaultJAXBContextImpl.<init>(DefaultJAXBContextImpl.java:60)
2015/11/19 11:52:59.253 | at com.sun.xml.bind.ContextFactory.createContext(ContextFactory.java:27)
2015/11/19 11:52:59.253 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2015/11/19 11:52:59.253 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
2015/11/19 11:52:59.253 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2015/11/19 11:52:59.253 | at java.lang.reflect.Method.invoke(Method.java:497)
2015/11/19 11:52:59.253 | at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:181)
2015/11/19 11:52:59.253 | at javax.xml.bind.ContextFinder.newInstance(ContextFinder.java:131)
2015/11/19 11:52:59.253 | at javax.xml.bind.ContextFinder.find(ContextFinder.java:293)
2015/11/19 11:52:59.253 | at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:431)
2015/11/19 11:52:59.253 | at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:394)
2015/11/19 11:52:59.253 | at javax.xml.bind.JAXBContext.newInstance(JAXBContext.java:298)
2015/11/19 11:52:59.253 | at com.capgemini.glp.util.clarity.mapper.ProjectPojoXMLMapper.createProjectXML(ProjectPojoXMLMapper.java:79)
2015/11/19 11:52:59.253 | at com.capgemini.glp.job.InterfaceHandler.process(InterfaceHandler.java:257)
2015/11/19 11:52:59.253 | at com.capgemini.glp.job.CJAccessor.scheduledEventFired(CJAccessor.java:59)
2015/11/19 11:52:59.253 | at com.niku.njs.Dispatcher$BGTask.run(Dispatcher.java:395)
2015/11/19 11:52:59.253 | at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
2015/11/19 11:52:59.253 | at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
2015/11/19 11:52:59.253 | at java.lang.Thread.run(Thread.java:745)

what might be the reason for this this error.


thanks in advance...

6 years ago
hj,

I have a hashmap which contains duplicate values,



i want to find out the employee number which is duplicate, also the count of the number of employee name i.e how many times it has occurred.
i have written the logic, but not able to find the count of occurrances...




your suggestion/solution will be a great help for me...

thanks in advance :
Premchand
6 years ago
Yes after executing line no : 46, it is directly going in catch block.

in line no: 92, and the exception caught is nullPointerException. the same exception is being thrown in next statement using throw statement.

It seems there is some problem in the statement - JAXBContext.newInstance("com.xxx.xxx.xxx");



6 years ago
Yes i am catching the error in a try catch block like below :

192. } catch (Exception e) {
193. e.printStackTrace();
194. throw new XMLException("Unable to generate Project XML file","XML_PROJECT_NO_XML_GENERATED");
195. }

what you have mentioned in the comment is the same as line no : 194.
6 years ago
I am pasting the whole stacktrace :

java.lang.NullPointerException
at com.sun.xml.bind.GrammarInfoFacade.getProbePoints(GrammarInfoFacade.java:68)
at com.sun.xml.bind.GrammarInfoFacade.<init>(GrammarInfoFacade.java:38)
at com.sun.xml.bind.GrammarInfoFacade.createGrammarInfoFacade(GrammarInfoFacade.java:110)
at com.sun.xml.bind.DefaultJAXBContextImpl.<init>(DefaultJAXBContextImpl.java:57)
at com.sun.xml.bind.ContextFactory.createContext(ContextFactory.java:27)
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 javax.xml.bind.ContextFinder.newInstance(Unknown Source)
at javax.xml.bind.ContextFinder.newInstance(Unknown Source)
at javax.xml.bind.ContextFinder.find(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at javax.xml.bind.JAXBContext.newInstance(Unknown Source)
at com.company.glc.util.clarity.mapper.ProjectPojoXMLMapper.createProjectXML(ProjectPojoXMLMapper.java:46)
at com.company.glc.job.InterfaceHandler.process(InterfaceHandler.java:216)
at com.company.glc.job.InterfaceHandler.main(InterfaceHandler.java:360)
Exception in thread "main" com.company.glc.util.clarity.exception.XMLException: Unable to generate Project XML file
at com.company.glc.util.clarity.mapper.ProjectPojoXMLMapper.createProjectXML(ProjectPojoXMLMapper.java:194)
at com.company.glc.job.InterfaceHandler.process(InterfaceHandler.java:216)
at com.company.glc.job.InterfaceHandler.main(InterfaceHandler.java:360)

Lst line of the code is responsible for calling the stacktrace.

6 years ago
Hi I have more than 15 pojo classes from which i have to generate xml files,
when i am trying to create instance of JAXBContext to load those classes as below :

JAXBContext.newInstance("com.company.objects.project");
It is showing error like this :

java.lang.NullPointerException
at com.sun.xml.bind.GrammarInfoFacade.getProbePoints(GrammarInfoFacade.java:68)
at com.sun.xml.bind.GrammarInfoFacade.<init>(GrammarInfoFacade.java:38)
at com.sun.xml.bind.GrammarInfoFacade.createGrammarInfoFacade(GrammarInfoFacade.java:110)
at com.sun.xml.bind.DefaultJAXBContextImpl.<init>(DefaultJAXBContextImpl.java:57)
at com.sun.xml.bind.ContextFactory.createContext(ContextFactory.java:27)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)

what i am missing in this ..


6 years ago
I got the answer :

This simple statement worked for me :

line.replaceAll("/.*?/", "")

Thanks everybody who tried to help me
6 years ago
let me become clear on this :

suppose i have code like this :

/* 16: */ public String toString()

i want output like as below :

public String toString()

I have tried the regular expression mentioned in the chain..

i hope this should clarify the question :
6 years ago
/* 16: */

This code will be removed at all from the file.
6 years ago
I have tried with below code :

line.replaceAll("/* (.*?) */", " ");
line.replaceAll("\\*.*?/", " ");

but it is not working this code..
6 years ago
Hi,
I want to remove all characters between /* and */ in java.

for Example, if the line is like this :

/* 16: */ public String toString()
i should get the output like this
public String toString()

Could some one please let me know the "Expression" in java that can be used with String.replaceAll.


Thanks in advance :
Premchand.
6 years ago
I meant all my java classes in my project are in the format of .class file. I have taken those files in Java decompiler. I want all new java files should be structerd as a project as it was in original.
7 years ago