set CLASSPATH in Jruby 1.6.4 - classpath

How to set class path in JRuby 1.6.4 ?
I set my class path as
set CLASSPATH=
%<project_name>%\lib\java\ant-1.6.5.jar;
%<project_name>%\lib\java\ant-antlr-1.6.5.jar;
%<project_name>%\lib\java\ant-junit-1.6.5.jar;
%<project_name>%\lib\java\ant-launcher-1.6.5.jar;
%<project_name>%\lib\java\ant-swing-1.6.5.jar;
%<project_name>%\lib\java\antlr-2.7.6.jar;
%<project_name>%\lib\java\asm-attrs.jar;
%<project_name>%\lib\java\asm.jar;
%<project_name>%\lib\java\auriga-cryptolib.jar;
%<project_name>%\lib\java\bcprov-jdk12-137.jar;
%<project_name>%\lib\java\c3p0-0.9.1.jar;
%<project_name>%\lib\java\cglib-nodep-2.1_3.jar;
%<project_name>%\lib\java\checkstyle-all.jar;
%<project_name>%\lib\java\cleanimports.jar;
%<project_name>%\lib\java\commons-collections-2.1.1.jar;
%<project_name>%\lib\java\commons-logging-1.0.4.jar;
%<project_name>%\lib\java\concurrent-1.3.2.jar;
%<project_name>%\lib\java\dom4j-1.6.1.jar;
%<project_name>%\lib\java\ehcache-1.2.3.jar;
%<project_name>%\lib\java\hibernate-tools.jar;
%<project_name>%\lib\java\hibernate3.jar;
%<project_name>%\lib\java\jaas.jar;
%<project_name>%\lib\java\jacc-1_0-fr.jar;
%<project_name>%\lib\java\javassist.jar;
%<project_name>%\lib\java\jaxen-1.1-beta-7.jar;
%<project_name>%\lib\java\jboss-cache.jar;
%<project_name>%\lib\java\jboss-common.jar;
%<project_name>%\lib\java\jboss-jmx.jar;
%<project_name>%\lib\java\jboss-system.jar;
%<project_name>%\lib\java\trg-dao-hibernate-0.5.0.jar;
%<project_name>%\lib\java\trg-search-0.5.0.jar;
%<project_name>%\lib\java\trg-search-hibernate-0.5.0.jar;
%<project_name>%\lib\java\trilead-ssh2-build213.jar;
%<project_name>%\lib\java\versioncheck.jar;
%<project_name>%\lib\java\xerces-2.6.2.jar;
%<project_name>%\lib\java\xml-apis.jar;
%<project_name>%\lib\java\jasperreports-3.7.6.jar;
%<project_name>%\lib\java\commons-digester-1.7.jar;
%<project_name>%\lib\java\iText-2.1.7.jar;
%<project_name>%\lib\java\jfreechart-1.0.12.jar;
%<project_name>%\lib\java\jcommon-1.0.15.jar;
%<project_name>%\classes\;
But Windows cannot load these classes. I even tried to set the class in Windows environment variables at that time its works. But I can't put these much classes there more over its bad practice.
Actually I'm migrating an app from 1.4 Jruby. In 1.4 the CLASSPATH works perfectly.
Any help would be greatly appreciated?

At last I found the answer you need to load all the local classes in your project then load the other class.
In my case I load this class first
% project_name %\classes\;

Related

Apache Meecrowave OAuth2 JPA

