endasil
asked on
Java can't find logon configuration when running application from command promt
My application works fine from netbeans, but when running from the command line i get an exception. I have done some research on google on this and the problem seemed to be related to not setting the path to the login.config file, but i have.
This is what i type: java -jar java application3.jar -Djava.security.auth.login .config=.\ appclientl ogin.conf
If i do not have -the Djava.security.auth.login. config=.\a ppclientlo gin.conf set under properties - run - VM Options i will get the same error message.
Thank you for taking the time to read this.
This is what i type: java -jar java application3.jar -Djava.security.auth.login
If i do not have -the Djava.security.auth.login.
Thank you for taking the time to read this.
The Main.java file for the application
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package demo;
import javax.annotation.security.RolesAllowed;
import javax.ejb.Stateless;
/**
*
* @author js
*/
@Stateless
public class SB3 implements SB3Remote {
@Override @RolesAllowed("DummyUsers")
public String Hello(String name) {
return ("Hello 2 " + name);
}
}
2010-sep-05 19:23:45 com.sun.appserv.security.ProgrammaticLogin login
ALLVARLIG: Programmatic login failed: java.lang.SecurityException: Det gÕr
inte att hitta nÕgon inloggningskonfiguration
Exception in thread "main" java.lang.ClassFormatError: Absent Code attribut
e in method that is not native or abstract in class file javax/security/jac
c/PolicyContextException
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.sun.enterprise.security.SSLUtils.<clinit>(SSLUtils.java:102)
at com.sun.enterprise.iiop.IIOPSSLSocketFactory.<init>(IIOPSSLSocke
tFactory.java:182)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Me
thod)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown So
urce)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknow
n Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance0(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
at com.sun.corba.ee.impl.orb.ParserTable$4.operate(ParserTable.java
:700)
at com.sun.corba.ee.impl.orb.NormalParserAction.apply(NormalParserA
ction.java:58)
at com.sun.corba.ee.spi.orb.PropertyParser.parse(PropertyParser.jav
a:81)
at com.sun.corba.ee.spi.orb.ParserImplBase.init(ParserImplBase.java
:81)
at com.sun.corba.ee.impl.orb.ORBDataParserImpl.<init>(ORBDataParser
Impl.java:482)
at com.sun.corba.ee.impl.orb.ORBImpl.postInit(ORBImpl.java:587)
at com.sun.corba.ee.impl.orb.ORBImpl.set_parameters(ORBImpl.java:70
1)
at org.omg.CORBA.ORB.init(Unknown Source)
at com.sun.enterprise.util.ORBManager.initORB(ORBManager.java:546)
at com.sun.enterprise.util.ORBManager.getORB(ORBManager.java:278)
at com.sun.enterprise.naming.SerialInitContextFactory.getInitialCon
text(SerialInitContextFactory.java:178)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at demo.Main.main(Main.java:40)
appclientlogin.conf file located under C:\Sun\AppServer\lib\appclient
default {
com.sun.enterprise.security.auth.login.ClientPasswordLoginModule required debug=false;
};
certificate {
com.sun.enterprise.security.auth.login.ClientCertificateLoginModule required debug=false;
};
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
Should add that the i get the first error listed above: "Programmatic login failed: java.lang.SecurityExceptio n: Det gÕr
inte att hitta nÕgon inloggningskonfiguration" error happens when i attemt to do a pm.login(user, "dummy");
The second error appears when i try to do a ctx = new InitialContext(env);
javax.naming.NamingExcepti on: ejb ref resolution error for remote business
interfacedemo.SB3Remote
inte att hitta nÕgon inloggningskonfiguration" error happens when i attemt to do a pm.login(user, "dummy");
The second error appears when i try to do a ctx = new InitialContext(env);
javax.naming.NamingExcepti
interfacedemo.SB3Remote
ASKER
I solved the problem with not finding logon configuration by typing -java -djava... -jar appname instead of -java -jar appname -djava... apparantly everything written after -jar is seen as commands for the application.
The policy exception was a problem with the wrong jar file and was solved thanks to your comment about incompatible jars and replacing the j2ee.jar with another worked. Thanks.
The policy exception was a problem with the wrong jar file and was solved thanks to your comment about incompatible jars and replacing the j2ee.jar with another worked. Thanks.
ASKER
I solved the problem with not finding logon configuration by typing -java -djava... -jar appname instead of -java -jar appname -djava... apparantly everything written after -jar is seen as commands for the application.
The policy exception was a problem with the wrong jar file and was solved thanks to your comment about incompatible jars and replacing the j2ee.jar with another worked. Thanks.
The policy exception was a problem with the wrong jar file and was solved thanks to your comment about incompatible jars and replacing the j2ee.jar with another worked. Thanks.
ASKER
Open in new window