Invalid MIT-MAGIC-COOKIE-1 key - linux

I get this error-"Invalid MIT-MAGIC-COOKIE-1 key"
when running a program with sudo in ubuntu
example-
sudo gedit /etc/profile...
without sudo, it runs fine...
gedit /etc/profile runs fine
also...
sudo ./studio.sh gives this error
No protocol specified
Start Failed: Internal Error. Failed to initialize graphics environment
java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:128)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.awt.Toolkit$2.run(Toolkit.java:860)
at java.awt.Toolkit$2.run(Toolkit.java:855)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
at java.awt.Toolkit.getEventQueue(Toolkit.java:1734)
at java.awt.EventQueue.isDispatchThread(EventQueue.java:1049)
at javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1361)
at javax.swing.text.StyleContext.reclaim(StyleContext.java:454)
at javax.swing.text.StyleContext.addAttribute(StyleContext.java:311)
at javax.swing.text.html.StyleSheet.addAttribute(StyleSheet.java:578)
at javax.swing.text.StyleContext$NamedStyle.addAttribute(StyleContext.java:1501)
at javax.swing.text.StyleContext$NamedStyle.setName(StyleContext.java:1312)
at javax.swing.text.StyleContext$NamedStyle.<init>(StyleContext.java:1259)
at javax.swing.text.StyleContext.addStyle(StyleContext.java:107)
at javax.swing.text.StyleContext.<init>(StyleContext.java:87)
at javax.swing.text.html.StyleSheet.<init>(StyleSheet.java:166)
at javax.swing.text.html.HTMLEditorKit.getStyleSheet(HTMLEditorKit.java:391)
at com.intellij.util.ui.UIUtil.<clinit>(UIUtil.java:102)
at com.intellij.ide.plugins.PluginManager.start(PluginManager.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.ide.Bootstrap.main(Bootstrap.java:39)
at com.intellij.idea.Main.main(Main.java:86)
./studio.sh runs fine
how to solve this?
I got it solved using
xhost local:
in terminal

xhost local: is not secure if your machine can have multiple users (and even if it doesn't currently, that's a bad habit). Indeed, other local users could have access to your X server. Restrict the local connections to user root with:
xhost +si:localuser:root

Related

I can not run successfuly for cucumber report

I can run successfully in terminal window by command “mvn clean verify -Dcucumber.options="--tags #ValidateLoggedInUser"”
Because some the other test cases have error. So I need to debug to check the step and reason.
But there is error when run it in *.feature file.
java.lang.NullPointerException at
com.cucumber.listener.Reporter.loadXMLConfig(Reporter.java:56) at
com.dxc.vpc.automation.glue.CucumberUtilities.extentReport(CucumberUtilities.java:26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498) at
cucumber.runtime.Utils$1.call(Utils.java:40) at
cucumber.runtime.Timeout.timeout(Timeout.java:16) at
cucumber.runtime.Utils.invoke(Utils.java:34) at
cucumber.runtime.java.JavaHookDefinition.execute(JavaHookDefinition.java:60)
at cucumber.runtime.Runtime.runHookIfTagsMatch(Runtime.java:224) at
cucumber.runtime.Runtime.runHooks(Runtime.java:212) at
cucumber.runtime.Runtime.runBeforeHooks(Runtime.java:202) at
cucumber.runtime.model.CucumberScenario.run(CucumberScenario.java:40)
at
cucumber.runtime.model.CucumberFeature.run(CucumberFeature.java:165)
at cucumber.runtime.Runtime.run(Runtime.java:122) at
cucumber.api.cli.Main.run(Main.java:36) at
cucumber.api.cli.Main.main(Main.java:18)

Can't connect to X11 window server using ':0'

I want to open phpStorm with this code :
sudo phpstorm
because i want to access to root mode. And I've got this error message in terminal :
> No protocol specified
> Start Failed: Failed to initialize graphics environment
> java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115)
at java.security.AccessController.doPrivileged(Native Method)
at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)
at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:128)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:264)
at java.awt.Toolkit$2.run(Toolkit.java:860)
at java.awt.Toolkit$2.run(Toolkit.java:855)
at java.security.AccessController.doPrivileged(Native Method)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
at java.awt.Toolkit.getEventQueue(Toolkit.java:1734)
at java.awt.EventQueue.isDispatchThread(EventQueue.java:1049)
at javax.swing.SwingUtilities.isEventDispatchThread(SwingUtilities.java:1361)
at javax.swing.text.StyleContext.reclaim(StyleContext.java:454)
at javax.swing.text.StyleContext.addAttribute(StyleContext.java:311)
at javax.swing.text.html.StyleSheet.addAttribute(StyleSheet.java:578)
at javax.swing.text.StyleContext$NamedStyle.addAttribute(StyleContext.java:1501)
at javax.swing.text.StyleContext$NamedStyle.setName(StyleContext.java:1312)
at javax.swing.text.StyleContext$NamedStyle.<init>(StyleContext.java:1259)
at javax.swing.text.StyleContext.addStyle(StyleContext.java:107)
at javax.swing.text.StyleContext.<init>(StyleContext.java:87)
at javax.swing.text.html.StyleSheet.<init>(StyleSheet.java:166)
at javax.swing.text.html.HTMLEditorKit.getStyleSheet(HTMLEditorKit.java:391)
at com.intellij.util.ui.UIUtil.<clinit>(UIUtil.java:103)
at com.intellij.ide.plugins.PluginManager.start(PluginManager.java:78)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.intellij.ide.Bootstrap.main(Bootstrap.java:39)
at com.intellij.idea.Main.main(Main.java:78)
I can run phpstorm with usermode :
phpstorm
What should i do ?