I succeedeed in creating my own OAuth2 server using JCache as token store but I'm facing an issue when moving to JPA.
My configuration is :
"--users","test=test",
"--roles","test=test",
"--oauth2-provider","jpa",
"--oauth2-jpa-database-driver","org.h2.Driver",
"--oauth2-jpa-database-url","jdbc:h2:mem:oauth",
"--oauth2-jpa-database-username","sa",
"--oauth2-jpa-database-password",""
But I got exception below during OpenJPA bootstrap :
here was an error while setting up the configuration plugin option "MetaDataFactory".
The plugin was of type "org.apache.openjpa.persistence.jdbc.PersistenceMappingFactory".
Setter methods for the following plugin properties were not available in that type: [
org.apache.cxf.rs.security.oauth2.tokens.bearer.BearerAccessToken,
org.apache.cxf.rs.security.oauth2.common.OAuthPermission,
org.apache.cxf.rs.security.oauth2.tokens.refresh.RefreshToken,
org.apache.cxf.rs.security.oauth2.grants.code.ServerAuthorizationCodeGrant,
org.apache.cxf.rs.security.oauth2.common.UserSubject].
Possible plugin properties are:
[AnnotationParser, ClasspathScan, FieldOverride, Files, JAR_FILE_URLS, MAPPING_FILE_NAMES, MODE_ALL, MODE_ANN_MAPPING, MODE_MAPPING, MODE_MAPPING_INIT, MODE_META, MODE_NONE, MODE_QUERY, PERSISTENCE_UNIT_ROOT_URL, Repository, Resources, STORE_DEFAULT, STORE_PER_CLASS, STORE_VERBOSE, StoreDirectory, StoreMode, Strict, Types, URLs, XMLAnnotationParser, XMLParser].
Ensure that your plugin configuration string uses key values that correspond to setter methods in the plugin class.
I suppose I missed something in configuration...
Any help would be appreciated.
Tx
Using --oauth2-jpa-properties you can set any persistence unit properties you want, I guess you will have to override openjpa.MetaDataFactory default value which is set to jpa(Types=org.apache.cxf.rs.security.oauth2.common.Client,org.apache.cxf.rs.security.oauth2.common.OAuthPermission,org.apache.cxf.rs.security.oauth2.common.UserSubject,org.apache.cxf.rs.security.oauth2.grants.code.ServerAuthorizationCodeGrant,org.apache.cxf.rs.security.oauth2.tokens.bearer.BearerAccessToken,org.apache.cxf.rs.security.oauth2.tokens.refresh.RefreshToken).
You can also check if your configuration is properly propagated and if there is no classpath conflict (another persistence.xml with an oauth2 unit?) because I just retested and your configuration seems to work.
Romain

Failed to start Neo4j service

