I have an EJB deployed under JBoss (we're moving a project to it from Weblogic), I can get an EJBHome reference to the EJB via a JNDI lookup.
The login-config.xml application-policy contains several login modules (I don't know if these are ANDs or ORs?) - org.jboss.security.spi.BaseCertLoginModule, LdapLoginModule, RoleMappingLoginModule and ClientLoginModule.
When my client code tries to invoke the create method via reflection, calling invoke, I get an InvocationException which wraps an AccessException, which wraps a final exception of javax.security.auth.login.FailedLoginException: Password Incorrect/Password Required at org.jboss.security.auth.spi.UsernamePasswordLoginModule.login(UsernamePasswordLoginModule.java:213)....
Am I missing some client code to use BaseCertLoginModule, or one of the others in the login-config.xml, instead of UsernamePasswordLoginModule?
Thanks in advance, any suggestions appreciated, apologies for not posting the entire stacktrace but it's on a secured network without internet access.
Related
I have this Exception, please I need your support.
there are one wildfly20 instance to services and other wildfly20 instance to tier web.
Web tier consume jdni as service in remote enviroment. It's testing and work well with some methods.
Now, right here come the case. Some methods from jndi tier work without problem and web call it, and get resources well, But, some others when Web tier call jndi call receive this exception (javax.ejb.EJBException: Failed to read response).
Please, Let's me know witch could be the cause for this exception triggered?.
Any hints that help with that.
every one.
I'm answer my own quetion for anyone with same issue, because I dont find information that I could use to resolve it.
Like I said I have two instance of wildfly.
1 web tier project.
2 JNDI tier with services.
In the web tier just add in the jboss-deployment-struture.xml hibernate dependency module. It's default wildfly in modoles set org.hibernate.
That's it.
I am using Shiro Security to secure a JSF project.
It is working as expected, including calls to a remote EJB (that is unsecured). However, when a call to the unsecure EJB is made, i have the following warn, but the method is executed without a problem:
IIOP1002: Principal propagation: Cannot find principal information in subject
What does this exactly mean? What should I do to fix this? I need to execute the method in a remote EJB from a secured application and this warning is getting dumped to the log everytime a call to the EJB is made (this occurs multiple times).
Edit:
The warn doesn't occur when I deploy the project in the same Glassfish server as the EJB.
Edit 2:
I thought about inserting the principal information in the InitialContext, before doing the call to the EJB, like this:
Hashtable env = new Hashtable();
env.put(Context.SECURITY_PRINCIPAL, SecurityUtils.getSubject().getPrincipal());
ctx = new InitialContext(env);
Still no luck.
SecurityUtils is from org.apache.shiro.SecurityUtils library.
Apache Shiro is an application layer security solution. As far as I can tell it is not integrated with your application server in any way.
A Java EE server normally expects to be in charge of authentication, authorisation, etc. Consequently it is then in a position to be able to propagate credentials correctly when making both local and remote EJB calls. This is how features like javax.annotation.security.RolesAllowed are implemented.
Shiro propagates its principal to javax.security.Principal, which remote EJBs don't understand. The Java principal has to be nulled out.
This is done in Shiro EE integration module which will be integrated into Shiro with version 2.0+
I have an application that uses spring to the calling rest services. Specifically, the RestTemplate class. Right before I make the call to:
restTemplate.execute(
url,
method,
new JSONRequestCallback(headerParams),
new JSONResponseExtractor(containerType, cls));
method, I check the value url in the call. I quite literally can copy and paste the value of that url (lets call it http://myHost.net:8081) into a browser in the same network domain as my tomcat 8 (the web container I am using in eclipse), and the service response is successfully returned from the browser. However, the execute method throws an exception upon return:
org.springframework.web.client.ResourceAccessException: I/O error: myHost.net; nested exception is java.net.UnknownHostException: myHost.net
Now, the web service I am calling is on the internet while my dev environment is not. To address, we opened an appropriate port in our firewall and I can successfully access the service endpoint from a browser (as indicated above) by properly configuring the proxy settings on the browser. Similarly, from my Tomcat 8 configuration within eclipse, I have added the following launch configuration VM arguments:
-Dhttp.proxySet=true
-Dhttp.proxyHost=myHost.net
-Dhttp.proxyPort=8080
but as I have indicated above, I still get the unknown host exception.
By the way, I did see a similar issue here (Spring RestTemplate and Proxy Auth) but that required a coding solution in the spring code. I was hoping for a configuration solution as our system will not have the proxy issue in the operational environement.
I am hoping someone might have some ideas as to either what I might be doing wrong, and/or how I might be able to better diagnose my problem. Thank you!
I'm fairly new to Java--though, coming from PHP + JS. I aim to make a CRUD (+MVC) with Java Servlets.
I am using Java EE 7. I based some of my patterns here with this and that (both have the same final files).
So, I am implementing MVC, and I can't seem to make my code to work. JPA seems to be the main issue; I can't fetch anything from the database.
Here's the repository (really small project -- 7~8 classes). Models; DAO.
I had setup controllers.Test(url: /test) to test if I could actually communicate with the database via JPA. However, when I go to /test(controllers.Test), an exception is thrown. The same goes for controllers.NewsEdit(url: /edit).
java.lang.NullPointerException
controllers.Test.doGet(Test.java:36)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
When I visit home(url: /; controller.NewsIndex), I receive no exceptions -- I get the homepage, but no data at all. Is there anything I'm doing wrong?
My SQL files are located in the /sql folder. I got persistent.xml on META-INF/.
Any help or reference would be appreciated. Really need to learn it..
Thanks!
Ok,
A lil explanation about NullPointerException.
When the variable (in this case private NewsDAO newsDAO;) hasn't been initialized, that "pointer" is pointing to nothing in memory. Then when you try to call a method, there is nothing there and the NPE happens.
The problem here is that private NewsDAO newsDAO; is not being injected by the container and therefore when you call newsDAO.all(); newDAO is null and throws the exception.
CDI Injection only happens for components managed by the containers. I'm a spring guy so I'm not sure where to go here. Try to figure out if your NewsDAO is being loaded by the container.
Tomcat is a web container... You need a full Application server with an EJB container to run your example. Try to download and run on glassfish, JBoss or any other full app server.
more info here.
http://en.wikipedia.org/wiki/Application_server#Java_application_servers
and
http://www.oracle.com/technetwork/java/javaee/overview/compatibility-jsp-136984.html
Again, many excellent answers from the fine folks here on SO. I am still unable to connect. But I believe Gimby might have had a good suggestion that there may be something wrong with the server or the beans. According to the log file generated when JBoss started, my beans have been deployed. The administrator of the server is unable to run the admin console for vulnerabilities reasons so there is no way to see if the beans are running. Is there a command line tool that I could point him to for testing? Is there a simple test I could write that would check the beans? I have tried most everything I have found and others have suggested and keep getting various errors. most times being:
javax.naming.CommunicationException: Could not obtain connection to any of these urls: remote://:4647
I've encountered other errors as I have made changes to various files and code but this one is the most frequent. If the call I make to the bean is right, and that is questionable, then how do I tell if the bean is even running or not>
There seems to be some uncleared situations here.
Still I want to ask you, if your bean got a remote interface.
You could use lookup to find your bean on this server.
You also could deploy for example a RESTservice on your jboss server, which look for your bean locally, so you dont have to specify any connection properties, but you would need the jndi name.
Hope this helps a bit, greets Jerome.