how to Use jdb to analyze the coredump file

There is a coredump file created in one machine, But when i move it to other machine (which have the same java version), use the same command to analyze, it faild.
the command is like that below,
db -connect sun.jvm.hotspot.jdi.SACoreAttachingConnector:javaExecutable=/home/xxxx/app/jdk1.6.0_31/bin/java,core=core.java.1409350847.30890
and the error message is:
java.io.IOException at
sun.jvm.hotspot.jdi.SACoreAttachingConnector.attach(SACoreAttachingConnector.java:139)
at
com.sun.tools.example.debug.tty.VMConnection.attachTarget(VMConnection.java:358)
at
com.sun.tools.example.debug.tty.VMConnection.open(VMConnection.java:168)
at com.sun.tools.example.debug.tty.Env.init(Env.java:64) at
com.sun.tools.example.debug.tty.TTY.main(TTY.java:1010)
Caused by:
java.lang.reflect.InvocationTargetException at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597) at
sun.jvm.hotspot.jdi.SACoreAttachingConnector.createVirtualMachine(SACoreAttachingConnector.java:96)
at
sun.jvm.hotspot.jdi.SACoreAttachingConnector.attach(SACoreAttachingConnector.java:124)
... 4 more
Caused by: sun.jvm.hotspot.debugger.DebuggerException:
Doesn't appear to be a HotSpot VM (could not find symbol
"gHotSpotVMTypes" in remote process) at
sun.jvm.hotspot.HotSpotAgent.setupVM(HotSpotAgent.java:400) at
sun.jvm.hotspot.HotSpotAgent.go(HotSpotAgent.java:315) at
sun.jvm.hotspot.HotSpotAgent.attach(HotSpotAgent.java:174) at
sun.jvm.hotspot.jdi.VirtualMachineImpl.createVirtualMachineForCorefile(VirtualMachineImpl.java:206)
... 10 more
who can tell me why? Thanks very much.

cassandra snapshot : Unable to create hard link from errno 1