I am using neo4j enterprise 3.0.3 version for windows. Following the operations manual 3.0, I have installed the neo4j service with bin\neo4j install-service. But I can't start it with bin\neo4j start. It said
Invoke-Neo4j : Failed to start service 'Neo4j Graph Database - neo4j (neo4j)'.
And I can't start the neo4j service in windows serice either. Maybe anyone have encountered this case before?
I had the same problem: I am using neo4j community 3.1.2 for windows and installed the service with the neo4j.bat file without any problems.Then i wanted to start the service with neo4j.bat and got the same error as you
I found a solution that worked for me. My neo4j files were in a folder, where the path to the folder contained spaces (C:\Program Files\Neo4j) Then i moved the folder one level up (C:\Neo4j).
After that i could start the service without problems.
Maybe this solution helps.
I am running neo4j on windows and in my case the crux of the issue was that there was an incompatibility between the installed versions of Java (32-bit) v/s OS version. The biggest clue that led me to this is the following set of lines in neo4j-service.2018-08-03 log file
[2018-08-03 14:55:42] [info] [ 1432] Starting service...
[2018-08-03 14:55:42] [error] [ 1432] %1 is not a valid Win32 application.
[2018-08-03 14:55:42] [error] [ 1432] Failed creating java C:\JavaNew\bin\server\jvm.dll
[2018-08-03 14:55:42] [error] [ 1432] %1 is not a valid Win32 application.
[2018-08-03 14:55:42] [error] [ 1432] ServiceStart returned 1
There are a fair number of potential issues, and I have made an attempt to compile all the issues with this,
Windows services cannot deal with service names in folders that have spaces; especially if there is another folder with the same name as the one with spaces.
For example - C:\Program Files... will have issues if C:\Program\Something...
To work around this, I put Neo4j in root folder c:\Neo4j
Get-Java.ps1 (under ..\bin\Neo4j-Management folder)looks in the path variable for 'JAVA_HOME' (usually found in *nix environments). If it does not find it here, it keeps looking in registry, and finally throws up its hand!
To deal with this, I simply put in a path variable. For a good measure, I uninstalled Java and re-installed Java in the root folder under C:\JavaNew
In retrospect, this step is probably not on part of the problem, and hence can be ignored. But I am leaving it here for completeness sake.
Invoke-Neo4j.ps1 (also under ..\bin\Neo4j-Management folder) has code that determines if the OS is 32-bit (or 64-bit). Based on this it determines if it should run prunsrv-i386.exe (32-bit) or prunsrv-amd64.exe (64-bit).
This has to match the Java version installed.
Upon running java -XshowSettings:all, and inspecting the sun.arch.data.model value (32, in my case), I realized that my OS is 64 bit and the Java version is 32-bit.
To deal with this, I put in code (very klugey!). I am sure there are much better ways to get to the same outcome, but this is what I used.
switch ( (Get-WMIObject -Class Win32_Processor | Select-Object -First 1).Addresswidth ) {
32 { $PrunSrvName = 'prunsrv-i386.exe' } # 4 Bytes = 32bit
#64 { $PrunSrvName = 'prunsrv-amd64.exe' } # 8 Bytes = 64bit COMMENTED as a workaround!!!
64 { $PrunSrvName = 'prunsrv-i386.exe' } # 8 Bytes = 64bit
Now, uninstall the neo4j service, install it, and start the service.
Hope this works for you.
neo4j console
Posting for latest versions > 4.x
I had the same issue using neo4j start, Neo4j console is the right command I was looking for. It is a web-based graph that acts as an interactive tutorial.
i had the same problem , after the neo4j worked for few weeks it stoop working (without any change that i made)
i have set java_home uninstall and install and now it works
neo4j-enterprise-3.3.4
I was also having weired issue as there was no error but neo4J service did not start.
[xx#ss1 bin]$ ./neo4j console
[xx#ss1 bin]$ .
The problem was with the permission on Java directory and I tried
chmod -R 777 jdk_directory
and problem got solved.
#neo4j #neo4jnotstarting

Issue "Exception in thread "main"# START NON-TRANSLATABLEjava.lang.NoClassDefFoundError: G€“Xmx3072m" (MyEclipse 12.0 Blue & Websphere7)

I am using MyEclipse 14.0 Blue & Websphere7. I am trying to deploy into the Websphere via Server tab, and when it starts to deploy I am getting below issue.
****Exception in thread "main"# START NON-TRANSLATABLEjava.lang.NoClassDefFoundError: G€“Xmx3072m
Caused by: java.lang.ClassNotFoundException: G€“Xmx3072m
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at java.lang.ClassLoader.loadClass(ClassLoader.java:660)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
Could not find the main class: GÇôXmx3072m. Program will exit.****
Any suggestion to resolve this issue?
I think, you have typo in your jvm configuration so it thinks max heap size param (-Xmx3072m) is a classpath variable, please check configuration.
I had a similar problem and fixed it by fixing the global PATH variable.
One variable had two quotes around it which messed up the path for the websphere...
A second thing would be to check for any characters that would be invalid for batch files or scripts in the operating system (because your problem seems to be encoding related)
Some more hints you may find here.

NoClassDefFoundError in openid4java

I have downloaded openid4java-0.9.6.662 and implemented a class using it. When I execute:
List discoveries = manager.discover("https://www.google.com/accounts/o8/id");
I get a
java.lang.NoClassDefFoundError: org/apache/http/protocol/ImmutableHttpProcessor
at org.apache.http.impl.client.AbstractHttpClient.getProtocolProcessor(AbstractHttpClient.java:656)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:804)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:732)
at org.openid4java.util.HttpCache.head(HttpCache.java:335)
at org.openid4java.discovery.yadis.YadisResolver.retrieveXrdsLocation(YadisResolver.java:400)
at org.openid4java.discovery.yadis.YadisResolver.discover(YadisResolver.java:248)
at org.openid4java.discovery.yadis.YadisResolver.discover(YadisResolver.java:232)
at org.openid4java.discovery.yadis.YadisResolver.discover(YadisResolver.java:166)
at org.openid4java.discovery.Discovery.discover(Discovery.java:147)
at org.openid4java.discovery.Discovery.discover(Discovery.java:129)
at org.openid4java.consumer.ConsumerManager.discover(ConsumerManager.java:542)
at com.sugra.openid.helper.OpenIDConsumer.authRequest(OpenIDConsumer.java:90)
the funny thing is this class cannot be found in any of the jars, thought it is supposed to be found in httpcore-4.0.1.jar, as it contains classes of the same package. This class is available in httpcore-4.2.1.jar. But I've tried it and got
org.openid4java.discovery.yadis.YadisException: 0x704: I/O transport error: hostname in certificate didn't match: <www.google.com/173.194.35.144> != <www.google.com>
that is reported to be an error of portability and a previous version should be used
What is supposed to be the right approach to use this method?
I found it. There was a conflict with another jar (httpclient.jar) I had in my app. I just had to upgrade it

Lift Mailer error: gnu.mail.handler.TextPlain cannot be cast to javax.activation.DataContentHandler

Using the following code:
sendMail(From(Props.get("email")), Subject("Test Email"), To("email#address"),
PlainMailBodyType("test email body"));
And in Boot.scala:
System.setProperty("mail.smtp.starttls.enable","false");
System.setProperty("mail.smtp.host", host)
System.setProperty("mail.smtp.auth", "true")
Mailer.authenticator = Full(new Authenticator {
override def getPasswordAuthentication = new PasswordAuthentication(user, password)
})
I get the following error:
2011-05-23 18:49:02,868 ERROR [pool-3-thread-4] n.l.u.MailerImpl [Logging.scala:239] Couldn't send mail
java.lang.ClassCastException: gnu.mail.handler.TextPlain cannot be cast to javax.activation.DataContentHandler
at javax.activation.MailcapCommandMap.getDataContentHandler(MailcapCommandMap.java:596) ~[activation-1.1.jar:1.1]
at javax.activation.MailcapCommandMap.createDataContentHandler(MailcapCommandMap.java:550) ~[activation-1.1.jar:1.1]
at javax.activation.DataHandler.getDataContentHandler(DataHandler.java:611) ~[activation-1.1.jar:1.1]
at javax.activation.DataHandler.writeTo(DataHandler.java:315) ~[activation-1.1.jar:1.1]
at javax.mail.internet.MimeUtility.getEncoding(MimeUtility.java:261) ~[mail-1.4.1.jar:1.4.1]
at javax.mail.internet.MimeBodyPart.updateHeaders(MimeBodyPart.java:1321) ~[mail-1.4.1.jar:1.4.1]
at javax.mail.internet.MimeMessage.updateHeaders(MimeMessage.java:2074) ~[mail-1.4.1.jar:1.4.1]
at javax.mail.internet.MimeMessage.saveChanges(MimeMessage.java:2042) ~[mail-1.4.1.jar:1.4.1]
at javax.mail.Transport.send(Transport.java:117) ~[mail-1.4.1.jar:1.4.1]
at net.liftweb.util.MailerImpl$$anon$1$$anonfun$$init$$1.apply(Mailer.scala:176) ~[lift-util_2.8.1-2.3.jar:2.3]
This code works on one box and not on another. Any ideas?
Alternative solution if you want to use the Jetty package that comes with your Linux distro.
The problem only seems to occur with the GNU implementation of JavaMail. If you can use the Sun implementation instead, it works fine, or at least it did for me.
Adding Sun's javamail:
I took activation-1.1.jar and mail-1.4.1.jar that sbt had placed under the lib_managed/ folder of my Lift project, and placed them under /usr/share/jetty/lib/ on the server.
Removing GNU javamail:
Unfortunately, commenting out the gnumail.jar from /etc/jetty/start.config wasn't enough to get rid of gnumail. Jetty somehow still found the gnumail.jar and now mails just crashed in a different way. To get things to work smoothly I had to uninstall libgnumail-java and therefore also libjetty-extra which depends on it (I'm using Ubuntu). If you need libjetty-extra you'll need a different way to ensure Jetty won't see gnumail.jar.
Apparently it is an issue in versions of Jetty < 6.1.25.
http://olex.openlogic.com/packages/jetty/6.1.25 Something wrong with activation dependency.
Switching to the latest version of jetty (7.3) fixed it!