Error while getting data Using RMI from services into WEB application - java

I am getting following exception while I am trying to get list of tasks, from services that I have written which are supporting hibernate 4, into web application which supports hibernate 3
java.rmi.UnmarshalException: error unmarshalling return; nested exception is:
java.lang.ClassNotFoundException: org.hibernate.collection.internal.PersistentBag (no security manager: RMI class loader disabled)
Services ------------------> WEB
(Hibernate 4) (Hibernate 3)
Web trying to get data from services through RMI and getting above excpetion

Apparently your client doesn't see the classes in your service. One of the methods to achieve this is to have a shared rmi code base. Consider following script that adds all jars in the lib folder and your primary jar in the dist folder to rmi codebase and make them visible to the client:
#!/bin/bash
lib_path=lib
artefact=name-of-your.jar
for file in $(ls $lib_path); do
lib=$lib:$lib_path/$file
rmicodebase="$rmicodebase file:$PWD/$lib_path/$file"
done
lib=$lib:dist/$artefact:etc
rmicodebase="$rmicodebase file:$PWD/dist/$artefact"
CLASSPATH=classes:etc:$lib
echo CLASSPATH: $CLASSPATH
echo rmicodebase=$rmicodebase
java -Xmx64M -Xms64M -classpath $CLASSPATH -Djava.rmi.server.codebase="$rmicodebase" $*
I assume that you have a shared rmi registry in the central process of your server. Another possibility to achieve the class visibility is to have a separate rmi registry running in the server process:
java.rmi.registry.LocateRegistry.createRegistry(port)
and have your client connect to this registry.
regards
Leon

Related

Apache Livy : Could not find or load main class org.apache.livy.server.LivyServer

