Spring Security not working under Windows 7 - java

I just installed Windows 7 with NetBeans 6.5.1 and JDK 6u16. I've checked out the Web application project with SVN, which is working with Spring security. Libraries are imported, no reference problems, the same configuration worked with XP.
Here's the beginning of the exception:
WebModule[/db3]PWC1275: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
Full version Here.
Please if you have any suggestions, write below!
Thanks in advance!

It looks like the issue is that Spring can't find a DataSource resource named "db3" that is supposed to be defined in JNDI. Are the necessary JNDI resources configured in the application server you're using?

If you just installed your operating system, chances are you also just installed your application server. Your web application depends on a database definition in the application server (JNDI). I may be wrong, but it looks like you are using GlassFish as the application server, if that is the case, you can setup a JNDI datasource from the admin console.

Related

Issues deploying a Java application to Tomcat

I built a simple Java web application. It provides a series of RESTful APIs for the user to carry out certain operations on a Java DB through a web interface. I used NetBeans environment during the development, and Glassfish for testing.
Now that I finished it, I would like to be able to deploy it on another machine using binaries (although as for now I use the same machine until I learn how to do it).
I installed Tomcat 7, and moved the .war file into Tomcat's webapp folder. The application deploys. Thereafter I try to read some data from the databse using a button I created just for this, but get the following error
I am not sure what went wrong, but I have two theories.
1) The web application cannot connect to the database. Yet when I attempted to run the application again, after starting JavaDB from NetBeans, there was no difference.
2) Somehow, the application cannot reach the Node service. I assumed that there will be no need to change the API links while moving the app, but perhaps I was wrong.
Or maybe there is some other issue I did not consider? I will be grateful for any advice about how to properly deploy such an application.
EDIT: The issue was solved by using TomEE.
The error is come from your application server of choice.
TomCat is only a servlet container (means it only support Servlet/JSP).
Any other feature (JAX-RS, CDI etc) require a Java EE certified server e.g. GlassFish, WildFly,Payara, WebLogic, OpenLiberty or TomEE.
TomEE could be your best bet if you want to use TomCat in your production or test environment, it is basically TomCat + Java EE other feature.
EDIT:
TomEE don't have a GUI for JNDI datasource configuration like GlassFish, you need to edit conf/tomee.xml
<Resource id="myDataSource" type="javax.sql.DataSource">
jdbcDriver = org.apache.derby.jdbc.ClientDriver
jdbcUrl = jdbc:derby://localhost:1527/dbname
userName = app
password = app
</Resource>
And in your java code:
#Path("resources")
#Stateless
public class MyResources{
#Resource(name="myDataSource")
DataSource dataSource;
#GET
public Response SomeMethod(){
//Do stuff here
}
}
You can check here for more detail configuration on data source.

Not able to successfully run HelloWorld app on HANA Cloud from Eclipse

Java version 8.x
Apache Tomcat version 8.x
J2EE 2.5 (Deployment Descriptor) used in WebApplication
HANA Cloud trial configured and validated correctly in eclipse.
WebApplication to print 'Hello World!' created exactly same as mentioned in the documentation of hana help, where url pattern for servlet is changed to - '/', i have made it exactly the same.
Application url is getting generated in SAP HANA Cockpit after I start the application on server.
Error while I try to run servlet on HANA cloud server from eclipse:
while trying to invoke the method
com.sap.core.tools.eclipse.server.common.runtime.ISapSdkRuntime.getRuntimeSdkId()
of a null object loaded from local variable 'sdkRuntimeDelegate'
When I click on the Application URL nothing is being shown in the page.
If any solution you can provide to correct this or any improvements that you feel.
Thanks in advance!!
It is solved now, there was a problem of J2EE runtime, I had to setup JAVA Web Tomcat 7 runtime and it worked

IncompatibleClassChangeError: org/objectweb/asm/AnnotationVisitor when deploying application on weblogic server

I developed a web application using spring version 3.2.6 and as long as I am deploying it on my tomcat server everything works fine.
Now, if I try to deploy this same application on a weblogic application server I get the following:
java.lang.IncompatibleClassChangeError: org/objectweb/asm/AnnotationVisitor
I think it is related to the spring version installed on the remote weblogic server.
I know I can force the server to use my classes by the following directive in the configuration xml:
<prefer-application-packages>
<package-name>
what do I put here?
</package-name>
Anyway I really don't know what to set there...can you help me out?
Generally IncompatibleClassChangeError means that you have code changes without a recompile.
Use:
<wls:prefer-application-packages>
<wls:package-name>org.springframework.*</wls:package-name>
</wls:prefer-application-packages>
Or prefer-web-inf-classes
This will force weblogic to use the jar packaged in your app. If it still doesn't work, you have a separate issue.
Also check this link about JRF versions

make a bean run on application start. EJB3/websphere6.1/Java1.5

I am a little new to J2EE. I have a EJB3 project and I want to run a class on application start-up, how can I do that?
I know in EJB3.1 I can use #startup and #singleton unfortunately that is not a option and I have to use EJb3 and java 5. I have done some research and there were a few solutions but I have been unable to make it work.
WebSphere Application Server version 6.1 does not support EJB3 with a standard installation. You also need to have a feature pack for EJB 3.0 installed.
See this information on the IBM site.
If this is not your issue you should update your question with more detail of what goes wrong.
Your only options prior to WebSphere 8 (with EJB 3.1 support) are:
WebSphere startup beans. These are a programming model extension
Package a WAR with the application, and use a ServletContextListener to initialize state used by the EJBs.

Convert Spring Roo Application into a JBoss 6 Application

I have a Spring Roo app that is deploying to Tomcat with no issues. I'm trying to deploy it to JBoss 6, but I'm finding it impossible to do so.
I've exhausted all resources from Google and I simply receive errors everywhere. Unfortunately, they do not seem specific enough to start narrowing them down to list here.
What can information could I provide to help resolve this situation?
Essentially, I need to know what I need to change from a standard Spring Roo app, using Hibernate and Mysql to work with JBoss 6.
EDIT:
This is the error that I am getting
[ClassLoaderManager] Unexpected error during load of:org.apache.commons.collections.DoubleOrderedMap$1$1: java.lang.IllegalAccessError: class org.apache.commons.collections.DoubleOrderedMap$1$1 cannot access its superclass org.apache.commons.collections.DoubleOrderedMap$DoubleOrderedMapIterator
Impossible to tell, since you posted no errors.
I'm guessing that it's a problem with the configuration difference between JBOSS and Tomcat.
You set up JDBC data source connection pools differently. Tomcat has the context.xml in the server /conf folder. JBOSS has other XML config files in its server/default/deploy folder. Did you create those correctly?
I assume that you're using JNDI names for injected data sources.
Your JDBC driver JAR for MySQL goes in the Tomcat /lib folder and the JBOSS server/default/deploy/lib folder, not the wAR WEB-INF/lib.
But you should be able to take a WAR with all the Spring Roo stuff, put it into an EAR with jboss-web.xml configuration, and start it up.

Categories

Resources