I have below sample to validate xslt style sheet. In various forums it was mentioned that we should "net.sf.saxon.TransformerFactoryImpl" for xslt 2.0 style sheet. According I have updated my code. But this piece of code is working for only few cases. For example, the code does not work for the sample I have attached below. If I change sample style sheet version to 1 (version="1.0"), then code works fine. Otherwise it fails. I believe the sample style sheet is valid xslt 2.0 document.
This is causing lot of problem, how do I validate a style sheet before I parse?
package com.ibm.mq.id;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.stream.StreamSource;
import net.sf.saxon.TransformerFactoryImpl;
public class xsltTransformationEx {
/**
* #param args
*/
public static void main(String[] args) {
String path="C://Work//ex.xsl";
TransformerFactoryImpl factory = new TransformerFactoryImpl();
try
{
javax.xml.transform.Templates template = factory.newTemplates(new StreamSource(path));
//VALIDATING XSLT is valid or not
//Transformer trans = factory.newTransformer(new StreamSource(path));
template.newTransformer();
}
catch(TransformerConfigurationException ex)
{
ex.printStackTrace();
}
}
}
And my Sample XSLT is below:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
<xsl:output indent="yes" method="xml"/>
<xsl:variable name="FamilyMembers" select="bpws:getVariableData('HSPACT_FamlyNumbers')"></xsl:variable>
<xsl:template match="Molers_Output">
<xsl:element name="Molers_Output">
<!--
<xsl:element name="row">
<xsl:value-of select="row"/>
</xsl:element>
-->
<xsl:for-each select="row[Hosp_Acct_Num = $FamilyMembers/rows/row/normalize- space(HACCT_)]">
<xsl:variable name="Account"><xsl:value-of select="Hosp_Acct_Num"></xsl:value-of></xsl:variable>
<xsl:element name="row">
<xsl:for-each select="node()">
<xsl:choose>
<xsl:when test="name()='Family_Num'">
<xsl:element name="Family_Num">
<xsl:value-of select="$FamilyMembers/rows/row[normalize-space(HACCT_) = $Account]/HAFAM_"/>
</xsl:element>
</xsl:when>
<xsl:otherwise>
<xsl:copy copy-namespaces="yes" inherit-namespaces="yes">
<xsl:value-of select="current()"/>
</xsl:copy>
</xsl:otherwise>
</xsl:choose>
</xsl:for-each>
</xsl:element>
</xsl:for-each>
</xsl:element>
</xsl:template>
</xsl:stylesheet>
Your stylesheet has a call to a function named bpws:getVariableData in the namespace http://schemas.xmlsoap.org/ws/2003/03/business-process/ but there is no definition for that function so that you get a compilation error. You would need to define that function using xsl:function or xsl:import/include a module that defines the function.
Related
Summary
We have a quickfix client which receives SecurityDefiniton and SecurityDefinitionUpdateReport messages. These are bulk datas. When we logged to the server they send messages around 8000. At the end they're sending SecurityStatus message. In this part we are getting an exception.
Fix protocol version: FIX50SP2 with FIXT1.1
Quickfix message dependency
<dependency>
<groupId>org.quickfixj</groupId>
<artifactId>quickfixj-messages-fix50sp2</artifactId>
<version>2.3.0</version>
</dependency>
Quickfix Core
<dependency>
<groupId>org.quickfixj</groupId>
<artifactId>quickfixj-core</artifactId>
<version>2.0.0</version>
</dependency>
Exception we received;
Exception in thread "pool-5-thread-1" java.lang.VerifyError: Bad type on operand stack
Exception Details:
Location:
quickfix/fix50sp2/SecurityStatus.get(Lquickfix/field/HaltReason;)Lquickfix/field/HaltReason; #2: invokevirtual
Reason:
Type 'quickfix/field/HaltReason' (current frame, stack[1]) is not assignable to 'quickfix/IntField'
Current Frame:
bci: #2
flags: { }
locals: { 'quickfix/fix50sp2/SecurityStatus', 'quickfix/field/HaltReason' }
stack: { 'quickfix/fix50sp2/SecurityStatus', 'quickfix/field/HaltReason' }
Bytecode:
0x0000000: 2a2b b600 1557 2bb0
at quickfix.fix50sp2.MessageFactory.create(MessageFactory.java:297)
at foo.bar.data.plugin.fix.api.MessageFactory.MessageFactorySp2.create(MessageFactorySp2.java:93)
at quickfix.MessageUtils.parse(MessageUtils.java:145)
at quickfix.mina.AbstractIoHandler.messageReceived(AbstractIoHandler.java:131)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$TailFilter.messageReceived(DefaultIoFilterChain.java:858)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:947)
at org.apache.mina.filter.codec.ProtocolCodecFilter$ProtocolDecoderOutputImpl.flush(ProtocolCodecFilter.java:398)
at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:234)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.access$1300(DefaultIoFilterChain.java:48)
at org.apache.mina.core.filterchain.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:947)
at org.apache.mina.core.filterchain.IoFilterAdapter.messageReceived(IoFilterAdapter.java:109)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:542)
at org.apache.mina.core.filterchain.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:535)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:703)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:659)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:648)
at org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:68)
at org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1120)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
We couldn't get SecurityStatus fix message. The problem we thought was about datadictionary. As a field HaltReason is a CharField
public class HaltReason extends CharField {
static final long serialVersionUID = 20050617L;
public static final int FIELD = 327;
public static final char NEWS_DISSEMINATION = 'D';
public static final char ORDER_INFLUX = 'E';
public static final char ORDER_IMBALANCE = 'I';
public static final char ADDITIONAL_INFORMATION = 'M';
public static final char NEWS_PENDING = 'P';
public static final char EQUIPMENT_CHANGEOVER = 'X';
When we look FIX50SP2 default datadictionary halt reason field is INT.
<field number="327" name="HaltReasonInt" type="INT">
<value enum="0" description="NEWS_DISSEMINATION"/>
<value enum="1" description="ORDER_INFLUX"/>
<value enum="2" description="ORDER_IMBALANCE"/>
<value enum="3" description="ADDITIONAL_INFORMATION"/>
<value enum="4" description="NEWS_PENDING"/>
<value enum="5" description="EQUIPMENT_CHANGEOVER"/>
</field>
We tried convert dictionary field to HaltReasonChar and the type CHAR but it didn't work. Did you ever get an exception like this?
Here's the security status message which I received.
8=FIXT.1.19=00017835=f49=BI_TEST56=LIABR34=589857=TRTK152=20220208-20:07:15.9281180=R1181=28513331350=285133255=T2-ON48=3762690422=M336=148325=N60=20220208-20:07:15.92810=245
It doesn't look like the HaltReason field (tag 327) is included in your status message. Is it an optional or required field for the SecurityStatus message type? You can control that in your data dictionary definition.
The dictionary for FIX50SP2.xml I have indicates this field is not required, but yours could be different.
Be careful of broker-supplied dictionaries; they are frequently wrong or outdated.
The following worked fine for me: report is of type quickfix.fix44.SecurityStatus
try {
response.setHaltReason(report.getString(327));
} catch (Exception e) {
log.error...
}
I have a situation where when log.error("message", exception); is called, I want some logic to happen around sending the exception to an external tool, while still maintaining the regular logging for the line to the root appender.
As an example, here would be some code and the expected outcome:
try {
...
} catch (Exception ex) {
LOG.info("abcd");
LOG.error("failed to XYZ", ex);
}
Rough Outcome:
2019-03-05 13:00:20 INFO Main:75 - abcd
2019-03-05 13:00:20 ERROR Main:76 - failed to XYZ -
Exception: exception message
stacktrace
stacktrace
...
While that is logged, I also want the exception sent through another code path.
How can I do this? I'm a bit stuck, does anyone know any good guides for this?
I don't think you really want an Appender here. It would be simpler to write a Filter instead. For reference you can find information regarding creating extensions for log4j2 on the Extending Log4j2 page of the manual
In the example below I created a simple filter that matches when the log event has a Throwable associated with it and mismatches when there is no Throwable (i.e. the Throwable is null or the log was generated from a method call that did not include a Throwable parameter).
In the example I send all matching log events to a simple file appender to illustrate that in fact it does capture only events with a Throwable. You could modify this filter to do whatever you need. You could change it to always be NEUTRAL to every event, but when a non-null Throwable is found it then triggers some special logic to send that Throwable to your external tool. Basically you would be using the filter as more of an interceptor. I will describe that change at the end.
First, here's some basic Java code to generate some logging including a log event that has a Throwable.
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
public class SomeClass {
private static final Logger log = LogManager.getLogger();
public static void main(String[] args){
if(log.isDebugEnabled())
log.debug("This is some debug!");
log.info("Here's some info!");
log.error("Some error happened!");
try{
specialLogic();
}catch(RuntimeException e){
log.error("Woops, an exception was detected.", e);
}
}
public static void specialLogic(){
throw new RuntimeException("Hey an exception happened! Oh no!");
}
}
Next, here's the class I call ThrowableFilter:
import org.apache.logging.log4j.Level;
import org.apache.logging.log4j.Logger;
import org.apache.logging.log4j.Marker;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.config.plugins.Plugin;
import org.apache.logging.log4j.core.config.plugins.PluginAttribute;
import org.apache.logging.log4j.core.config.plugins.PluginFactory;
import org.apache.logging.log4j.core.filter.AbstractFilter;
import org.apache.logging.log4j.message.Message;
#Plugin(name = "ThrowableFilter", category = "Core", elementType = "filter", printObject = true)
public final class ThrowableFilter extends AbstractFilter {
private ThrowableFilter(Result onMatch, Result onMismatch) {
super(onMatch, onMismatch);
}
public Result filter(Logger logger, Level level, Marker marker, String msg, Object[] params) {
return onMismatch;
}
public Result filter(Logger logger, Level level, Marker marker, Object msg, Throwable t) {
return filter(t);
}
public Result filter(Logger logger, Level level, Marker marker, Message msg, Throwable t) {
return filter(t);
}
#Override
public Result filter(LogEvent event) {
return filter(event.getThrown());
}
private Result filter(Throwable t) {
return t != null ? onMatch : onMismatch;
}
/**
* Create a ThrowableFilter.
* #param match The action to take on a match.
* #param mismatch The action to take on a mismatch.
* #return The created ThrowableFilter.
*/
#PluginFactory
public static ThrowableFilter createFilter(#PluginAttribute(value = "onMatch", defaultString = "NEUTRAL") Result onMatch,
#PluginAttribute(value = "onMismatch", defaultString = "DENY") Result onMismatch) {
return new ThrowableFilter(onMatch, onMismatch);
}
}
Finally, here is the log4j2.xml configuration file I used to test this:
<?xml version="1.0" encoding="UTF-8"?>
<Configuration status="warn">
<Appenders>
<Console name="Console" target="SYSTEM_OUT">
<PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
</Console>
<File name="ExceptionFile" fileName="logs/exception.log" immediateFlush="true"
append="true">
<ThrowableFilter onMatch="ACCEPT" onMismatch="DENY"/>
<PatternLayout
pattern="%d{yyy-MM-dd HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n" />
</File>
</Appenders>
<Loggers>
<Root level="debug">
<AppenderRef ref="Console" />
<AppenderRef ref="ExceptionFile" />
</Root>
</Loggers>
</Configuration>
Running the logic in SomeClass produces the following output:
On the console:
23:23:25.931 [main] DEBUG example.SomeClass - This is some debug!
23:23:25.946 [main] INFO example.SomeClass - Here's some info!
23:23:25.946 [main] ERROR example.SomeClass - Some error happened!
23:23:25.946 [main] ERROR example.SomeClass - Woops, an exception was detected.
java.lang.RuntimeException: Hey an exception happened! Oh no!
at example.SomeClass.specialLogic(SomeClass.java:25) ~[classes/:?]
at example.SomeClass.main(SomeClass.java:18) [classes/:?]
In the logs/exception.log file:
2019-03-06 23:23:25.946 [main] ERROR example.SomeClass - Woops, an exception was detected.
java.lang.RuntimeException: Hey an exception happened! Oh no!
at example.SomeClass.specialLogic(SomeClass.java:25) ~[classes/:?]
at example.SomeClass.main(SomeClass.java:18) [classes/:?]
Now to change the filter to act more as an interceptor you could alter the following methods:
//Remove parameters from constructor as they will not be used.
private ThrowableFilter() {
super();
}
...
public Result filter(Logger logger, Level level, Marker marker, String msg, Object[] params) {
//Changed to always return NEUTRAL result
return Result.NEUTRAL;
//old logic: return onMismatch;
}
...
private Result filter(Throwable t) {
//TODO: trigger the external tool here when t != null, pass t if needed.
//Changed to always return NEUTRAL result
return Result.NEUTRAL;
//old logic: return t != null ? onMatch : onMismatch;
}
/**
* Create a ThrowableFilter.
* #return The created ThrowableFilter.
*/
#PluginFactory
public static ThrowableFilter createFilter() {
return new ThrowableFilter();
}
Then in the configuration you would remove the parameters to the filter. It would now look like this:
<ThrowableFilter/>
Hope this helps you.
I'm begining with xamarin and android, and I'm not sure to understand the good way to do.
Then I created a main activity and a second activity with their respective layouts.
In the first I put a button with that code:
button.Click += (sender, e) =>
{
var intent = new Android.Content.Intent(this, typeof(Activity1));
StartActivity(intent);
OverridePendingTransition(Android.Resource.Animation.SlideInleft, Android.Resource.Animation.SlideInleft);
};
And in the second:
button.Click += (sender, e) =>
{
Finish();
};
But this doesn't do what I want, I would like the two layouts two slide as if there were side by side, but here the second layout just slides on the first. Also it comes from the left were I would like it to come from the right and there's no SlideInright.
Also is it the right way to do using two activities, mustn't I have only one activity and two layouts (views?).
First, you could use one activity which contains two ViewGroup. As for your question, you can use Animation and FrameLayout which contains two RelativeLayout to complete what you want, like this:
MainActivity.axml:
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:a="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="#+id/rl2"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="#android:color/holo_green_dark">
<Button
android:id="#+id/bt2"
android:text="page2"
android:layout_height="100dp"
android:layout_width="100dp" />
</RelativeLayout>
<RelativeLayout
android:id="#+id/rl1"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="#android:color/holo_red_dark">
<Button
android:id="#+id/bt1"
android:text="page1"
android:layout_height="100dp"
android:layout_width="100dp" />
</RelativeLayout>
</FrameLayout>
MainActivity:
[Activity(Label = "Aniamtion", MainLauncher = true)]
public class MainActivity : Activity
{
Button bt1,bt2;
RelativeLayout rl1, rl2;
int width;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
getScreenWidth();//get the screen's width, so we can define how much the animation can translate
initView();
initListener();
}
private void getScreenWidth()
{
DisplayMetrics dm = new DisplayMetrics();
WindowManager.DefaultDisplay.GetMetrics(dm);
width = dm.WidthPixels;
}
private void initListener()
{
bt1.Click += toPage1;
bt2.Click += toPage2;
}
private void toPage1(object sender, EventArgs e)
{
//use ObjectAnimator to complete it
ObjectAnimator objectAnimator = ObjectAnimator.OfFloat(rl1, "translationX", 0, -width);
objectAnimator.SetDuration(500);
objectAnimator.Start();
ObjectAnimator objectAnimator1 = ObjectAnimator.OfFloat(rl2, "translationX", width, 0);
objectAnimator1.SetDuration(500);
objectAnimator1.Start();
}
private void toPage2(object sender, EventArgs e)
{
ObjectAnimator objectAnimator = ObjectAnimator.OfFloat(rl1, "translationX", -width, 0);
objectAnimator.SetDuration(500);
objectAnimator.Start();
ObjectAnimator objectAnimator1 = ObjectAnimator.OfFloat(rl2, "translationX", 0, width);
objectAnimator1.SetDuration(500);
objectAnimator1.Start();
}
private void initView()
{
bt1 = FindViewById<Button>(Resource.Id.bt1);
bt2 = FindViewById<Button>(Resource.Id.bt2);
rl1 = FindViewById<RelativeLayout>(Resource.Id.rl1);
rl2 = FindViewById<RelativeLayout>(Resource.Id.rl2);
}
}
Second, about this OverridePendingTransition(Android.Resource.Animation.SlideInleft, Android.Resource.Animation.SlideInleft) method, the parameter you can use System resource, or you can custom it .
Update:
put this into your Resource->anim->SlideInRight, this is about customing animation in Xamarin.Android, it is same as Android, and this is document which you can refer to
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="#android:anim/linear_interpolator">
<translate android:fromXDelta="50%p"
android:toXDelta="0"
android:duration="300"/>
</set>
I want to use the vaadin gantt chart component and used some of the code examples for a test.
I can create the object but is not readable
public class PlanningView extends VerticalLayout implements View {
// declare parent GUI
private MainUI myUI;
// declare navigator
public Navigator navigator;
// declare menubar
public MenuGenerator menubar;
private TimeZone defaultTimeZone;
private Gantt gantt;
private NativeSelect reso;
private DateField start;
private DateField end;
private SimpleDateFormat dateFormat = new SimpleDateFormat("MMM dd HH:mm:ss zzz yyyy");
public PlanningView(Navigator navigator, MainUI myUI) {
this.myUI = myUI;
this.navigator = navigator;
menubar = new MenuGenerator(this);
VerticalLayout mainlayout = new VerticalLayout();
gantt = new Gantt();
gantt.setWidth(100, Unit.PERCENTAGE);
gantt.setHeight(500, Unit.PIXELS);
gantt.setResizableSteps(true);
gantt.setMovableSteps(true);
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
gantt.setStartDate(cal.getTime());
cal.add(Calendar.YEAR, 1);
gantt.setEndDate(cal.getTime());
cal.setTime(new Date());
Step step1 = new Step("First step");
step1.setStartDate(cal.getTime().getTime());
cal.add(Calendar.MONTH, 2);
step1.setEndDate(cal.getTime().getTime());
gantt.addStep(step1);
mainlayout.addComponents(gantt);
addComponent(mainlayout);
}
#Override
public void enter(ViewChangeEvent arg0) {
// TODO Auto-generated method stub
Notification.show("Planning");
}
public void navigate(String page) {
navigator.navigateTo(page);
}
}
This is what it looks like:
I just had the same issue and after a while, I found the solution.
First, you have to add a addons.scss file to your theme
webapp/VAADIN/themes/mytheme/addons.scss:
/* This file is automatically managed and will be overwritten from time to time. */
/* Do not manually edit this file. */
/* Provided by gantt-addon-1.0.1.jar */
#import "../../../VAADIN/addons/gantt/gantt.scss";
/* Import and include this mixin into your project theme to include the addon themes */
#mixin addons {
#include gantt;
}
Afterward, modify your theme file:
webapp/VAADIN/themes/mytheme/mystyle.scss:
#import "addons.scss";
#import "../../../VAADIN/addons/gantt/gantt-valo.scss";
#include addons;
#include gantt-valo;
Additionally, your widget set needs to inherit from the one of the gantt addon:
<module>
<inherits name="org.tltv.gantt.WidgetSet" />
</module>
As you are using custom client side code, you have to add the client-compiler dependency to your build process:
<dependency>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-client-compiler</artifactId>
</dependency>
Be aware of the vaadin-maven.plugin, which must be told to compile the widget set:
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${com.vaadin_version}</version>
<configuration>
<extraJvmArgs>-Xmx1G -Xss1G</extraJvmArgs>
<webappDirectory>${basedir}/src/main/webapp/VAADIN/widgetsets</webappDirectory>
<hostedWebapp>${basedir}/src/main/webapp/VAADIN/widgetsets</hostedWebapp>
<compileReport>true</compileReport>
<strict>true</strict>
</configuration>
<executions>
<execution>
<goals>
<goal>resources</goal>
<goal>update-theme</goal>
<goal>update-widgetset</goal>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
I 'm looking for a solution to my problem a long time , I do not find anything to help me, i need to create exe from my app, when I compile it works , however when I try to generate the exe it give me a exception:
Caused by: java.lang.IllegalStateException: Location is not set.
at javafx.fxml.FXMLLoader.loadImpl(Unknown Source)
at javafx.fxml.FXMLLoader.load(Unknown Source)
at br.nivelamento.MainApp.initRootLayout(Unknown Source)
at br.nivelamento.MainApp.start(Unknown Source)
at com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$163
(Unknown Source)
build.xml
<project name="Nivelamento" default="do-deploy" basedir="." xmlns:fx="javafx:com.sun.javafx.tools.ant">
<target name="init-fx-tasks">
<path id="fxant">
<filelist>
<file name="${java.home}\..\lib\ant-javafx.jar" />
<file name="${java.home}\lib\jfxrt.jar" />
</filelist>
</path>
<taskdef resource="com/sun/javafx/tools/ant/antlib.xml" uri="javafx:com.sun.javafx.tools.ant" classpathref="fxant" />
</target>
<fx:resources id="appRes">
<fx:fileset dir="dist" includes="Nivelamento.jar" />
<fx:fileset dir="dist" includes="libs/*" />
</fx:resources>
MainApp.class
package br.nivelamento;
public class MainApp extends Application {
private Stage primaryStage;
private BorderPane rootLayout;
#Override
public void start(Stage primaryStage) {
this.primaryStage = primaryStage;
this.primaryStage.setTitle("NivelamentoApp");
setUserAgentStylesheet(STYLESHEET_CASPIAN);
initRootLayout();
}
public static void main(String[] args){
MainApp.launch(MainApp.class, args);
}
public void initRootLayout() {
try {
// Carrega o root layout do arquivo fxml.
FXMLLoader loader = new FXMLLoader();
loader.setLocation(getClass().getResource("view/RootLayout.fxml"));
rootLayout = (BorderPane) loader.load();
// Mostra a scene (cena) contendo o root layout.
Scene scene = new Scene(rootLayout);
primaryStage.setScene(scene);
// Dá ao controller o acesso ao main app.
RootLayoutController controller = loader.getController();
controller.setMainApp(this);
//liga o hibernate
JpaUtil.getEntityManager();
primaryStage.show();
} catch (IOException e) {
e.printStackTrace();
}
}
Folders Tree
can anyone help me?
thanks
after many attempts I finally succeeded, the error was in
loader.setLocation (MainApp.class.getResource ("view / RootLayout.fxml"));
RootLayout.fxml see that is not the real name real name is rootLayout.fxml repairing the uppercase character was solved my problem