Birt: how to deploy a report in production? - java

I have just prepared a report with bird using eclipse plugin. It works.
Now I have deployed a birt 4.4 viwer on a Tomcat7. It works.
Now I put my report.rptdesign file insider birt folder under webapps in tomcat.
It does not work.
Obviously because:
the jdbc driver is encoded in report with full path that is obviously different from eclipse to tomcat;
birt needs a "org.eclipse.datatools_workspacepath" configured in tomcat (why????)
even if I configure above variable it complains about missing:
java.lang.NoClassDefFoundError: org/eclipse/datatools/enablement/ibm/util/ClientUtil
Yes I have used standard jdbc source (not "for query builder" one).
I would like to ask stack overflow why is so bloody complicated (and not documented) putting in production a simple report that uses a mysql jdbc jar.
Can you help me?
Thanks,
Mario

Well I don't understand all the question but I use birt with glassfish and jboss, you need to configure a JDBC in your server (I suppose you already have done that), then you have to change your Datasources erase all and use a JNDI URL with the name of your JDBC for example, if you create a datasource JDBC/test this is the JNDI url.
For the workspacepath I think this can be solved changing something in the birt war, go to META-INF and open the web.xml, then change this properties for another folders that have sufficient access permissions:
<param-name>BIRT_VIEWER_WORKING_FOLDER</param-name>
<param-name>BIRT_VIEWER_DOCUMENT_FOLDER</param-name>
<param-name>BIRT_VIEWER_IMAGE_DIR</param-name>
<param-name>BIRT_VIEWER_LOG_DIR</param-name>

Related

Log4j2 configuration - indentify the webapp

In my webapp I configure Log4j2 with XML file.
The case is there's might be several versions of this webapp deployed on the server (for production purpose). If I don't edit log4j2 configuration, all webapps write logs to the same location.
So I need somehow identify versions of the app and add this identifier to the end of the folder name.
Apps always have different names, so maybe I can use it.
Can anyone please suggests some solution for this?
P. S. I know I could use ${log4j:configParentLocation} or something like this, but this gives me troubles when I deploy the app.
Edit: I don't use Spring boot, just usual Tomcat Servlet webapp with web.xml.

how to add a parameter to spring project before <projectname>/login and after <localhost>:<portnumber> without hardcode?

I'm working on a Spring MVC project. When I run the application the URL is:
http://localhost:8080/insureYou/login
but I want:
http://localhost:8080/contextroot/insureYou/login
Is there any way of doing it without hardcoding?
In a spring-boot project you can set the context-root by specifying the following property in the application.properties file:
server.servlet.context-path=/yourcontextroot
Without spring-boot, it depends on the webserver and Tomcat offers a number of options.
I would personally opt for a META-INF/context.xml file in your war file containing the necessary information but you can also include the information in the server.xml file or in a ROOT.xml file.
See the following links for further guidance:
How to set the context path of a web application in Tomcat 7.0
https://tomcat.apache.org/tomcat-8.0-doc/config/context.html
https://www.baeldung.com/tomcat-root-application
This type of deployment however sometimes is handled separately, through an Apache server reverse-proxy or through URL rewriting.
I recommend you ascertain whether this type of need is already taken care of by your company's deployment procedures, as you may not need to deal with it at all.

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.

How run java web strat application with hsql and glassfish?

I have java program with main function, that packaged into jar archive. There is dao class with DataSource. An jdbc url to data file is expected an is passed as argument to main function. Everything works as standalone application, but how I must link jar file with database when they both in glassfish? For example, I put jnlp into glassfish docroot directory, and put HSQL database file with populated data too. Whta link I must pass tho that database? If I simple replace
"C:\path"
with
"http://localhost:8080\path_inside_docroot_folder"
I get EOFException in java when it tryies to read a file.
Off topic:
Also it very strange, when I created hsql database I write something like this:
jdbc:hsqldb:C:\\path\db_file.dat
But actually in the path there is no exactly db_file.dat. There are several files, like:
db_sile.dat.tmp
db_sile.dat.lck
db_sile.dat.log
db_sile.dat.properties
db_sile.dat.scrip
Can anyone solve my problem? May files mentioned upper influence to the problem or it is pure glassfish deploy problem?
If something unclear ask me.
The answer is you can not run HSQL inside as static resource glassfish. You can run HSQL server as HTTP server or as servlet if you deploy web application. The solution for my problem is to put JNDI file and java jar file as static resources in glassfish and run HSQL server in the same computer (where glassfish is running).

how to make my files present in a tomcat server to the browser

I have installed Tomcat 5.0 in order to execute a web application. How can I show my files which are present in Tomcat to the web browser? I tried http://hostname:8080/myfolder/login.html, but I can't see the files.
One more thing I know about JDBC and other database connectivity and I have developed a HTML page. How can I let a button in the page execute the code written in a Servlet and perform validations?
The simplest thing is to add to the root webapp. That is webapps/ROOT. Any file you put in there will be served unless you change the default configuration.
You should read about the details, of course.
I have installed Tomcat 5.0 in order to execute a web application.
First of all, why are you using the ancient (8 year old) Tomcat 5.0? If you can, rather grab the latest one, Tomcat 6.0.
How can I show my files which are present in Tomcat to the web browser? I tried http://hostname:8080/myfolder/login.html, but I can't see the files.
Is myfolder the context name or just a folder in your webcontent? If it's a context name, then you need to ensure that it's properly deployed. You can find details in the server logs in the /logs folder. If it is a folder in your webcontent and the webapplication is thus supposedly to be the "root" application, then you need to ensure that it's deployed as ROOT.
To learn more about using Tomcat, go through the documentation.
One more thing I know about JDBC and other database connectivity and I have developed a HTML page. How can I let a button in the page execute the code written in a Servlet and perform validations?
To the point, just create a class which extends HttpServlet, implement the doPost() method, define the servlet in web.xml and let the action attribute of the HTML <form> element point to an URL which is covered by the url-pattern of the servlet mapping in the web.xml.
As the question is pretty broad, I have the impression that you haven't learned in any way how to work with Tomcat and JSP/Servlets. I would strongly recommend to go through those tutorials to familarize yourself with JSP/Servlet on Tomcat and Eclipse (an IDE) first: Beginning and Intermediate-Level Servlet, JSP, and JDBC Tutorials
Tomcat is not a web server like, say, Apache. It's a servlet container. You can not just move file in a subfolder which seem to be what you did. You need to pack your web application in a .war and deploy it.
The URL should rather be http://host:8080/webapp/subfolder/login.jsp
Without much information it's hard to help. Please edit your question and describe what you've done so far.

Categories

Resources