Glassfish 2.1 classpath-prefix or classpath-suffix not loading - glassfish-2.x

Hope you can help me here, I am trying to add some new jars to the classpath of the glasspath, but they just fail to load up.
I am using glassfish 2.1
Here's the snippet when the server is started
-Dcom.sun.aas.ClassPathPrefix=../grops/lib/grops-4.3.5.jar;../grops/lib/iaik_jce_full_3.13.jar;../grops/config
-Dcom.sun.aas.ClassPathSuffix=
-Dcom.sun.aas.ServerClassPath=
Snippet from my domain.xml
java-config classpath-suffix="../grops/lib/grops-4.3.5.jar${path.separator}../grops/lib/iaik_jce_full_3.13.jar${path.separator}../grops/config${path.separator}../grops/lib/zmd-security-LU2.jar${path.separator}../grops/lib/db2jcc.jar${path.separator}../grops/lib/db2jcc_javax.jar${path.separator}..........
I have tried from admin console and also changing directly in domain.xml , they just dont load up and always throw an error java.lang.NoClassDefFoundError

I have solved this by myself, actually whenever we add something to the classpath newly a new command window has to be used to restart the glassfish server:
ex run-->cmd--> cd C:\glassfish\bin
asadmin --> start-domain xxx
This has to be done by closing the previous command window after stopping the server by stop-domain because everytime you run asadmin command, asenv is called which sets the new parameters to the JVM.

Related

How to install WebLogic AdminServer and NodeManager as windows service?

I am trying to install Weblogic adminserver as windows service but getting "Input too long" error while executing the install script.
I have struggled a lot in this issue and finally got the way to register AdminServer and Nodemanager as windows service for Weblogic. Below are the steps and issues faced with the progress:
To register weblogic AdminServer as windows server first need to create a script which will contain values like oracle home, java home etc. Below is the script I have used to install the service:
`
echo off
SETLOCAL
set MW_HOME=C:\Oracle\Middleware\Oracle_Home
set DOMAIN_NAME=osb_domain
set USERDOMAIN_HOME=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\osb_domain
set SERVER_NAME=AdminServer
set WL_HOME=C:\Oracle\Middleware\Oracle_Home\wlserver
set PRODUCTION_MODE=true
set JAVA_OPTIONS=-Dweblogic.Stdout="%USERDOMAIN_HOME%\stdout.txt" -Dweblogic.Stderr="%USERDOMAIN_HOME%\stderr.txt"
set WLS_USER=weblogic
set WLS_PW=Password123
set MEM_ARGS=-Xms1024m -Xmx1024m
call "C:\Oracle\Middleware\Oracle_Home\user_projects\domains\osb_domain\bin\setDomainEnv.cmd"
call "C:\Oracle\Middleware\Oracle_Home\wlserver\server\bin\installSvc.cmd"
ENDLOCAL
`
By running this script I was not even able to install the windows service as it was throwing " Input is too long" error and the reason is windows char limitations. You might get confused by classpath and will try to resolve classpath but
the issue is with JAVA_OPTIONS values which is set by SetDomainEnv.txt is creating this issue.
I have modified the script like below and shorten the JAVA_OPTIONS values by calling SetDomainEnv.txt command just before setting JAVA_OPTIONS in the script.
This has overridden the lengthy value of JAVA_OPTIONS. Now I have succesfully installed the AdminServer as windows service.
`
echo off
SETLOCAL
set MW_HOME=C:\Oracle\Middleware\Oracle_Home
set DOMAIN_NAME=osb_domain
set USERDOMAIN_HOME=C:\Oracle\Middleware\Oracle_Home\user_projects\domains\osb_domain
set SERVER_NAME=AdminServer
set WL_HOME=C:\Oracle\Middleware\Oracle_Home\wlserver
set PRODUCTION_MODE=true
call "C:\Oracle\Middleware\Oracle_Home\user_projects\domains\osb_domain\bin\setDomainEnv.cmd"
set JAVA_OPTIONS=-Dweblogic.Stdout="%USERDOMAIN_HOME%\stdout.txt" -Dweblogic.Stderr="%USERDOMAIN_HOME%\stderr.txt"
set WLS_USER=weblogic
set WLS_PW=Password123
set MEM_ARGS=-Xms1024m -Xmx1024m
call "C:\Oracle\Middleware\Oracle_Home\wlserver\server\bin\installSvc.cmd"
ENDLOCAL `
Even the service is successfully installed, when I was starting it the service is stopped immediately and wasn't printing any logs as it was not connecting to AdminServer.
After a bit analysis I found that JAVA_OPTIONS values which I have overridden in my script is very much needed to invoke AdminServer.
I have run SetDomainEnv.txt in cmd prompt and copied thre JAVA_OPTIONS values.
As the service is already installed, I just copied the correct JAVA_OPTIONS values CMDLINE param in the windows service registry manually.
Server subsystem failed. Reason: A MultiException has 6 exceptions.
Server installed as Windows NT service with incorrect password for user weblogic. The password may have been changed since the server was installed as a Windows NT Service. Contact the Windows NT system administrator.
Note: No extra spaces or character is inserted in CMDLINE param.
Now everything is in place which is actually required to start the admin server. But when I start the service it is throwing some authentication error along with others in the adminserver.log file.
after a lot of analysis I found that is is not authentoication issue, the problem was with boot.properties file. boot. properties file was not read properly.
This answer is continuation of below one:
after a lot of analysis I found that is is not authentoication issue, the problem was with boot.properties file. boot. properties file was not read properly.
Now I would give some background- If the fusion middleware is installed as development mode the boot.properties files is created automatically inside Oracle_HOME\user_projects\domains\domainname\servers\AdminServer\security and if you look at this prop file you will find the password and username in encrypted mode.
If the fusion Middleware is installed as production Mode then everytime it will ask for password and username. to avoid this perform below steps:
manually create file under Oracle_HOME\user_projects\domains\domainname\servers\AdminServer\security\boot.properties like mention below:
username=weblogic
password=Password
Note: No spaces should be added and take care of file extension.
Now start weblogic from domain\bin\startWeblogic.cmd. This will encrypt you boot.properties file. check boot.proprties file if encrypted you are good to go.
Finally start the windows service whic is installed following above process. It should work fine.
=======================
About Node manager use installNodeMgrSvc from domain\bin. Again if you get input is too long error, you must shorten JAVA_OPTIONS and then carefully edit CMDLINE param in the windows registry.