I am trying to start Apache Livy 0.8.0 server on my windows 10 machine for spark 3.1.2 and hadoop 3.2.1. I am taking help from here.. I have successfully built apache livy using maven (I have attached a of it) But I am not able to run the livy server. When I run it I get the following error -
> starting C:/AmazonJDK/jdk1.8.0_332/bin/java -cp /d/ApacheLivy/incubator-livy-master/incubator-livy-master/server/target/jars/*:/d/ApacheLivy/incubator-livy-master/incubator-livy-master/conf:D:/Program_files/spark/conf:D:/ApacheHadoop/hadoop-3.2.1/etc/hadoop: org.apache.livy.server.LivyServer, logging to D:/ApacheLivy/incubator-livy-master/incubator-livy-master/logs/livy--server.out
ps: unknown option -- o
Try `ps --help' for more information.
failed to launch C:/AmazonJDK/jdk1.8.0_332/bin/java -cp /d/ApacheLivy/incubator-livy-master/incubator-livy-master/server/target/jars/*:/d/ApacheLivy/incubator-livy-master/incubator-livy-master/conf:D:/Program_files/spark/conf:D:/ApacheHadoop/hadoop-3.2.1/etc/hadoop: org.apache.livy.server.LivyServer:
Error: Could not find or load main class org.apache.livy.server.LivyServer
full log in D:/ApacheLivy/incubator-livy-master/incubator-livy-master/logs/livy--server.out
I am using Git bash. If you need more information I will provide
The error got resolved when I used Windows Subsystem for Linux (WSL).

Running SOLR on a desktop application

**while running solr 4.10.3 solr\examples i ran following command on cmd java -jar start.jar
after this when i go on http://localhost:8983/ i got this error
Error 404 - Not Found.
No context on this server matched or handled this request.
Contexts known to this server are:
/solr ---> o.e.j.w.WebAppContext{/solr,null},D:\solr-4.10.3\exampleD:/solr-4.10.3/example/webapps/solr.war
try http://localhost:8983/solr. By this you are provding the web application within which it might need to find index.* i.e. welcome file.

Error while starting GoldFish server: Ubuntu 13.10

I consulted here and here but could not get my problem solved.
When I type this on terminal /opt/glassfish4/glassfish/bin/asadmin start, I get the following result:
Remote server does not listen for requests on [localhost:4848]. Is the server up?
Unable to get remote commands.
Closest matching local command(s):
restart-domain
restart-local-instance
start-database
start-domain
start-local-instance
Command start failed.
Similarly, when I type this /opt/glassfish4/glassfish/bin/asadmin --port 5656 start-domain, I get
java.io.IOException: Couldn't get lock for /opt/glassfish4/glassfish/domains/domain1/logs/server.log
at java.util.logging.FileHandler.openFiles(FileHandler.java:389)
at java.util.logging.FileHandler.<init>(FileHandler.java:287)
at com.sun.enterprise.admin.launcher.GFLauncherLogger.addLogFileHandler(GFLauncherLogger.java:98)
at com.sun.enterprise.admin.launcher.GFLauncher.setup(GFLauncher.java:191)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.createLauncher(StartDomainCommand.java:220)
at com.sun.enterprise.admin.servermgmt.cli.StartDomainCommand.executeCommand(StartDomainCommand.java:117)
at com.sun.enterprise.admin.cli.CLICommand.execute(CLICommand.java:321)
at com.sun.enterprise.admin.cli.AdminMain.executeCommand(AdminMain.java:360)
at com.sun.enterprise.admin.cli.AdminMain.doMain(AdminMain.java:298)
at org.glassfish.admin.cli.AsadminMain.main(AsadminMain.java:56)
Waiting for domain1 to start .Error starting domain domain1.
The server exited prematurely with exit code 1.
Before it died, it produced the following output:
Launching GlassFish on Felix platform
Exception in thread "main" java.lang.RuntimeException: the domain directory is not writable.
at com.sun.enterprise.glassfish.bootstrap.MainHelper.verifyDomainRoot(MainHelper.java:244)
at com.sun.enterprise.glassfish.bootstrap.MainHelper.findInstanceRoot(MainHelper.java:347)
at com.sun.enterprise.glassfish.bootstrap.GlassFishMain.main(GlassFishMain.java:78)
at com.sun.enterprise.glassfish.bootstrap.ASMain.main(ASMain.java:54)
Command start-domain failed.
I sense there is something problem in path /opt/glassfish4/glassfish/bin/asadmin. I am working on my first JSF web application and cannot run glassfish server. I am using Netbeans and ubuntu 13.10.
Can anyone show me the way?
Thank you!
The error messages
java.io.IOException: Couldn't get lock for
/opt/glassfish4/glassfish/domains/domain1/logs/server.log
and
Exception in thread "main" java.lang.RuntimeException: the domain
directory is not writable.
indicate that the user account you use to start the server doesn't have write permissions in your Glassfish domain folder.
To solve the problem either change the permissions or start the asadmin command with a user who has sufficient permissions.
If this doesn't solve the problem, there may be another process which has a lock on your server.log file, but I guess you would have noticed that. To make sure you can run
lsof /opt/glassfish4/glassfish/domains/domain1/logs/server.log
to see if any process is using the file.
See also:
Failed to start glassfish server because Couldn't get lock for /opt/glassfishv3/glassfish/domains/domain1/logs/server.log

Jruby+swt. Can't execute the application on Amazon server

I try to launch jruby application which use swt library on Amazon EC2 server (linux 32-bit) but get this error:
NameError: missing class or uppercase package name (`org.eclipse.swt.widgets.Display')
get_proxy_or_package_under_package at org/jruby/javasupport/JavaUtilities.java:54
method_missing at file:/tmp/jruby222146559887633660extract/jruby-core-complete-1.7.10.jar!/jruby/java/java_package_module_template.rb:14
Widgets at jar:file:/home/user/test.jar!/gems/swt-0.18/lib/swt/minimal.rb:12
Swt at jar:file:/home/user/test.jar!/gems/swt-0.18/lib/swt/minimal.rb:11
(root) at jar:file:/home/user/test.jar!/gems/swt-0.18/lib/swt/minimal.rb:6
require at org/jruby/RubyKernel.java:1083
(root) at jar:file:/tmp/jruby222146559887633660extract/jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
require at jar:file:/tmp/jruby222146559887633660extract/jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
require at org/jruby/RubyKernel.java:1083
(root) at jar:file:/home/user/test.jar!/gems/swt-0.18/lib/swt.rb:2
(root) at ./main.rb:2
load at org/jruby/RubyKernel.java:1099
(root) at jar:file:/tmp/jruby222146559887633660extract/jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:1
require at org/jruby/RubyKernel.java:1083
require at jar:file:/tmp/jruby222146559887633660extract/jruby-stdlib-complete-1.7.10.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:135
(root) at file:/home/user/test.jar!/META-INF/main.rb:1
error: org.jruby.embed.EvalFailedException: (NameError) missing class or uppercase package name (`org.eclipse.swt.widgets.Display')
Does anyone already faced with this error?
I found the reason: Amazon EC2 server doesn't has any possibility to render any gui. It just server with command terminal. For my case it suits any way, because the app renders only logs in gui. So I will just remove the gui part and display app logs in terminal.

FileNotFoundException while running SolrCloud on Tomcat

I have a Solr 4.2.0 server which is running under the Tomcat 7.0 container. I'm trying to wire it with my external zookeeper (actually, it doesn't work with the embdedded zookeeper too).
I tried this java opts:
-Dbootstrap_confdir=./solr/collection1/conf
-Dcollection.configName=myconf
-DzkRun
-DnumShards=2
for running the embedded zookeeper.
And also this java opts:
-Dbootstrap_confdir=./solr/collection1/conf
-Dcollection.configName=myconf
-DzkHost=localhost:2181
-DnumShards=2
For connecting to external zookeeper
In both cases I continue to get the same exception:
java.io.FileNotFoundException: File '.\solr\collection1\conf \admin-extra.html' does not exist
But the problem is that file admin-extra.html exists and it's right here. And I can't figure out what the problem is.
From your exception it seems your path has a white space after the config directory.
Try to define your bootstrap_configdir between "", like:
-Dbootstrap_confdir="./solr/collection1/conf"

Categories

Resources