i'm using cassandra 1.2.8 in ubuntu 12.4.
i used snapshot command already and backing up process was ok!
but now when i use this command i get error like below:
Exception in thread "main" FSWriteError in /var/lib/cassandra/data/english/word_doc /snapshots/1393155090911/english-word_doc-ic-10-Index.db
at org.apache.cassandra.io.util.FileUtils.createHardLink(FileUtils.java:80)
at org.apache.cassandra.io.sstable.SSTableReader.createLinks(SSTableReader.java:1063)
at org.apache.cassandra.db.ColumnFamilyStore.snapshotWithoutFlush(ColumnFamilyStore.java:1566)
at org.apache.cassandra.db.ColumnFamilyStore.snapshot(ColumnFamilyStore.java:1611)
at org.apache.cassandra.db.Table.snapshot(Table.java:194)
at org.apache.cassandra.service.StorageService.takeSnapshot(StorageService.java:2205)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:74)
at sun.reflect.GeneratedMethodAccessor7.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:277)
at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:112)
at com.sun.jmx.mbeanserver.StandardMBeanIntrospector.invokeM2(StandardMBeanIntrospector.java:46)
at com.sun.jmx.mbeanserver.MBeanIntrospector.invokeM(MBeanIntrospector.java:226)
at com.sun.jmx.mbeanserver.PerInterface.invoke(PerInterface.java:138)
at com.sun.jmx.mbeanserver.MBeanSupport.invoke(MBeanSupport.java:253)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:856)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:805)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1476)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:98)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1317)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1409)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:839)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$1.run(Transport.java:177)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:173)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:553)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:808)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:667)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.io.IOException: Unable to create hard link from /var/lib/cassandra/data/english/word_doc/english-word_doc-ic-10-Index.db to /var/lib/cassandra/data/english/word_doc/snapshots/1393155090911/english-word_doc-ic-10-Index.db (errno 1)
at org.apache.cassandra.utils.CLibrary.createHardLink(CLibrary.java:174)
at org.apache.cassandra.io.util.FileUtils.createHardLink(FileUtils.java:76)
... 40 more
note: my current data base is a back up version that i restore in my cassandra!
thanks for your help :)
edit: i have two keyspace,A and B. B is a back up version that i restore and store more data on it, but A is not. i can create back up from A with out any problem,but for B i get above error!
this seems to be an ubuntu 12.04 security issue on hard-links.
use this command to disable that:
sudo sysctl -w kernel.yama.protected_nonaccess_hardlinks=0
and after restore, reset it to its original value:
sudo sysctl -w kernel.yama.protected_nonaccess_hardlinks=1
After struggling with this issue again I found that I had a few root-owned files inside /var/lib/cassandra/data/.../etcetera, which triggered the hard link access restriction.
Recursively chowning all directories and files inside /var/lib/cassandra/data solved the problem.

Problems installing appdynamics

I have installed Appdynamics lite on my server and it worked fine when I used to run my tomcat instance with root user. But from the time I have created a new user "Tomcat" and start executing my apache tomcat with this user, I am not able to run appdynamics. I have copied the javaagent at this location with all rights(read,write,execute) to tomcat "/home/tomcat/profiler/AppServerLite". It throws an exception as follows :
Install Directory resolved to[/home/tomcat/profiler/AppServerLite]
java.lang.RuntimeException: Invalid Agent Installation Directory [/home/tomcat/profiler/AppServerLite]
at com.singularity.ee.agent.appagent.AgentEntryPoint.addThirdPartyURLs(AgentEntryPoint.java:190)
at com.singularity.ee.agent.appagent.AgentEntryPoint.premain(AgentEntryPoint.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:343)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:358)
Install Directory resolved to[/home/tomcat/profiler/AppServerLite]
java.lang.RuntimeException: Invalid Agent Installation Directory [/home/tomcat/profiler/AppServerLite]
at com.singularity.ee.agent.appagent.AgentEntryPoint.addThirdPartyURLs(AgentEntryPoint.java:190)
at com.singularity.ee.agent.appagent.AgentEntryPoint.premain(AgentEntryPoint.java:144)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:343)
at sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:358)
18 Apr, 2013 1:57:03 PM org.apache.catalina.core.AprLifecycleListener init
You should copy all files to run the agent, not just javaagent.jar.
This is a thread about it. http://appsphere.appdynamics.com/t5/Lite-for-Java/Keep-getting-a-quot-Invalid-Agent-Installation-Directory-quot-on/td-p/1151
A great place to ask this question would be on the AppDynamics discussion forums so that AppDynamics support can answer you directly... http://appsphere.appdynamics.com/t5/Discussions/ct-p/Discussions
I'm guessing there is a permissions issue somewhere.

Resources