Where to edit grails startup command line in IntelliJ IDEA?

Grails-2.5.0 startup fails if fork mode is disabled.
I've found a workaround at https://jira.grails.org/browse/GRAILS-12129, which says;
Don't use the spring loaded java agent. Removing the following from the command started by IntelliJ is enough
But I cannot find where the command is written.
Run -> Edit Configurations doesn't have any option to disable agent.
Where should I edit?
If you open the run configuration you should see fields like Module, Command Line, VM options and more. So add this to the Command Line field
-noreloading -Ddisable.auto.recompile=true run-app
That should stop Grails from reloading your application.

new grails project won't start

I'm trying to get my feet wet with grails, so I'm following a tutorial to get going with a sample project. I downloaded grails 2.3.2, added the environment variables for the command prompt commands, and successfully created a project by using >grails create-app teamwork. Calling >grails run-app after changing to the project directory successfully downloads all requisites, but then I get . I know that this exception doesn't reveal much, but do you guys have any ideas on why? I am running command prompt in admin mode, if that means anything.
Try not forking the JVM in BuildConfig.groovy, if I recall correctly. If that works, then check the JIRA issues for Grails 2.3.2.

Grails: Native2ascii error when I add a new property to message.properties

I get a strange error when I add a new property to message.properties file in my grails application during runtime. When I restart the application via the command line, or restart STS, this error disappears. I am on version 2.0.1 and until a week ago, I was able to add new properties to message.properties file during runtime. Here is the stacktrace of the error
| Error 2012-06-18 16:54:58,702 [Thread-38] ERROR plugins.AbstractGrailsPluginManager - Plugin [i18n:2.0.1] could not reload changes to file [/home/project/grails-app/i18n/messages.properties]: Error starting Sun's native2ascii:
Message: Error starting Sun's native2ascii:
Any ideas?
cd to jdk path
cp lib/tools.jar jre/lib/ext/tools.jar
It solves the issue.
Note: to get correct jdk path,
check GGTS --> Windows --> Preferences --> Java --> Installed JREs --> JREs Home Path
You should be using JDK rather than JRE.
Also, if you don't need the native2ascii (which you probably don't), in BuildConfig.groovy use: grails.enable.native2ascii = false
Very frustrating bug.
After I executed all the steps suggested above in this thread, grails app was STILL not seeing tools.jar...
GRRR!
For anyone experiencing this problem in GGTS when pointing to the 1.7 jdk (when setting the jre) persisting afterwards, you MUST do the following:
Pick the correct jdk (1.7) in the "JRE Definition" panel within "Installed JRE's" in the GGTS Preferences panels.
Watch the jars from that jdk populate in the JRE definition window panel at the bottom "JRE System Libraries".
Check for tools.jar (mine DID NOT show up as recognized within the jdk lib or, after i tried 'zawmn83's post above) in /lib/ext.
If tools.jar does not show up as recognized in the jdk, click the "Add External JARs..." button, find it, add it.
That completely solve my problem - THANK GOD!!!!
p.s. i also had to set my JAVA_HOME to my 1.7 jdk correctly, in my .bash_profile but, that's already called out here as part of the solution.
Thanks everyone for contributing on this one - this bug has been causing me brain damage whilst tinkering with it today, and the above suggestions got me 99% of the way there!
I had a similar problem, in the end I
Removed the Debug Config for the Project
Deleted the project (but NOT the files)
Removed the .settings directory
Removed the .classpath and .project files from the project
Created a New General Project with the same name in the workspace
Recreated the Debug -> Run as Run-App
Hope this helps
This happened to me when I installed java 8 in parallel with java 7 on Ubuntu but didn't properly configure it with update-alternatives. Specifically, JAVA_HOME was not set properly.
I had a similar error when compiling Grails 2 from the command line under linux.
Error packaging application: Error occurred processing message bundles: Error starting Sun's native2ascii:
...
Caused by: : Error starting Sun's native2ascii:
...
Caused by: java.lang.ClassNotFoundException: sun.tools.native2ascii.Main`
I solved it by setting JAVA_HOME to JDK as mentioned above, something like
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.161.x86_64
and not:
JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64
also include $JAVA_HOME/bin in the PATH variable
On linux, running grails war command, it solves the issue
cp /usr/lib/jvm/java-1.8.0-openjdk/lib/tools.jar /usr/lib/jvm/java-1.8.0-openjdk/jre/lib/ext/

How to use command to shutdown grails run-app

After executing grails run-app, except using Ctrl + C", is there a command to shutdown it?
For Stop Server
Exit from the terminal and use any one from the commands below:
grails exit
grails stop-app
grails quit
No. grails run-app is intended to be run for development, interactively.
If you want to control grails as a service, you should deploy it to a web application container such as tomcat. The tomcat plugin allows you to easily deploy your app to tomcat, for example. Add lines like
tomcat.deploy.username="manager"
tomcat.deploy.password="secret"
tomcat.deploy.url="http://myserver.com/manager"
to Config.groovy and then you can use
grails tomcat deploy
grails tomcat undeploy
to start and stop your application. Alternatively, you can use grails war to bundle your app into a war archive which all java app servers should be able to use.
If you really want to stop grails run-app without Ctrl+C, write a small controller that calls System.exit(0). Then browse to that URL, or write a small shell script or batch file that invokes it with e.g. wget or curl.
Open a new command line window, go to the project directory and type:
grails stop-app
This will stop the application if it is running in forked mode.
You can then go to the same URL and see that the page won't be displayed, i.e., the server has been stopped as it will be specified also when the command executes.
grails exit
This will stop the application if running in non-forked mode, otherwise it will quit the console.
grails quit
Exits the console.
in Grails 2.3.3, running 'grails dev run-app' on the command line leaves the command window in a kind-of limbo. It does not give you back the command prompt, Ctrl-C does nothing, and you have to revert to killing the processes by hand.
It is much more pleasant to follow the intended usage, as follows:
On the command line, enter the command 'grails' and hit return (notice no parameters are given). This starts grails itself, (and only grails, i.e. it does not start your server or app). This results in one new java process. It also gives you back the grails prompt, so you are still in control.
1.1 At the grails prompt, you can start your server (and app), by typing 'run-app'. This starts your server (in dev mode), and again gives you back the grails prompt. With your server running, you now have two java processes running, one for grails, and the other for your server and app.
1.2 If you want to stop your server (and app), you can, at the grails prompt, enter 'stop-app', which will stop the server and app. Also, you get your grails prompt back. After stopping your server/app, you will be back to having just one java process running, i.e. grails.
1.3 At the grails prompt, you can start and stop your app as many times as you like.
1.4 To stop grails itself, at the grails prompt, you can enter 'exit' or 'quit', and then grails will quit, and leave you back with the normal command prompt. At this point, the grails java process should be gone too, so there should be no java processes running.
I believe all of grails 2.3.x behaves like this.
My system is windows 7.
Hope this helps.
Noel
In Grails 2.1.0, a simple "exit" stops the server
I found a neat way that works on Grails 2.0.1 for me.
This is a hack that uses a hack put in GrailsRun.groovy for shutting down servers after running functional tests. (see line 246)
Create a file in the application basedir named .kill-run-app
When Grails sees the .kill-run-app file, it issues a grailsServer.stop(). It also conveniently deletes the file. This may depend on having autoRecompile on. I'm not sure, like I said this is a hack.
One day it will most likely cease to work when the GrailsRun.groovy script is changed.
I created a simple Ant target to do this. Granted you will need another terminal to execute it (actually I run it from Eclipse).
<target name="kill-app" description="--> Kills Grails web application" depends="">
<touch file="${basedir}/.kill-run-app"/>
</target>
Quick way is to kill the java process:
ps -aux | grep grails
kill "proess ID from above that is container to your application"
I'm new to Grails and I also had this "problem". I wrote a little script (called grill ;-)) that kills all the grails-processes.
#!/bin/bash
for P in $(ps aux | grep grails | grep java | awk '{print $2};'); do
kill -9 $P
done
exit 0
I had same problem to stop my running grails server. I did
ps aux | grep grails --> that gave me the PID
kill -9 PID
That way I was able to stop my running server. Hope that helps.

Resources